1
2prefix= @prefix@
3exec_prefix= @exec_prefix@
4bindir= @bindir@
5sysconfdir= @sysconfdir@
6datadir= @datadir@
7
8CC= @CC@
9LDFLAGS+= @LDFLAGS@
10LIBS+= @LIBS@
11CFLAGS+= @CFLAGS@ @DEFS@ -W -Wall
12CPPFLAGS+=-DIPCAD_VERSION=\"@IPCAD_VERSION@\"
13CPPFLAGS+=-DCONFIG_FILE=\"${sysconfdir}/ipcad.conf\"
14CPPFLAGS+=@DEFS@ -D_REENTRANT -D_THREAD_SAFE
15CPPFLAGS+=-DPSRC_@PSRC@ -DIFST_@IFST@
16
17YACC=@YACC@
18LEX=@LEX@
19INSTALL=@INSTALL@
20
21MANROOT=@mandir@/man
22MAN8=${MANROOT}8
23MAN5=${MANROOT}5
24
25NROFF= groff -Tascii -mandoc
26
27PACKAGE=ipcad
28TARGETS=ipcad
29VERSION=@IPCAD_VERSION@
30
31IPCAD_OBJS= main.o process.o pps.o disp.o storage.o usage.o cfgy.o cfglex.o cfgread.o cfgvar.o rsh.o rshp.o dump.o import.o nflow.o cshelly.o cslex.o csparse.o service.o rw.o servers.o opt.o pidfile.o sf_lite.o
32IPCAD_OBJS+= ifst_@IFST@.o		# Interface statistics
33IPCAD_OBJS+= ifs_list.o			# Interface statistics
34IPCAD_OBJS+= loop-@PSRC@.o		# Method of capturing
35IPCAD_OBJS+= loop-file.o		# Method of capturing
36IPCAD_OBJS+= loop-divert.o		# Method of capturing
37IPCAD_OBJS+= loop-dynamic.o		# Method of capturing
38IPCAD_OBJS+= loop-ulog.o loop-ipq.o	# Methods of capturing
39IPCAD_OBJS+= psrc.o psrc-@PSRC@.o	# Initialize capturers
40IPCAD_OBJS+= psrc-ipq.o psrc-ulog.o	# Initialize capturers
41IPCAD_OBJS+= psrc-file.o		# Initialize capturers
42IPCAD_OBJS+= psrc-dynamic.o		# Initialize capturers
43IPCAD_OBJS+= psrc-divert.o		# Initialize capturers
44IPCAD_OBJS+= wrap_oclose.o		# Special file descriptors cache
45IPCAD_OBJS+= genhash.o			# General hashing
46
47all: ${TARGETS} man
48
49ipcad: ${IPCAD_OBJS}
50	${CC} ${CFLAGS} -o $@ ${IPCAD_OBJS} ${LDFLAGS} ${LIBS}
51
52.SUFFIXES:
53.SUFFIXES: .o .c .0 .8 .5
54
55.c.o:
56	${CC} ${CPPFLAGS} ${CFLAGS} -o $@ -c $<
57
58.8.0:
59	${NROFF} $< > $@
60
61.5.0:
62	${NROFF} $< > $@
63
64cfgy.h cfgy.c: cfg.y
65	${YACC} -p ipcacfg -d cfg.y
66	@mv y.tab.c cfgy.c
67	@mv y.tab.h cfgy.h
68
69cshelly.h cshelly.c: cshell.y
70	${YACC} -p CS -d cshell.y
71	@mv y.tab.c cshelly.c
72	@mv y.tab.h cshelly.h
73
74cslex.c: cslex.l
75	${LEX} -s -p -Cem -ocslex.c -PCS cslex.l
76
77cfglex.c: cfglex.l
78	${LEX} -s -p -Cem -ocfglex.c -Pipcacfg cfglex.l
79
80
81man: ipcad.8 ipcad.conf.5
82
83distdir = $(PACKAGE)-$(VERSION)
84distdir:
85	rm -rf $(distdir)
86	mkdir $(distdir)
87	cp *.c *.h $(distdir)
88	cp ipcad.8 ipcad.conf.5 $(distdir)
89	cp *.y *.l $(distdir)
90	cp *.in configure install-sh $(distdir)
91	cp ipcad.conf.default $(distdir)
92	cp ipcad.conf.simple $(distdir)
93	cp ipcad.spec.in $(distdir)
94	cp Makefile.in Makefile $(distdir)
95	cp ChangeLog INSTALL README TODO BUGS AUTHORS COPYING FAQ $(distdir)
96	cd $(distdir) && make distclean
97
98dist: distdir
99	tar chof - $(distdir) | GZIP="--best" gzip -c > $(distdir).tar.gz
100	rm -rf $(distdir)
101
102clean:
103	rm -f *.o ${TARGETS} *.core 1
104	rm -f *.0
105
106distclean: clean
107	rm -f config.h
108	rm -f config.cache config.log config.status
109	rm -f Makefile
110	rm -f $(distdir).tar.gz
111	rm -f ipcad.spec
112	(echo "all: bootstrap"; echo; echo "bootstrap:"; \
113		echo "	./configure && make") > Makefile
114
115maintainer-clean: distclean
116	@echo "This command is intended for maintainers to use; it"
117	@echo "deletes files that may need special tools to rebuild."
118	rm -f Makefile
119	rm -f *.tab.* cfgy.? *lex.c
120	rm -f config.h.in configure
121
122install: all install-bin install-conf
123
124install-bin:
125	@${INSTALL} -d $(DESTDIR)${bindir}
126	${INSTALL} ipcad $(DESTDIR)${bindir}
127
128install-man: man
129	${INSTALL} -m 444 ipcad.8 $(DESTDIR)${MAN8}/ipcad.8
130	${INSTALL} -m 444 ipcad.conf.5 $(DESTDIR)${MAN5}/ipcad.conf.5
131
132install-conf:
133	@${INSTALL} -d $(DESTDIR)${sysconfdir}
134	${INSTALL} -m 644 ipcad.conf.simple $(DESTDIR)${sysconfdir}/ipcad.conf.simple
135	${INSTALL} -m 644 ipcad.conf.default $(DESTDIR)${sysconfdir}/ipcad.conf.sample;
136	@echo ""
137	@echo "Now you might want to 'make install-man'"
138	@echo ""
139
140
141uninstall:
142	rm -f ${bindir}/ipcad
143	rm -f ${sysconfdir}/ipcad.conf.default
144	rm -f ${sysconfdir}/ipcad.conf.simple
145	rm -f ${MAN8}/ipcad.8
146	rm -f ${MAN5}/ipcad.conf.5
147
148