| #!smake |
| # |
| # Copyright (C) 1993-1998 by Darren Reed. |
| # Copyright (C) 1997 by Marc Boucher. |
| # |
| # Redistribution and use in source and binary forms are permitted |
| # provided that this notice is preserved and due credit is given |
| # to the original authors and the contributors. |
| # |
| # For IRIX |
| # |
| # Automatically determine compiler switches and defines for kernel compilation |
| # based on our current CPU: |
| # |
| DCPU=`uname -m` |
| # workaround minor Makefile.kernio IP22 bug |
| #if defined(DCPU) && ( $(DCPU) == "IP22" ) |
| CMODELWRKAROUND="COMPILATION_MODEL=32" |
| #else |
| CMODELWRKAROUND= |
| #endif |
| KFLAGS != smake -d v -n \ |
| -f $(ROOT)/var/sysgen/Makefile.kernio \ |
| CPUBOARD=$(DCPU) $(CMODELWRKAROUND) 2>/dev/null \ |
| | sed -n -e '/^Global:CFLAGS =/h' -e '$$g' -e '$$s/Global:CFLAGS =//' \ |
| -e '$$s/ -G *8 / /' -e '$$p' |
| # |
| BINDEST=/usr/sbin |
| SBINDEST=/usr/etc |
| MANDIR=/usr/share/man/local |
| INCDEST=/usr/include/netinet |
| LKMDEST=/var/sysgen/boot |
| CPUDIR=`uname -s|sed -e 's@/@@g'`-`uname -r`-`uname -m` |
| TOP=.. |
| #CC=cc -Wall -Wuninitialized -Wstrict-prototypes -Werror -O |
| CFLAGS=-g -I$(TOP) |
| # |
| ML=mli_ipl.c |
| MLD=$(ML) |
| IPFILC=ip_fil.c |
| #if defined(IPFLKM) && !empty(IPFLKM) |
| MLFLAGS= -G 0 |
| LKM=ipflkm.o |
| #else |
| MLFLAGS= -G 8 |
| LKM=ipfilter.o |
| #endif |
| MFLAGS="BINDEST=$(BINDEST)" "SBINDEST=$(SBINDEST)" "MANDIR=$(MANDIR)" \ |
| 'CFLAGS=$(CFLAGS) $(SOLARIS2)' "IPFLKM=$(IPFLKM)" \ |
| "IPFLOG=$(IPFLOG)" "LOGFAC=$(LOGFAC)" "POLICY=$(POLICY)" \ |
| "SOLARIS2=$(SOLARIS2)" "DEBUG=$(DEBUG)" "DCPU=$(CPU)" \ |
| "CPUDIR=$(CPUDIR)" |
| # |
| ########## ########## ########## ########## ########## ########## ########## |
| # |
| CP=/bin/cp |
| RM=/bin/rm |
| CHMOD=/bin/chmod |
| INSTALL=/sbin/install |
| # |
| MODOBJS=ip_fil.o fil_k.o ml_ipl.o ip_nat.o ip_frag.o ip_state.o ip_proxy.o \ |
| ip_auth.o ip_log.o |
| DFLAGS=$(IPFLKM) $(IPFLOG) $(KFLAGS) $(MLFLAGS) -jalr #-D_MP_NETLOCKS -DMP |
| IPF=ipf.o parse.o common.o opt.o inet_addr.o facpri.o |
| IPT=ipt.o parse.o common.o fil.o ipft_sn.o ipft_ef.o ipft_td.o ipft_pc.o \ |
| opt.o ipft_tx.o misc.o ip_frag_u.o ip_state_u.o ip_nat_u.o ip_proxy_u.o \ |
| ip_auth_u.o ipft_hx.o ip_fil_u.o inet_addr.o natparse.o facpri.o |
| IPNAT=ipnat.o kmem.o natparse.o common.o inet_addr.o |
| FILS=fils.o parse.o common.o kmem.o opt.o inet_addr.o facpri.o |
| |
| build all: ipf ipfstat ipftest ipmon ipnat $(LKM) |
| |
| ipfstat: $(FILS) |
| $(CC) $(DEBUG) $(CFLAGS) $(STATETOP_CFLAGS) $(STATETOP_INC) $(FILS) \ |
| -o $@ $(LIBS) $(STATETOP_LIB) |
| |
| ipf: $(IPF) |
| $(CC) $(DEBUG) $(CFLAGS) $(IPF) -o $@ $(LIBS) |
| ${RM} -f $(TOP)/ipf |
| ln -s `pwd`/ipf $(TOP) |
| |
| ipftest: $(IPT) |
| $(CC) $(DEBUG) $(CFLAGS) $(IPT) -o $@ $(LIBS) |
| ${RM} -f $(TOP)/ipftest |
| ln -s `pwd`/ipftest $(TOP) |
| |
| ipnat: $(IPNAT) |
| $(CC) $(DEBUG) $(CFLAGS) $(IPNAT) -o $@ $(LIBS) |
| |
| tests: |
| (cd test; make ) |
| |
| fils.o: $(TOP)/fils.c $(TOP)/ip_fil.h $(TOP)/ipf.h $(TOP)/ip_frag.h \ |
| $(TOP)/ip_compat.h $(TOP)/ip_state.h $(TOP)/ip_nat.h |
| $(CC) $(DEBUG) $(CFLAGS) $(STATETOP_CFLAGS) $(STATETOP_INC) \ |
| -c $(TOP)/fils.c -o $@ |
| |
| fil.o: $(TOP)/fil.c $(TOP)/ip_fil.h $(TOP)/ipf.h $(TOP)/ip_compat.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/fil.c -o $@ |
| |
| fil_k.o: $(TOP)/fil.c $(TOP)/ip_fil.h $(TOP)/ipf.h $(TOP)/ip_compat.h |
| $(CC) $(DEBUG) $(CFLAGS) $(POLICY) $(DFLAGS) -c $(TOP)/fil.c -o $@ |
| |
| ipf.o: $(TOP)/ipf.c $(TOP)/ip_fil.h $(TOP)/ipf.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ipf.c -o $@ |
| |
| ipt.o: $(TOP)/ipt.c $(TOP)/ip_fil.h $(TOP)/ipt.h $(TOP)/ipf.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ipt.c -o $@ |
| |
| misc.o: $(TOP)/misc.c $(TOP)/ip_fil.h $(TOP)/ipt.h $(TOP)/ipf.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/misc.c -o $@ |
| |
| inet_addr.o: $(TOP)/inet_addr.c |
| $(CC) $(ATON) $(DEBUG) $(CFLAGS) -c $(TOP)/inet_addr.c -o $@ |
| |
| opt.o: $(TOP)/opt.c $(TOP)/ip_fil.h $(TOP)/ipf.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/opt.c -o $@ |
| |
| ipnat.o: $(TOP)/ipnat.c $(TOP)/ip_fil.h $(TOP)/ipf.h $(TOP)/ip_nat.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ipnat.c -o $@ |
| |
| ipft_sn.o: $(TOP)/ipft_sn.c $(TOP)/ipt.h $(TOP)/ipf.h $(TOP)/ip_fil.h \ |
| $(TOP)/snoop.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ipft_sn.c -o $@ |
| |
| ipft_ef.o: $(TOP)/ipft_ef.c $(TOP)/ipf.h $(TOP)/ip_fil.h $(TOP)/ipt.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ipft_ef.c -o $@ |
| |
| ipft_td.o: $(TOP)/ipft_td.c $(TOP)/ipf.h $(TOP)/ip_fil.h $(TOP)/ipt.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ipft_td.c -o $@ |
| |
| ipft_pc.o: $(TOP)/ipft_pc.c $(TOP)/ipf.h $(TOP)/ip_fil.h $(TOP)/ipt.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ipft_pc.c -o $@ |
| |
| ipft_tx.o: $(TOP)/ipft_tx.c $(TOP)/ipf.h $(TOP)/ip_fil.h $(TOP)/ipt.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ipft_tx.c -o $@ |
| |
| ipft_hx.o: $(TOP)/ipft_hx.c $(TOP)/ipf.h $(TOP)/ip_fil.h $(TOP)/ipt.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ipft_hx.c -o $@ |
| |
| ip_nat_u.o: $(TOP)/ip_nat.c $(TOP)/ip_nat.h $(TOP)/ip_compat.h $(TOP)/ip_fil.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ip_nat.c -o $@ |
| |
| ip_proxy_u.o: $(TOP)/ip_proxy.c $(TOP)/ip_proxy.h $(TOP)/ip_compat.h \ |
| $(TOP)/ip_fil.h $(TOP)/ip_nat.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ip_proxy.c -o $@ |
| |
| ip_frag_u.o: $(TOP)/ip_frag.c $(TOP)/ip_frag.h $(TOP)/ip_compat.h \ |
| $(TOP)/ip_fil.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ip_frag.c -o $@ |
| |
| ip_state_u.o: $(TOP)/ip_state.c $(TOP)/ip_state.h $(TOP)/ip_compat.h \ |
| $(TOP)/ip_fil.h $(TOP)/ip_nat.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ip_state.c -o $@ |
| |
| ip_auth_u.o: $(TOP)/ip_auth.c $(TOP)/ip_auth.h $(TOP)/ip_compat.h \ |
| $(TOP)/ip_fil.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/ip_auth.c -o $@ |
| |
| ip_fil_u.o: $(TOP)/$(IPFILC) $(TOP)/ip_fil.h $(TOP)/ip_compat.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/$(IPFILC) -o $@ |
| |
| $(LKM): $(MODOBJS) |
| ld $(MLFLAGS) -r -d $(MODOBJS) -o $(LKM) |
| |
| ip_nat.o: $(TOP)/ip_nat.c $(TOP)/ip_nat.h $(TOP)/ip_compat.h $(TOP)/ip_fil.h |
| $(CC) $(DEBUG) $(CFLAGS) $(DFLAGS) -c $(TOP)/ip_nat.c -o $@ |
| |
| ip_frag.o: $(TOP)/ip_frag.c $(TOP)/ip_frag.h $(TOP)/ip_compat.h $(TOP)/ip_fil.h |
| $(CC) $(DEBUG) $(CFLAGS) $(DFLAGS) -c $(TOP)/ip_frag.c -o $@ |
| |
| ip_state.o: $(TOP)/ip_state.c $(TOP)/ip_state.h $(TOP)/ip_compat.h \ |
| $(TOP)/ip_fil.h $(TOP)/ip_nat.h |
| $(CC) $(DEBUG) $(CFLAGS) $(DFLAGS) -c $(TOP)/ip_state.c -o $@ |
| |
| ip_proxy.o: $(TOP)/ip_proxy.c $(TOP)/ip_proxy.h $(TOP)/ip_compat.h \ |
| $(TOP)/ip_fil.h $(TOP)/ip_nat.h |
| $(CC) $(DEBUG) $(CFLAGS) $(DFLAGS) -c $(TOP)/ip_proxy.c -o $@ |
| |
| ip_auth.o: $(TOP)/ip_auth.c $(TOP)/ip_auth.h $(TOP)/ip_compat.h \ |
| $(TOP)/ip_fil.h |
| $(CC) $(DEBUG) $(CFLAGS) $(DFLAGS) -c $(TOP)/ip_auth.c -o $@ |
| |
| ip_fil.o: $(TOP)/$(IPFILC) $(TOP)/ip_fil.h $(TOP)/ip_compat.h $(TOP)/ip_nat.h |
| $(CC) $(DEBUG) $(CFLAGS) $(DFLAGS) -c $(TOP)/$(IPFILC) -o $@ |
| |
| ip_log.o: $(TOP)/ip_log.c $(TOP)/ip_compat.h $(TOP)/ip_fil.h |
| $(CC) $(DEBUG) $(CFLAGS) $(DFLAGS) -c $(TOP)/ip_log.c -o $@ |
| |
| ml_ipl.o: $(TOP)/$(MLD) $(TOP)/ipl.h |
| $(CC) -I. $(CFLAGS) $(DFLAGS) -c $(TOP)/$(ML) -o $@ |
| |
| kmem.o: $(TOP)/kmem.c |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/kmem.c -o $@ |
| |
| parse.o: $(TOP)/parse.c $(TOP)/ip_fil.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/parse.c -o $@ |
| |
| common.o: $(TOP)/common.c $(TOP)/ip_fil.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/common.c -o $@ |
| |
| facpri.o: $(TOP)/facpri.c $(TOP)/facpri.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/facpri.c -o $@ |
| |
| ipmon: $(TOP)/ipmon.c |
| $(CC) $(DEBUG) $(CFLAGS) $(LOGFAC) $(TOP)/ipmon.c -o $@ $(LIBS) |
| |
| natparse.o: $(TOP)/natparse.c $(TOP)/ip_compat.h $(TOP)/ip_fil.h \ |
| $(TOP)/ip_proxy.h $(TOP)/ip_nat.h |
| $(CC) $(DEBUG) $(CFLAGS) -c $(TOP)/natparse.c -o $@ |
| |
| clean: |
| ${RM} -f *.core *.o ipt fils ipf ipfstat ipftest ipmon ipnat $(LKM) |
| ${MAKE} -f Makefile.ipsend ${MFLAGS} clean |
| -(for i in *; do \ |
| if [ -d $${i} -a -f $${i}/Makefile ] ; then \ |
| cd $${i}; (make clean); cd ..; \ |
| ${RM} $${i}/Makefile $${i}/Makefile.ipsend; \ |
| rmdir $${i}; \ |
| fi \ |
| done) |
| |
| install: |
| -$(INSTALL) -F $(SBINDEST) -m 755 -src $(CPUDIR)/ipf -O ipf |
| -$(INSTALL) -F $(SBINDEST) -m 755 -src $(CPUDIR)/ipfstat -O ipfstat |
| -$(INSTALL) -F $(SBINDEST) -m 755 -src $(CPUDIR)/ipnat -O ipnat |
| |
| -$(INSTALL) -F $(SBINDEST) -m 755 -src $(CPUDIR)/ipmon -O ipmon |
| -$(INSTALL) -F $(BINDEST) -m 755 -src $(CPUDIR)/ipftest -O ipftest |
| -$(INSTALL) -F $(BINDEST) -m 755 -src $(CPUDIR)/ipsend -O ipsend |
| -$(INSTALL) -F $(BINDEST) -m 755 -src $(CPUDIR)/ipresend -O ipresend |
| -if [ -r $(LKMDEST)/$(LKM) -a ! -r $(LKMDEST)/$(LKM).DIST ]; then \ |
| cp -p $(LKMDEST)/$(LKM) $(LKMDEST)/$(LKM).DIST; \ |
| fi |
| -$(INSTALL) -F $(LKMDEST) -m 444 -src $(CPUDIR)/$(LKM) -O $(LKM) |
| -$(INSTALL) -F $(INCDEST) -m 444 -src $(TOP)/ip_fil.h -O ip_fil.h |
| -$(INSTALL) -F $(INCDEST) -m 444 -src $(TOP)/ip_nat.h -O ip_nat.h |
| -$(INSTALL) -F $(MANDIR)/man1 -m 444 -src $(TOP)/ipsend/ipsend.1 -O ipsend.1 |
| -$(INSTALL) -F $(MANDIR)/man1 -m 444 -src $(TOP)/ipsend/ipresend.1 -O ipresend.1 |
| -$(INSTALL) -F $(MANDIR)/man1 -m 444 -src $(TOP)/ipsend/iptest.1 -O iptest.1 |
| -$(INSTALL) -F $(MANDIR)/man5 -m 444 -src $(TOP)/ipsend/ipsend.5 -O ipsend.5 |
| -$(INSTALL) -F $(MANDIR)/man1 -m 444 -src $(TOP)/man/ipnat.1 -O ipnat.1 |
| -$(INSTALL) -F $(MANDIR)/man1 -m 444 -src $(TOP)/man/ipftest.1 -O ipftest.1 |
| -$(INSTALL) -F $(MANDIR)/man4 -m 444 -src $(TOP)/man/ipf.4 -O ipf.4 |
| -$(INSTALL) -F $(MANDIR)/man4 -m 444 -src $(TOP)/man/ipl.4 -O ipl.4 |
| -$(INSTALL) -F $(MANDIR)/man4 -m 444 -src $(TOP)/man/ipnat.4 -O ipnat.4 |
| -$(INSTALL) -F $(MANDIR)/man5 -m 444 -src $(TOP)/man/ipf.5 -O ipf.5 |
| -$(INSTALL) -F $(MANDIR)/man5 -m 444 -src $(TOP)/man/ipnat.5 -O ipnat.5 |
| -$(INSTALL) -F $(MANDIR)/man5 -m 444 -src $(TOP)/man/ipfilter.5 -O ipfilter.5 |
| -$(INSTALL) -F $(MANDIR)/man8 -m 444 -src $(TOP)/man/ipf.8 -O ipf.8 |
| -$(INSTALL) -F $(MANDIR)/man8 -m 444 -src $(TOP)/man/ipfs.8 -O ipfs.8 |
| -$(INSTALL) -F $(MANDIR)/man8 -m 444 -src $(TOP)/man/ipfstat.8 -O ipfstat.8 |
| -$(INSTALL) -F $(MANDIR)/man8 -m 444 -src $(TOP)/man/ipmon.8 -O ipmon.8 |
| -$(INSTALL) -F /etc/init.d -m 755 -src ipfboot -O ipf |
| -$(INSTALL) -F /etc/rc2.d -lns ../init.d/ipf -O S33ipf |
| #if !defined(IPFLKM) || empty(IPFLKM) |
| -${RM} -f $(LKMDEST)/ipflkm.o |
| /etc/autoconfig |
| #endif |
| |