Makefile revision 255332
1# 2# Copyright (C) 2012 by Darren Reed. 3# 4# See the IPFILTER.LICENCE file for details on licencing. 5# 6IPFT=ipft_ef.o ipft_hx.o ipft_pc.o ipft_sn.o ipft_td.o ipft_tx.o opt.o 7OBJS=ipsend.o ip.o ipsopt.o y.tab.o lex.yy.o 8ROBJS=ipresend.o ip.o resend.o $(IPFT) 9TOBJS=iptest.o iptests.o ip.o 10BPF=sbpf.o 11NIT=snit.o 12SUNOS4=sock.o arp.o inet_addr.o 13BSD=sock.o 44arp.o 14LINUX=lsock.o slinux.o larp.o 15LINUXK= 16TOP=.. 17SUNOS5=dlcommon.o sdlpi.o arp.o inet_addr.o 18ULTRIX=ultrix.o sock.o arp.o inet_addr.o 19HPUX=hpux.o sock.o arp.o inet_addr.o 20 21#CC=gcc 22DEBUG=-g 23CFLAGS=$(DEBUG) -I. -Iipf 24# 25MFLAGS="BINDEST=$(BINDEST)" "SBINDEST=$(SBINDEST)" "MANDIR=$(MANDIR)" \ 26 "IPFLKM=$(IPFLKM)" \ 27 "IPFLOG=$(IPFLOG)" "LOGFAC=$(LOGFAC)" "POLICY=$(POLICY)" \ 28 "SOLARIS2=$(SOLARIS2)" "DEBUG=$(DEBUG)" "DCPU=$(CPU)" \ 29 "CPUDIR=$(CPUDIR)" 30# 31all: 32 @echo "Use one of these targets:" 33 @echo " sunos4-nit (standard SunOS 4.1.x)" 34 @echo " sunos4-bpf (SunOS4.1.x with BPF in the kernel)" 35 @echo " bsd-bpf (4.4BSD variant with BPF in the kernel)" 36 @echo " linux10 (Linux 1.0 kernels)" 37 @echo " linux12 (Linux 1.2 kernels)" 38 @echo " linux20 (Linux 2.0 kernels)" 39 @echo " sunos5 (Solaris 2.x)" 40 41ipf: 42 -if [ ! -d iplang ] ; then ln -s ../iplang iplang; fi 43 -if [ ! -d netinet ] ; then ln -s ../netinet netinet; fi 44 -if [ ! -d ipf ] ; then ln -s .. ipf; fi 45 46y.tab.o: iplang/iplang_y.y 47 -if [ -h iplang ] ; then \ 48 (cd iplang; ${MAKE} $(MFLAGS) 'DESTDIR=../ipsend' ) \ 49 else \ 50 (cd iplang; ${MAKE} $(MFLAGS) 'DESTDIR=..' ) \ 51 fi 52 53lex.yy.o: iplang/iplang_l.l 54 -if [ -h iplang ] ; then \ 55 (cd iplang; ${MAKE} $(MFLAGS) 'DESTDIR=../ipsend' ) \ 56 else \ 57 (cd iplang; ${MAKE} $(MFLAGS) 'DESTDIR=..' ) \ 58 fi 59 60.c.o: 61 $(CC) $(CFLAGS) $(LINUXK) -c $< -o $@ 62 63install: 64 -$(INSTALL) -cs -g wheel -m 755 -o root ipsend ipresend iptest $(BINDEST) 65 66bpf sunos4-bpf : 67 make ipsend "OBJS=$(OBJS)" "UNIXOBJS=$(BPF) $(SUNOS4)" "CC=$(CC)" \ 68 "CFLAGS=$(CFLAGS) -DDOSOCKET -DIPSEND" "LLIB=-ll" 69 make ipresend "ROBJS=$(ROBJS)" "UNIXOBJS=$(BPF) $(SUNOS4)" "CC=$(CC)" \ 70 "CFLAGS=$(CFLAGS) -DDOSOCKET" 71 make iptest "TOBJS=$(TOBJS)" "UNIXOBJS=$(BPF) $(SUNOS4)" "CC=$(CC)" \ 72 "CFLAGS=$(CFLAGS) -DDOSOCKET" 73 74nit sunos4 sunos4-nit : 75 make ipsend "OBJS=$(OBJS)" "UNIXOBJS=$(NIT) $(SUNOS4)" "CC=$(CC)" \ 76 "CFLAGS=$(CFLAGS) -DDOSOCKET -DIPSEND" "LLIB=-ll" 77 make ipresend "ROBJS=$(ROBJS)" "UNIXOBJS=$(NIT) $(SUNOS4)" "CC=$(CC)" \ 78 "CFLAGS=$(CFLAGS) -DDOSOCKET" 79 make iptest "TOBJS=$(TOBJS)" "UNIXOBJS=$(NIT) $(SUNOS4)" "CC=$(CC)" \ 80 "CFLAGS=$(CFLAGS) -DDOSOCKET" 81 82dlpi sunos5 : 83 make ipsend "OBJS=$(OBJS)" "UNIXOBJS=$(SUNOS5)" "CC=$(CC)" \ 84 CFLAGS="$(CFLAGS) -Dsolaris -DIPSEND" "LIBS=-lsocket -lnsl" \ 85 "LLIB=-ll" 86 make ipresend "ROBJS=$(ROBJS)" "UNIXOBJS=$(SUNOS5)" "CC=$(CC)" \ 87 CFLAGS="$(CFLAGS) -Dsolaris" "LIBS=-lsocket -lnsl" 88 make iptest "TOBJS=$(TOBJS)" "UNIXOBJS=$(SUNOS5)" "CC=$(CC)" \ 89 CFLAGS="$(CFLAGS) -Dsolaris" "LIBS=-lsocket -lnsl" 90 91bsd-bpf : 92 make ipsend "OBJS=$(OBJS)" "UNIXOBJS=$(BPF) $(BSD)" "CC=$(CC)" \ 93 "CFLAGS=$(CFLAGS) -DDOSOCKET -DIPSEND" "LLIB=-ll" 94 make ipresend "ROBJS=$(ROBJS)" "UNIXOBJS=$(BPF) $(BSD)" "CC=$(CC)" \ 95 "CFLAGS=$(CFLAGS) -DDOSOCKET" 96 make iptest "TOBJS=$(TOBJS)" "UNIXOBJS=$(BPF) $(BSD)" "CC=$(CC)" \ 97 "CFLAGS=$(CFLAGS) -DDOSOCKET" 98 99linuxrev : 100 make ipsend "OBJS=$(OBJS)" "UNIXOBJS=$(LINUX)" "CC=$(CC)" \ 101 CFLAGS="$(CFLAGS) $(INC) -DDOSOCKET -DIPSEND" $(LINUXK) 102 make ipresend "ROBJS=$(ROBJS)" "UNIXOBJS=$(LINUX)" "CC=$(CC)" \ 103 CFLAGS="$(CFLAGS) $(INC) -DDOSOCKET" $(LINUXK) 104 make iptest "TOBJS=$(TOBJS)" "UNIXOBJS=$(LINUX)" "CC=$(CC)" \ 105 CFLAGS="$(CFLAGS) $(INC) -DDOSOCKET" $(LINUXK) 106 107linux10: 108 make linuxrev 'LINUXK="LINUXK=-DLINUX=0100"' \ 109 "INC=-I/usr/src/linux/include" "LLIB=-lfl" 110 111linux12: 112 make linuxrev 'LINUXK="LINUXK=-DLINUX=0102"' "INC=-I/usr/src/linux" \ 113 "LLIB=-lfl" 114 115linux20: 116 make linuxrev 'LINUXK="LINUXK=-DLINUX=0200"' \ 117 "INC=-I/usr/src/linux/include" "LLIB=-lfl" "ELIB=-lelf" 118 119ultrix : 120 make ipsend "OBJS=$(OBJS)" "UNIXOBJS=$(ULTRIX)" "CC=$(CC)" \ 121 CFLAGS="$(CFLAGS) -DIPSEND" "LIBS=" "LLIB=-ll" 122 make ipresend "ROBJS=$(ROBJS)" "UNIXOBJS=$(ULTRIX)" "CC=$(CC)" \ 123 CFLAGS="$(CFLAGS)" "LIBS=" 124 make iptest "TOBJS=$(TOBJS)" "UNIXOBJS=$(ULTRIX)" "CC=$(CC)" \ 125 CFLAGS="$(CFLAGS)" "LIBS=" 126 127hpux9 : 128 make ipsend "OBJS=$(OBJS)" "UNIXOBJS=$(HPUX)" "CC=$(CC)" \ 129 CFLAGS="$(CFLAGS) -DIPSEND" "LIBS=" 130 make ipresend "ROBJS=$(ROBJS)" "UNIXOBJS=$(HPUX)" "CC=$(CC)" \ 131 CFLAGS="$(CFLAGS)" "LIBS=" 132 make iptest "TOBJS=$(TOBJS)" "UNIXOBJS=$(HPUX)" "CC=$(CC)" \ 133 CFLAGS="$(CFLAGS)" "LIBS=" 134 135hpux11 : 136 make ipsend "OBJS=$(OBJS)" "UNIXOBJS=$(HPUX)" "CC=$(CC)" \ 137 CFLAGS="$(CFLAGS) -DIPSEND" "LIBS=" 138 make ipresend "ROBJS=$(ROBJS)" "UNIXOBJS=$(HPUX)" "CC=$(CC)" \ 139 CFLAGS="$(CFLAGS)" "LIBS=" 140 make iptest "TOBJS=$(TOBJS)" "UNIXOBJS=$(HPUX)" "CC=$(CC)" \ 141 CFLAGS="$(CFLAGS)" "LIBS=" 142 143ipsend: ipf $(OBJS) $(UNIXOBJS) 144 $(CC) $(OBJS) $(UNIXOBJS) -o $@ $(LIBS) $(LLIB) $(ELIB) 145 146ipresend: $(ROBJS) $(UNIXOBJS) 147 $(CC) $(ROBJS) $(UNIXOBJS) -o $@ $(LIBS) $(ELIB) 148 149iptest: $(TOBJS) $(UNIXOBJS) 150 $(CC) $(TOBJS) $(UNIXOBJS) -o $@ $(LIBS) $(ELIB) 151 152ipft_ef.o: ipf/ipft_ef.c ipf/ipt.h ipf/ipf.h ipf/ip_compat.h 153 $(CC) $(CFLAGS) $(LINUXK) -c ipf/ipft_ef.c -o $@ 154 155ipft_hx.o: ipf/ipft_hx.c ipf/ipt.h ipf/ipf.h ipf/ip_compat.h 156 $(CC) $(CFLAGS) $(LINUXK) -c ipf/ipft_hx.c -o $@ 157 158ipft_pc.o: ipf/ipft_pc.c ipf/ipt.h ipf/ipf.h ipf/ip_compat.h 159 $(CC) $(CFLAGS) $(LINUXK) -c ipf/ipft_pc.c -o $@ 160 161ipft_sn.o: ipf/ipft_sn.c ipf/ipt.h ipf/ipf.h ipf/ip_compat.h 162 $(CC) $(CFLAGS) $(LINUXK) -c ipf/ipft_sn.c -o $@ 163 164ipft_td.o: ipf/ipft_td.c ipf/ipt.h ipf/ipf.h ipf/ip_compat.h 165 $(CC) $(CFLAGS) $(LINUXK) -c ipf/ipft_td.c -o $@ 166 167ipft_tx.o: ipf/ipft_tx.c ipf/ipt.h ipf/ipf.h ipf/ip_compat.h 168 $(CC) $(CFLAGS) $(LINUXK) -c ipf/ipft_tx.c -o $@ 169 170opt.o: ipf/opt.c ipf/ipt.h ipf/ipf.h ipf/ip_compat.h 171 $(CC) $(CFLAGS) $(LINUXK) -c ipf/opt.c -o $@ 172 173inet_addr.o: ipf/inet_addr.c 174 $(CC) $(CFLAGS) $(LINUXK) -c ipf/inet_addr.c -o $@ 175 176clean: 177 rm -rf *.o *core a.out ipsend ipresend iptest 178 if [ -d iplang ]; then (cd iplang; $(MAKE) $(MFLAGS) clean); fi 179 if [ -d $(TOP)/iplang ]; then (cd $(TOP)/iplang; $(MAKE) $(MFLAGS) clean); fi 180 181do-cvs: 182 find . -type d -name CVS -print | xargs /bin/rm -rf 183 find . -type f -name .cvsignore -print | xargs /bin/rm -f 184