Makefile revision 23279
1#
2# (C)opyright 1993, 1994, 1995 by Darren Reed.
3#
4# This code may be freely distributed as long as it retains this notice
5# and is not changed in any way.  The author accepts no responsibility
6# for the use of this software.  I hate legaleese, don't you ?
7#
8# $Id: Makefile,v 2.0.1.5 1997/02/16 06:17:04 darrenr Exp $
9#
10# where to put things.
11#
12BINDEST=/usr/local/ip_fil3.1.1/bin
13SBINDEST=/usr/local/ip_fil3.1.1/sbin
14MANDIR=/usr/local/ip_fil3.1.1/man
15CC=gcc
16DEBUG=-g
17CFLAGS=-I$$(TOP)
18DCPU=`uname -m`
19#
20# To enable this to work as a Loadable Kernel Module...
21#
22IPFLKM=-DIPFILTER_LKM
23#
24# To enable logging of blocked/passed packets...
25#
26IPFLOG=-DIPFILTER_LOG
27#
28# The facility you wish to log messages from ipmon to syslogd with.
29#
30LOGFAC=-DLOGFAC=LOG_LOCAL0
31#
32# For packets which don't match any pass rules or any block rules, set either
33# FR_PASS or FR_BLOCK (respectively).  It defaults to FR_PASS if left
34# undefined.  This is ignored for ipftest, which can thus return three
35# results: pass, block and nomatch.  This is the sort of "block unless
36# explicitly allowed" type #define switch.
37#
38POLICY=-DIPF_DEFAULT_PASS=FR_PASS
39#
40MFLAGS="BINDEST=$(BINDEST)" "SBINDEST=$(SBINDEST)" "MANDIR=$(MANDIR)" \
41	"CC=$(CC)" 'CFLAGS=$(CFLAGS) $(SOLARIS2)' "IPFLKM=$(IPFLKM)" \
42	"IPFLOG=$(IPFLOG)" "LOGFAC=$(LOGFAC)" "POLICY=$(POLICY)" \
43	"SOLARIS2=$(SOLARIS2)" "DEBUG=$(DEBUG)" "ARCH=$(ARCH)"
44#
45########## ########## ########## ########## ########## ########## ##########
46#
47CP=/bin/cp
48RM=/bin/rm
49CHMOD=/bin/chmod
50INSTALL=install
51#
52DFLAGS=$(IPFLKM) $(IPFLOG) $(DEF)
53
54all:
55	@echo "Chose one of the following targets for making IP filter:"
56	@echo ""
57	@echo "solaris	- auto-selects SunOS4.1.x/Solaris 2.[45]/Soalris2.[45]-x86"
58	@echo "bsd	- compile for 4.4BSD based Unixes (FreeBSD/NetBSD/OpenBSD)"
59	@echo "bsdi	- compile for BSD/OS"
60	@echo ""
61
62tests:
63	@if [ -d test ]; then (cd test; make) \
64	else echo test directory not present, sorry; fi
65
66sunos solaris:
67	./buildsunos
68
69sunos4 solaris1:
70	(cd SunOS4; make build TOP=.. $(MFLAGS); cd ..)
71	(cd SunOS4; make -f Makefile.ipsend TOP=.. $(MFLAGS); cd ..)
72
73sunos5 solaris2:
74	(cd SunOS5/$(DCPU); make build TOP=../.. $(MFLAGS) "SOLARIS2=$(SOLARIS2)" "CPU=-Dsparc -D__sparc__"; cd ..)
75	(cd SunOS5/$(DCPU); make -f Makefile.ipsend TOP=../.. $(MFLAGS); cd ..)
76
77sunos5x86 solaris2x86:
78	(cd SunOS5/$(DCPU); make build TOP=../.. $(MFLAGS) "SOLARIS2=$(SOLARIS2)" "CPU=-Di86pc -Di386 -D__i386__"; cd ..)
79	(cd SunOS5/$(DCPU); make -f Makefile.ipsend TOP=../.. $(MFLAGS); cd ..)
80
81bsd netbsd freebsd:
82	-if [ ! -d BSD/$(DCPU) ] ; then mkdir BSD/$(DCPU); fi
83	-rm -f BSD/$(DCPU)/Makefile BSD/$(DCPU)/Makefile.ipsend
84	-ln -s ../Makefile BSD/$(DCPU)/Makefile
85	-ln -s ../Makefile.ipsend BSD/$(DCPU)/Makefile.ipsend
86	(cd BSD/$(DCPU); make build "TOP=../.." $(MFLAGS); cd ..)
87	(cd BSD/$(DCPU); make -f Makefile.ipsend "TOP=../.." $(MFLAGS); cd ..)
88
89bsdi bsdos:
90	-if [ ! -d BSD/$(DCPU) ] ; then mkdir BSD/$(DCPU); fi
91	-rm -f BSD/$(DCPU)/Makefile BSD/$(DCPU)/Makefile.ipsend
92	-ln -s ../Makefile BSD/$(DCPU)/Makefile
93	-ln -s ../Makefile.ipsend BSD/$(DCPU)/Makefile.ipsend
94	(cd BSD/$(DCPU); make build "TOP=../.." $(MFLAGS) LKM= ; cd ..)
95	(cd BSD/$(DCPU); make -f Makefile.ipsend "TOP=../.." $(MFLAGS); cd ..)
96
97clean:
98	${RM} -f core *.o ipt fils ipf ipfstat ipftest ipmon if_ipl \
99	vnode_if.h $(LKM)
100	(cd SunOS4; make clean)
101	(cd SunOS5; make clean)
102	(cd BSD; make clean)
103	[ -d test ] && (cd test; make clean)
104	(cd ipsend; make clean)
105
106clean-bsd:
107	(cd BSD; make clean)
108
109clean-sunos4:
110	(cd SunOS4; make clean)
111
112clean-sunos5:
113	(cd SunOS5; make clean)
114
115get:
116	-@for i in ipf.c ipt.h solaris.c ipf.h kmem.c ipft_ef.c linux.h \
117		ipft_pc.c fil.c ipft_sn.c mln_ipl.c fils.c ipft_td.c \
118		mls_ipl.c ip_compat.h ipl.h opt.c ip_fil.c ipl_ldev.c \
119		parse.c ip_fil.h ipmon.c pcap.h ip_sfil.c ipt.c snoop.h \
120		ip_state.c ip_state.h ip_nat.c ip_nat.h ip_frag.c \
121		ip_frag.h ip_sfil.c misc.c; do \
122		if [ ! -f $$i ] ; then \
123			echo "getting $$i"; \
124			sccs get $$i; \
125		fi \
126	done
127
128install-bsd: bsd
129	(cd BSD/$(DCPU); $(MAKE) "TOP=../.." install)
130install-sunos4: solaris
131	(cd SunOS4; $(MAKE) "TOP=.." install)
132install-sunos5: solaris
133	(cd SunOS5; $(MAKE) "TOP=.." install)
134
135# XXX FIXME: bogus to depend on all!
136install: all ip_fil.h
137	-$(CP) ip_fil.h /usr/include/netinet/ip_fil.h
138	-$(CHMOD) 444 /usr/include/netinet/ip_fil.h
139	-$(INSTALL) -cs -g wheel -m 755 -o root ipfstat ipf ipnat $(SBINDEST)
140	-$(INSTALL) -cs -g wheel -m 755 -o root ipmon ipftest $(BINDEST)
141	(cd man; $(MAKE) INSTALL=$(INSTALL) MANDIR=$(MANDIR) install; cd ..)
142
143rcsget:
144	-@for i in ipf.c ipt.h solaris.c ipf.h kmem.c ipft_ef.c linux.h \
145		ipft_pc.c fil.c ipft_sn.c mln_ipl.c fils.c ipft_td.c \
146		mls_ipl.c ip_compat.h ipl.h opt.c ip_fil.c ipl_ldev.c \
147		parse.c ip_fil.h ipmon.c pcap.h ip_sfil.c ipt.c snoop.h \
148		ip_state.c ip_state.h ip_nat.c ip_nat.h ip_frag.c \
149		ip_frag.h ip_sfil.c misc.c; do \
150		if [ ! -f $$i ] ; then \
151			echo "getting $$i"; \
152			co $$i; \
153		fi \
154	done
155
156do-cvs:
157	find . -type d -name CVS -print | xargs /bin/rm -rf
158	find . -type f -name .cvsignore -print | xargs /bin/rm -f
159