Annotation of embedaddon/mrouted/Makefile, revision 1.1.1.2
1.1 misho 1: # Makefile for mrouted, a multicast router, and its auxiliary -*-Makefile-*-
2: # programs: map-mbone, mrinfo and mtrace.
3: #
4:
5: # VERSION ?= $(shell git tag -l | tail -1)
1.1.1.2 ! misho 6: VERSION ?= 3.9.6
1.1 misho 7: NAME = mrouted
8: CONFIG = $(NAME).conf
9: EXECS = mrouted map-mbone mrinfo mtrace
10: PKG = $(NAME)-$(VERSION)
11: ARCHIVE = $(PKG).tar.bz2
12:
13: ROOTDIR ?= $(dir $(shell pwd))
14: RM ?= rm -f
15: CC ?= $(CROSS)gcc
16:
17: prefix ?= /usr/local
18: sysconfdir ?= /etc
19: datadir = $(prefix)/share/doc/mrouted
20: mandir = $(prefix)/share/man/man8
21:
22: # Uncomment the following three lines if you want to use RSRR (Routing
23: # Support for Resource Reservations), currently used by RSVP.
24: RSRRDEF = -DRSRR
25: RSRR_OBJS = rsrr.o
26:
27: IGMP_SRCS = igmp.c inet.c kern.c
28: IGMP_OBJS = igmp.o inet.o kern.o
29:
30: # This magic trick looks like a comment, but works on BSD PMake
31: #include <config.mk>
32: include config.mk
33: #include <snmp.mk>
34: include snmp.mk
35:
36: ROUTER_OBJS = config.o cfparse.o main.o route.o vif.o prune.o callout.o \
37: icmp.o ipip.o vers.o $(RSRR_OBJS) $(EXTRA_OBJS)
38: ROUTER_SRCS = $(ROUTER_OBJS:.o=.c)
39: MAPPER_OBJS = mapper.o $(EXTRA_OBJS)
40: MRINFO_OBJS = mrinfo.o $(EXTRA_OBJS)
41: MTRACE_OBJS = mtrace.o $(EXTRA_OBJS)
42: #MSTAT_OBJS = mstat.o $(EXTRA_OBJS)
43:
44: ## Common
1.1.1.2 ! misho 45: CFLAGS += $(MCAST_INCLUDE) $(SNMPDEF) $(RSRRDEF) $(INCLUDES) $(DEFS) $(USERCOMPILE)
1.1 misho 46: CFLAGS += -O2 -W -Wall -Werror
47: #CFLAGS += -O -g
48: LDLIBS = $(SNMPLIBDIR) $(SNMPLIBS) $(EXTRA_LIBS)
49: LDFLAGS += -Wl,-Map,$@.map
50: OBJS = $(IGMP_OBJS) $(ROUTER_OBJS) $(MAPPER_OBJS) $(MRINFO_OBJS) \
51: $(MTRACE_OBJS) $(MSTAT_OBJS)
52: SRCS = $(OBJS:.o=.c)
53: MANS = $(addsuffix .8,$(EXECS))
54: DISTFILES = README AUTHORS LICENSE ChangeLog
55:
56: LINT = splint
57: LINTFLAGS = $(MCAST_INCLUDE) $(filter-out -W -Wall -Werror, $(CFLAGS)) -posix-lib -weak -skipposixheaders
58:
59: all: $(EXECS) $(MSTAT)
60:
61: .y.c:
62: @printf " YACC $@\n"
63: @$(YACC) $<
64: -@mv y.tab.c $@ || mv $(<:.y=.tab.c) $@
65:
66: .c.o:
67: @printf " CC $@\n"
68: @$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
69:
70: install: $(EXECS)
71: @install -d $(DESTDIR)$(prefix)/sbin
72: @install -d $(DESTDIR)$(sysconfdir)
73: @install -d $(DESTDIR)$(datadir)
74: @install -d $(DESTDIR)$(mandir)
75: @for file in $(EXECS); do \
76: install -m 0755 $$file $(DESTDIR)$(prefix)/sbin/$$file; \
77: done
78: @install -b -m 0644 $(CONFIG) $(DESTDIR)$(sysconfdir)/$(CONFIG)
79: @for file in $(DISTFILES); do \
80: install -m 0644 $$file $(DESTDIR)$(datadir)/$$file; \
81: done
82: @for file in $(MANS); do \
83: install -m 0644 $$file $(DESTDIR)$(mandir)/$$file; \
84: done
85:
86: uninstall:
87: -@for file in $(EXECS); do \
88: $(RM) $(DESTDIR)$(prefix)/sbin/$$file; \
89: done
90: -@$(RM) $(DESTDIR)$(sysconfdir)/$(CONFIG)
91: -@$(RM) -r $(DESTDIR)$(datadir)
92: -@for file in $(MANS); do \
93: $(RM) $(DESTDIR)$(mandir)/$$file; \
94: done
95:
96: mrouted: $(IGMP_OBJS) $(ROUTER_OBJS) $(CMULIBS)
97: @printf " LINK $@\n"
98: @$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(IGMP_OBJS) $(ROUTER_OBJS) $(LDLIBS)
99:
100: vers.c: Makefile
101: @echo $(VERSION) | sed -e 's/.*/char todaysversion[]="&";/' > vers.c
102:
103: map-mbone: $(IGMP_OBJS) $(MAPPER_OBJS)
104: @printf " LINK $@\n"
105: @$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(IGMP_OBJS) $(MAPPER_OBJS) $(LDLIBS)
106:
107: mrinfo: $(IGMP_OBJS) $(MRINFO_OBJS)
108: @printf " LINK $@\n"
109: @$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(IGMP_OBJS) $(MRINFO_OBJS) $(LDLIBS)
110:
111: mtrace: $(IGMP_OBJS) $(MTRACE_OBJS)
112: @printf " LINK $@\n"
113: @$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(IGMP_OBJS) $(MTRACE_OBJS) $(LDLIBS)
114:
115: mstat: $(MSTAT_OBJS) $(CMULIBS)
116: @printf " LINK $@\n"
117: @$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(MSTAT_OBJS) $(LDLIBS)
118:
119: clean: $(SNMPCLEAN)
120: -@$(RM) $(OBJS) $(EXECS)
121:
122: distclean:
123: -@$(RM) $(OBJS) core $(EXECS) vers.c cfparse.c *.o *.map .*.d *.out tags TAGS
124:
125: dist:
126: @echo "Building bzip2 tarball of $(PKG) in parent dir..."
127: git archive --format=tar --prefix=$(PKG)/ $(VERSION) | bzip2 >../$(ARCHIVE)
128: @(cd ..; md5sum $(ARCHIVE) | tee $(ARCHIVE).md5)
129:
130: build-deb:
131: git-buildpackage --git-ignore-new --git-upstream-branch=master
132:
133: lint:
134: @$(LINT) $(LINTFLAGS) $(SRCS)
135:
136: tags: $(IGMP_SRCS) $(ROUTER_SRCS)
137: @ctags $(IGMP_SRCS) $(ROUTER_SRCS)
138:
139: cflow:
140: @cflow $(MCAST_INCLUDE) $(IGMP_SRCS) $(ROUTER_SRCS) > cflow.out
141:
142: cflow2:
143: @cflow -ix $(MCAST_INCLUDE) $(IGMP_SRCS) $(ROUTER_SRCS) > cflow2.out
144:
145: rcflow:
146: @cflow -r $(MCAST_INCLUDE) $(IGMP_SRCS) $(ROUTER_SRCS) > rcflow.out
147:
148: rcflow2:
149: @cflow -r -ix $(MCAST_INCLUDE) $(IGMP_SRCS) $(ROUTER_SRCS) > rcflow2.out
150:
151: TAGS:
152: @etags $(SRCS)
153:
154: snmpclean:
155: -(cd snmpd; make clean)
156: -(cd snmplib; make clean)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>