xref: /titanic_52/usr/src/cmd/ipf/tools/Makefile.tools (revision 06e46062ef4f5f4b687cbafb4518fb123fe23920)
1#
2# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4#
5#
6#pragma ident	"%Z%%M%	%I%	%E% SMI"
7#
8
9PROG=		ipf ipfs ipmon ipnat ippool ipfstat
10IPFPROG=	ipftest
11
12IPF_OBJS=	ipf.o ipfcomp.o ipf_y.o ipf_l.o
13IPFS_OBJS=	ipfs.o
14IPFSTAT_OBJS=	ipfstat.o
15IPMON_OBJS=	ipmon.o ipmon_y.o ipmon_l.o
16IPNAT_OBJS=	ipnat.o ipnat_y.o ipnat_l.o
17IPPOOL_OBJS=	ippool.o ippool_y.o ippool_l.o
18IPFTEST_OBJS=	ipftest.o  \
19		ip_fil.o ip_state.o \
20		ip_frag.o ip_nat.o fil.o \
21		ip_htable.o ip_lookup.o \
22		ip_proxy.o ip_auth.o ip_log.o \
23		ipf_y.o ipf_l.o \
24		ipnat_y.o ipnat_l.o \
25		ippool_y.o ippool_l.o \
26		ip_pool.o radix.o
27
28OBJS=		$(IPF_OBJS) $(IPFS_OBJS) $(IPFSTAT_OBJS) \
29		$(IPMON_OBJS) $(IPNAT_OBJS) $(IPFTEST_OBJS)
30
31OBJSL=		$(IPF_OBJS) $(IPFS_OBJS) $(IPFSTAT_OBJS) \
32		$(IPMON_OBJS) $(IPNAT_OBJS)
33
34SRCS=		$(OBJSL:%.o=../%.c)
35
36include ../../../Makefile.cmd
37include ../../Makefile.ipf
38
39LDLIBS		+= $(LIBBPF)
40
41CPPFLAGS	+= -I. -DIPFILTER_LOOKUP -DIPFILTER_LOG
42
43ipfstat.o	:=	CPPFLAGS += -DSTATETOP
44ipfstat		:=	LDLIBS += -lcurses
45
46ipf		:=	LDLIBS += -lsocket -lnsl
47ipftest		:=	LDLIBS += -lsocket -lnsl -lmd5
48ipfstat		:=	LDLIBS += -lsocket -lnsl -lkvm -lelf
49ipmon		:=	LDLIBS += -lsocket -lnsl
50ipnat		:=	LDLIBS += -lsocket -lnsl -lkvm -lelf
51ippool		:=	LDLIBS += -lnsl -lkvm
52
53CLEANFILES	+= $(OBJS)
54
55ROOTIPF=	$(ROOTLIB)/ipf
56ROOTIPF32=	$(ROOTIPF)/$(MACH32)
57ROOTIPF64=	$(ROOTIPF)/$(MACH64)
58
59ROOTIPFPROG32=	$(IPFPROG:%=$(ROOTIPF32)/%)
60ROOTIPFPROG64=	$(IPFPROG:%=$(ROOTIPF64)/%)
61
62ROOTIPFLINKS=		$(IPFPROG:%=$(ROOTIPF)/%)
63ROOTUSRSBINLINKS=	$(PROG:%=$(ROOTUSRSBIN)/%)
64
65$(ROOTIPF32):
66	$(INS.dir)
67
68$(ROOTIPF64):
69	$(INS.dir)
70
71$(ROOTIPF)/%: %
72	$(INS.file)
73
74$(ROOTIPF32)/%: %
75	$(INS.file)
76
77$(ROOTIPF64)/%: %
78	$(INS.file)
79
80$(ROOTUSRSBINLINKS): FRC
81	-$(RM) $@; $(LN) $(ISAEXEC) $@
82
83$(ROOTIPFLINKS): FRC
84	-$(RM) $@; $(LN) $(ISAEXEC) $@
85
86
87.KEEP_STATE:
88
89ipf:	$(IPF_OBJS) $(LIBIPF)
90	$(LINK.c) -o ipf $(IPF_OBJS) $(LDLIBS)
91	$(POST_PROCESS)
92
93ipf_y.o: ../ipf_y.c $(COMMONIPF)/ip_fil.h $(COMMONIPF)/ipf.h \
94	../ipf_y.c ../ipf_l.h
95
96../ipf_y.c ../ipf_y.h: ../ipf_y.y
97	$(YACC) -d -b ipf ../ipf_y.y
98	sed -e 's/yy/ipf_yy/g' -e 's/y.tab.h/ipf_y.c/' \
99	   ipf.tab.c > ../ipf_y.c
100	sed -e 's/yy/ipf_yy/g' -e 's/y.tab.h/ipf_y.h/' \
101	   ipf.tab.h > ../ipf_y.h
102
103ipf_l.o: ../ipf_l.c $(COMMONIPF)/ip_fil.h $(COMMONIPF)/ipf.h  \
104	 ../ipf_y.h ../ipf_l.h
105	$(COMPILE.c) ../ipf_l.c -o $@
106
107../ipf_l.c: ../lexer.c $(COMMONIPF)/ipf.h $(COMMONIPF)/ip_fil.h
108	sed -e 's/yy/ipf_yy/g' -e 's/y.tab.h/ipf_y.h/' \
109	       -e 's/lexer.h/ipf_l.h/' ../lexer.c > $@
110
111../ipf_l.h: ../lexer.h
112	sed -e 's/yy/ipf_yy/g' ../lexer.h > $@
113
114ipfs:	$(IPFS_OBJS)
115	$(LINK.c) -o ipfs $(IPFS_OBJS) $(LDLIBS)
116	$(POST_PROCESS)
117
118ipfstat:	$(IPFSTAT_OBJS)
119	$(LINK.c) -o ipfstat $(IPFSTAT_OBJS) $(LDLIBS)
120	$(POST_PROCESS)
121
122ipmon:	$(IPMON_OBJS) $(LIBIPF)
123	$(LINK.c) -o ipmon $(IPMON_OBJS) $(LDLIBS)
124	$(POST_PROCESS)
125
126ipmon_y.o: ../ipmon_y.c $(COMMONIPF)/ipmon.h \
127	../ipmon_y.h ../ipmon_l.h
128
129../ipmon_y.c ../ipmon_y.h: ../ipmon_y.y
130	$(YACC) -d -b ipmon ../ipmon_y.y
131	sed -e 's/yy/ipmon_yy/g' \
132	    -e 's/extern [a-z]* .*();//' \
133	    -e 's/^\(static [a-z]* .*\)();/\1(void);/' \
134	   ipmon.tab.c > ../ipmon_y.c
135	sed -e 's/yy/ipmon_yy/g' -e 's/y.tab.h/ipmon_y.h/' \
136	   ipmon.tab.h > ../ipmon_y.h
137
138ipmon_l.o: ../ipmon_l.c $(COMMONIPF)/ipmon.h ../ipmon_y.h ../ipmon_l.h
139	$(COMPILE.c) ../ipmon_l.c -o $@
140
141../ipmon_l.c: ../lexer.c $(COMMONIPF)/ipmon.h
142	sed -e 's/yy/ipmon_yy/g' -e 's/y.tab.h/ipmon_y.h/' \
143            -e 's/lexer.h/ipmon_l.h/' ../lexer.c > $@
144
145../ipmon_l.h: ../lexer.h
146	sed -e 's/yy/ipmon_yy/g' ../lexer.h > $@
147
148ipnat:	$(IPNAT_OBJS) $(LIBIPF)
149	$(LINK.c) -o ipnat $(IPNAT_OBJS) $(LDLIBS)
150	$(POST_PROCESS)
151
152ipnat_y.o: ../ipnat_y.c $(COMMONIPF)/ip_nat.h \
153	../ipnat_y.h ../ipnat_l.h
154
155../ipnat_y.c ../ipnat_y.h: ../ipnat_y.y
156	$(YACC) -d -b ipnat ../ipnat_y.y
157	sed -e 's/yy/ipnat_yy/g' \
158	    -e 's/extern [a-z]* .*();//' \
159	    -e 's/^\(static [a-z]* .*\)();/\1(void);/' \
160	   ipnat.tab.c > ../ipnat_y.c
161	sed -e 's/yy/ipnat_yy/g' -e 's/y.tab.h/ipnat_y.h/' \
162	   ipnat.tab.h > ../ipnat_y.h
163
164ipnat_l.o: ../ipnat_l.c $(COMMONIPF)/ip_nat.h ../ipnat_l.h
165	$(COMPILE.c) ../ipnat_l.c -o $@
166
167../ipnat_l.c: ../lexer.c $(COMMONIPF)/ip_nat.h
168	sed -e 's/yy/ipnat_yy/g' -e 's/y.tab.h/ipnat_y.h/' \
169	       -e 's/lexer.h/ipnat_l.h/' ../lexer.c > $@
170
171../ipnat_l.h: ../lexer.h
172	sed -e 's/yy/ipnat_yy/g' ../lexer.h > $@
173
174ippool:	$(IPPOOL_OBJS) $(LIBIPF)
175	$(LINK.c) -o ippool $(IPPOOL_OBJS) $(LDLIBS)
176	$(POST_PROCESS)
177
178ippool_y.o: ../ippool_y.c $(COMMONIPF)/ip_pool.h \
179	../ippool_y.h ../ippool_l.h
180
181../ippool_y.c ../ippool_y.h: ../ippool_y.y
182	$(YACC) -d -b ippool ../ippool_y.y
183	sed -e 's/yy/ippool_yy/g' \
184	    -e 's/extern [a-z]* .*();//' \
185	    -e 's/^\(static [a-z]* .*\)();/\1(void);/' \
186	   ippool.tab.c > ../ippool_y.c
187	sed -e 's/yy/ippool_yy/g' -e 's/y.tab.h/ippool_y.h/' \
188	   ippool.tab.h > ../ippool_y.h
189
190ippool_l.o: ../ippool_l.c $(COMMONIPF)/ip_pool.h ../ippool_l.h
191	$(COMPILE.c) ../ippool_l.c -o $@
192
193../ippool_l.c: ../lexer.c $(COMMONIPF)/ip_pool.h
194	sed -e 's/yy/ippool_yy/g' -e 's/y.tab.h/ippool_y.h/' \
195	       -e 's/lexer.h/ippool_l.h/' ../lexer.c > $@
196
197../ippool_l.h: ../lexer.h
198	sed -e 's/yy/ippool_yy/g' ../lexer.h > $@
199
200ipftest:	$(IPFTEST_OBJS) $(LIBIPF)
201	$(LINK.c) -zignore -o ipftest $(IPFTEST_OBJS) $(LDLIBS)
202	$(POST_PROCESS)
203
204clean:
205	-$(RM) $(CLEANFILES)
206
207lint: 	lint_SRCS
208
209%.o:	$(SRC)/common/ipf/%.c
210	$(COMPILE.c) $<
211
212%.o:	../%.c
213	$(COMPILE.c) $<
214
215include ../../../Makefile.targ
216
217FRC:
218