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