- Add lwkt_serialize_adaptive_enter(9), it is same as lwkt_serialize_enter(9)
[dfdiff.git] / contrib / ipfilter / Makefile
bloba20c1d6be4506f9118965bfe5e90afe7b76193f8
2 # Copyright (C) 1993-2001 by Darren Reed.
4 # See the IPFILTER.LICENCE file for details on licencing.
6 # $Id: Makefile,v 2.11.2.15 2002/12/02 04:22:56 darrenr Exp $
8 .PATH: ${.CURDIR}../../contrib/ipfilter ${.CURDIR}/../../sys/contrib/ipfilter
10 BINDEST=/usr/local/bin
11 SBINDEST=/sbin
12 MANDIR=/usr/local/man
13 #To test prototyping
14 CC=gcc -Wstrict-prototypes -Wmissing-prototypes
15 #CC=gcc
16 #CC=cc -Dconst=
17 DEBUG=-g
18 TOP=../..
19 CFLAGS=-I$$(TOP)
20 CPU=`uname -m`
21 CPUDIR=`uname -s|sed -e 's@/@@g'`-`uname -r`-`uname -m`
22 IPFILKERN=`/bin/ls -1tr /usr/src/sys/compile | grep -v .bak | tail -1`
24 # To enable this to work as a Loadable Kernel Module...
26 IPFLKM=-DIPFILTER_LKM
28 # To enable logging of blocked/passed packets...
30 IPFLOG=-DIPFILTER_LOG
32 # The facility you wish to log messages from ipmon to syslogd with.
34 LOGFAC=-DLOGFAC=LOG_LOCAL0
37 # Uncomment the next 3 lines if you want to view the state table a la top(1)
38 # (requires that you have installed ncurses).
39 STATETOP_CFLAGS=-DSTATETOP
41 # Where to find the ncurses include files (if not in default path),
43 #STATETOP_INC=
44 #STATETOP_INC=-I/usr/local/include
46 # How to link the ncurses library
48 STATETOP_LIB=-lcurses
49 #STATETOP_LIB=-L/usr/local/lib -lncurses
52 # Uncomment this when building IPv6 capability.
54 #INET6=-DUSE_INET6
56 # For packets which don't match any pass rules or any block rules, set either
57 # FR_PASS or FR_BLOCK (respectively). It defaults to FR_PASS if left
58 # undefined. This is ignored for ipftest, which can thus return three
59 # results: pass, block and nomatch. This is the sort of "block unless
60 # explicitly allowed" type #define switch.
62 POLICY=-DIPF_DEFAULT_PASS=FR_PASS
64 MFLAGS1='CFLAGS=$(CFLAGS) $(ARCHINC) $(SOLARIS2) $(INET6) $(IPFLOG)' \
65 "IPFLOG=$(IPFLOG)" "LOGFAC=$(LOGFAC)" "POLICY=$(POLICY)" \
66 "SOLARIS2=$(SOLARIS2)" "DEBUG=$(DEBUG)" "DCPU=$(CPU)" \
67 "CPUDIR=$(CPUDIR)" 'STATETOP_CFLAGS=$(STATETOP_CFLAGS)' \
68 'STATETOP_INC=$(STATETOP_INC)' 'STATETOP_LIB=$(STATETOP_LIB)' \
69 "BITS=$(BITS)" "OBJ=$(OBJ)"
70 DEST="BINDEST=$(BINDEST)" "SBINDEST=$(SBINDEST)" "MANDIR=$(MANDIR)"
71 MFLAGS=$(MFLAGS1) "IPFLKM=$(IPFLKM)"
73 SHELL=/bin/sh
75 ########## ########## ########## ########## ########## ########## ##########
77 CP=/bin/cp
78 RM=/bin/rm
79 CHMOD=/bin/chmod
80 INSTALL=install
83 all:
84 @echo "Chose one of the following targets for making IP filter:"
85 @echo ""
86 @echo "solaris - auto-selects SunOS4.1.x/Solaris 2.3-6/Solaris2.4-6x86"
87 @echo "netbsd - compile for NetBSD"
88 @echo "openbsd - compile for OpenBSD"
89 @echo "freebsd20 - compile for FreeBSD 2.0, 2.1 or earlier"
90 @echo "freebsd22 - compile for FreeBSD-2.2 or greater"
91 @echo "freebsd3 - compile for FreeBSD-3.x"
92 @echo "freebsd4 - compile for FreeBSD-4.x"
93 @echo "bsd - compile for generic 4.4BSD systems"
94 @echo "bsdi - compile for BSD/OS"
95 @echo "irix - compile for SGI IRIX"
96 @echo ""
98 tests:
99 @if [ -d test ]; then (cd test; make) \
100 else echo test directory not present, sorry; fi
102 include:
103 if [ ! -f netinet/done ] ; then \
104 (cd netinet; ln -s ../*.h .; ln -s ../ip_*_pxy.c .; ); \
105 (cd netinet; ln -s ../ipsend/tcpip.h tcpip.h); \
106 touch netinet/done; \
109 sunos solaris: include
110 CC="$(CC)" ./buildsunos
112 freebsd22: include
113 make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
114 -rm -f BSD/$(CPUDIR)/ioconf.h
115 @if [ -n $(IPFILKERN) ] ; then \
116 if [ -f /sys/compile/$(IPFILKERN)/ioconf.h ] ; then \
117 ln -s /sys/compile/$(IPFILKERN)/ioconf.h BSD/$(CPUDIR); \
118 else \
119 ln -s /sys/$(IPFILKERN)/ioconf.h BSD/$(CPUDIR); \
120 fi \
121 elif [ ! -f `uname -v|sed -e 's@^.*:\(/[^: ]*\).*@\1@'`/ioconf.h ] ; then \
122 echo -n "Can't find ioconf.h in "; \
123 echo `uname -v|sed -e 's@^.*:\(/[^: ]*\).*@\1@'`; \
124 exit 1;\
125 else \
126 ln -s `uname -v|sed -e 's@^.*:\(/[^: ]*\).*@\1@'`/ioconf.h BSD/$(CPU) ; \
128 make freebsd20
130 freebsd4: include
131 if [ x$INET6 = x ] ; then \
132 echo "#undef INET6" > opt_inet6.h; \
133 else \
134 echo "#define INET6" > opt_inet6.h; \
136 make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
137 (cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS) "ML=mlfk_ipl.c" "MLD=mlfk_ipl.c" "LKM=ipf.ko" "DLKM=-DKLD_MODULE -I/sys"; cd ..)
138 (cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS1); cd ..)
140 freebsd3 freebsd30: include
141 make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
142 (cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS1) "ML=mlf_ipl.c" LKM= ; cd ..)
143 (cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS1); cd ..)
145 netbsd: include
146 make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
147 (cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS) 'DLKM=-D_LKM' "ML=mln_ipl.c"; cd ..)
148 (cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS); cd ..)
150 openbsd openbsd21: include
151 make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
152 (cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS) 'DLKM=-D_LKM' "ML=mln_ipl.c"; cd ..)
153 (cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS); cd ..)
155 freebsd20 freebsd21: include
156 make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
157 (cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS) "ML=mlf_ipl.c"; cd ..)
158 (cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS); cd ..)
160 bsd: include
161 make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
162 (cd BSD/$(CPUDIR); make build TOP=../.. $(MFLAGS); cd ..)
163 (cd BSD/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(MFLAGS); cd ..)
165 bsdi bsdos: include
166 make setup "TARGOS=BSD" "CPUDIR=$(CPUDIR)"
167 (cd BSD/$(CPUDIR); make build "CC=$(CC)" TOP=../.. $(MFLAGS) LKM= ; cd ..)
168 (cd BSD/$(CPUDIR); make -f Makefile.ipsend "CC=$(CC)" TOP=../.. $(MFLAGS); cd ..)
170 irix IRIX: include
171 make setup "TARGOS=IRIX" "CPUDIR=$(CPUDIR)"
172 -(cd IRIX/$(CPUDIR); if [ $(MAKE) = make ] ; then make -f Makefile.std build TOP=../.. $(DEST) SGI=`../getrev` $(MFLAGS); else smake build SGI=`../getrev` TOP=../.. $(DEST) $(MFLAGS); fi;)
173 -(cd IRIX/$(CPUDIR); if [ $(MAKE) = make ] ; then make -f Makefile.ipsend.std SGI=`../getrev` TOP=../.. $(DEST) $(MFLAGS); else smake -f Makefile.ipsend SGI=`../getrev` TOP=../.. $(DEST) $(MFLAGS); fi)
175 linux: include
176 make setup "TARGOS=Linux" "CPUDIR=$(CPUDIR)"
177 ./buildlinux
179 linuxrev:
180 (cd Linux/$(CPUDIR); make build TOP=../.. $(DEST) $(MFLAGS) LKM= ; cd ..)
181 (cd Linux/$(CPUDIR); make -f Makefile.ipsend TOP=../.. $(DEST) $(MFLAGS); cd ..)
183 setup:
184 -if [ ! -d $(TARGOS)/$(CPUDIR) ] ; then mkdir $(TARGOS)/$(CPUDIR); fi
185 -rm -f $(TARGOS)/$(CPUDIR)/Makefile $(TARGOS)/$(CPUDIR)/Makefile.ipsend
186 -ln -s ../Makefile $(TARGOS)/$(CPUDIR)/Makefile
187 -if [ ! -f $(TARGOS)/$(CPUDIR)/Makefile.std -a \
188 -f $(TARGOS)/Makefile.std ] ; then \
189 ln -s ../Makefile.std $(TARGOS)/$(CPUDIR)/Makefile.std; \
191 -if [ ! -f $(TARGOS)/$(CPUDIR)/Makefile.ipsend.std -a \
192 -f $(TARGOS)/Makefile.ipsend.std ] ; then \
193 ln -s ../Makefile.ipsend.std $(TARGOS)/$(CPUDIR)/Makefile.ipsend.std; \
195 -ln -s ../Makefile.ipsend $(TARGOS)/$(CPUDIR)/Makefile.ipsend
197 clean: clean-include
198 ${RM} -f core *.o ipt fils ipf ipfstat ipftest ipmon if_ipl \
199 vnode_if.h $(LKM) *~
200 ${RM} -rf sparcv7 sparcv9
201 (cd SunOS4; make clean)
202 (cd SunOS5; make clean)
203 (cd BSD; make clean)
204 (cd Linux; make clean)
205 if [ "`uname -s`" = "IRIX" ]; then (cd IRIX; make clean); fi
206 [ -d test ] && (cd test; make clean)
207 (cd ipsend; make clean)
209 clean-include:
210 sh -c 'cd netinet; for i in *; do if [ -h $$i ] ; then /bin/rm -f $$i; fi; done'
211 ${RM} -f netinet/done
213 clean-bsd: clean-include
214 (cd BSD; make clean)
216 clean-sunos4: clean-include
217 (cd SunOS4; make clean)
219 clean-sunos5: clean-include
220 (cd SunOS5; make clean)
222 clean-irix: clean-include
223 (cd IRIX; make clean)
225 clean-linux: clean-include
226 (cd Linux; make clean)
228 get:
229 -@for i in ipf.c ipt.h solaris.c ipf.h kmem.c ipft_ef.c linux.h \
230 ipft_pc.c fil.c ipft_sn.c mln_ipl.c fils.c ipft_td.c \
231 mls_ipl.c ip_compat.h ipl.h opt.c ip_fil.c ipl_ldev.c \
232 parse.c ip_fil.h ipmon.c pcap.h ip_sfil.c ipt.c snoop.h \
233 ip_state.c ip_state.h ip_nat.c ip_nat.h ip_frag.c \
234 ip_frag.h ip_sfil.c misc.c; do \
235 if [ ! -f $$i ] ; then \
236 echo "getting $$i"; \
237 sccs get $$i; \
238 fi \
239 done
241 sunos4 solaris1: null
242 (cd SunOS4; make build TOP=.. "CC=$(CC)" $(DEST) $(MFLAGS); cd ..)
243 (cd SunOS4; make -f Makefile.ipsend "CC=$(CC)" TOP=.. $(DEST) $(MFLAGS); cd ..)
245 sunos5 solaris2: null
246 (cd SunOS5/$(CPUDIR); make build TOP=../.. "CC=$(CC)" $(DEST) $(MFLAGS) "SOLARIS2=$(SOLARIS2)" "CPU=-Dsparc -D__sparc__"; cd ..)
247 (cd SunOS5/$(CPUDIR); make -f Makefile.ipsend TOP=../.. "CC=$(CC)" $(DEST) $(MFLAGS); cd ..)
249 sunos5x86 solaris2x86: null
250 (cd SunOS5/$(CPUDIR); make build TOP=../.. "CC=$(CC)" $(DEST) $(MFLAGS) "SOLARIS2=$(SOLARIS2)" "CPU=-Di86pc -Di386 -D__i386__"; cd ..)
251 (cd SunOS5/$(CPUDIR); make -f Makefile.ipsend TOP=../.. "CC=$(CC)" $(DEST) $(MFLAGS); cd ..)
253 install-linux:
254 (cd Linux/$(CPUDIR); make install "TOP=../.." $(DEST) $(MFLAGS); cd ..)
255 (cd Linux/$(CPUDIR); make -f Makefile.ipsend INSTALL=$(INSTALL) install "TOP=../.." $(DEST) $(MFLAGS); cd ..)
257 install-bsd:
258 (cd BSD/$(CPUDIR); make install "TOP=../.." $(MFLAGS); cd ..)
259 (cd BSD/$(CPUDIR); make -f Makefile.ipsend INSTALL=$(INSTALL) install "TOP=../.." $(MFLAGS); cd ..)
261 install-sunos4: solaris
262 (cd SunOS4; $(MAKE) "CPU=$(CPU)" "TOP=.." install)
264 install-sunos5: solaris
265 (cd SunOS5; $(MAKE) "CPUDIR=`uname -p`-`uname -r`" "CPU=$(CPU) TOP=.." install)
267 install-irix: irix
268 (cd IRIX; smake install "CPU=$(CPU) TOP=.." $(DEST) $(MFLAGS))
270 rcsget:
271 -@for i in ipf.c ipt.h solaris.c ipf.h kmem.c ipft_ef.c linux.h \
272 ipft_pc.c fil.c ipft_sn.c mln_ipl.c fils.c ipft_td.c \
273 mls_ipl.c ip_compat.h ipl.h opt.c ip_fil.c ipl_ldev.c \
274 parse.c ip_fil.h ipmon.c pcap.h ip_sfil.c ipt.c snoop.h \
275 ip_state.c ip_state.h ip_nat.c ip_nat.h ip_frag.c \
276 ip_frag.h ip_sfil.c misc.c; do \
277 if [ ! -f $$i ] ; then \
278 echo "getting $$i"; \
279 co $$i; \
280 fi \
281 done
283 do-cvs:
284 find . -type d -name CVS -print | xargs /bin/rm -rf
285 find . -type f -name .cvsignore -print | xargs /bin/rm -f
287 null:
288 -@if [ "`$(MAKE) -v 2>&1 | sed -ne 's/GNU.*/GNU/p'`" = "GNU" ] ; then \
289 echo 'Do not use GNU make (gmake) to compile IPFilter'; \
290 exit 1; \
292 -@echo make ok
294 test-solaris test-sunos4 test-sunos5: solaris
295 (cd test && make clean && make)
297 test-freebsd: freebsd
298 (cd test && make clean && make)
300 test-freebsd22: freebsd22
301 (cd test && make clean && make)
303 test-freebsd3: freebsd3
304 (cd test && make clean && make)
306 test-freebsd4: freebsd4
307 (cd test && make clean && make)
309 test-netbsd: netbsd
310 (cd test && make clean && make)
312 test-openbsd: openbsd
313 (cd test && make clean && make)
315 test-irix: irix
316 (cd test && make clean && make)