xref: /titanic_53/usr/src/cmd/ipf/tools/Makefile.tools (revision 16070783c69283175b84d52ad8b44be53e5fcdd5)
17c478bd9Sstevel@tonic-gate#
2f4b3ec61Sdh155122# CDDL HEADER START
3f4b3ec61Sdh155122#
4f4b3ec61Sdh155122# The contents of this file are subject to the terms of the
5f4b3ec61Sdh155122# Common Development and Distribution License (the "License").
6f4b3ec61Sdh155122# You may not use this file except in compliance with the License.
7f4b3ec61Sdh155122#
8f4b3ec61Sdh155122# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9f4b3ec61Sdh155122# or http://www.opensolaris.org/os/licensing.
10f4b3ec61Sdh155122# See the License for the specific language governing permissions
11f4b3ec61Sdh155122# and limitations under the License.
12f4b3ec61Sdh155122#
13f4b3ec61Sdh155122# When distributing Covered Code, include this CDDL HEADER in each
14f4b3ec61Sdh155122# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15f4b3ec61Sdh155122# If applicable, add the following below this CDDL HEADER, with the
16f4b3ec61Sdh155122# fields enclosed by brackets "[]" replaced with your own identifying
17f4b3ec61Sdh155122# information: Portions Copyright [yyyy] [name of copyright owner]
18f4b3ec61Sdh155122#
19f4b3ec61Sdh155122# CDDL HEADER END
20f4b3ec61Sdh155122#
21f4b3ec61Sdh155122#
22*16070783SVladimir Kotal# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gatePROG=		ipf ipfs ipmon ipnat ippool ipfstat
277c478bd9Sstevel@tonic-gateIPFPROG=	ipftest
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gateIPF_OBJS=	ipf.o ipfcomp.o ipf_y.o ipf_l.o
307c478bd9Sstevel@tonic-gateIPFS_OBJS=	ipfs.o
317c478bd9Sstevel@tonic-gateIPFSTAT_OBJS=	ipfstat.o
327c478bd9Sstevel@tonic-gateIPMON_OBJS=	ipmon.o ipmon_y.o ipmon_l.o
337c478bd9Sstevel@tonic-gateIPNAT_OBJS=	ipnat.o ipnat_y.o ipnat_l.o
347c478bd9Sstevel@tonic-gateIPPOOL_OBJS=	ippool.o ippool_y.o ippool_l.o
357c478bd9Sstevel@tonic-gateIPFTEST_OBJS=	ipftest.o  \
36d6c23f6fSyx160601		ip_fil.o ip_state.o ip_compat.o \
37d6c23f6fSyx160601		ip_frag.o ip_nat.o ip_nat6.o fil.o \
387c478bd9Sstevel@tonic-gate		ip_htable.o ip_lookup.o \
397c478bd9Sstevel@tonic-gate		ip_proxy.o ip_auth.o ip_log.o \
407c478bd9Sstevel@tonic-gate		ipf_y.o ipf_l.o \
417c478bd9Sstevel@tonic-gate		ipnat_y.o ipnat_l.o \
427c478bd9Sstevel@tonic-gate		ippool_y.o ippool_l.o \
437c478bd9Sstevel@tonic-gate		ip_pool.o radix.o
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gateOBJS=		$(IPF_OBJS) $(IPFS_OBJS) $(IPFSTAT_OBJS) \
467c478bd9Sstevel@tonic-gate		$(IPMON_OBJS) $(IPNAT_OBJS) $(IPFTEST_OBJS)
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gateOBJSL=		$(IPF_OBJS) $(IPFS_OBJS) $(IPFSTAT_OBJS) \
497c478bd9Sstevel@tonic-gate		$(IPMON_OBJS) $(IPNAT_OBJS)
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gateSRCS=		$(OBJSL:%.o=../%.c)
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gateinclude ../../../Makefile.cmd
547c478bd9Sstevel@tonic-gateinclude ../../Makefile.ipf
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gateLDLIBS		+= $(LIBBPF)
5724da5b34SrieLDFLAGS		+= $(MAPFILE.NGB:%=-M%)
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gateCPPFLAGS	+= -I. -DIPFILTER_LOOKUP -DIPFILTER_LOG
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gateipfstat.o	:=	CPPFLAGS += -DSTATETOP
627c478bd9Sstevel@tonic-gateipfstat		:=	LDLIBS += -lcurses
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gateipf		:=	LDLIBS += -lsocket -lnsl
65734b6a94Sdarrenmipftest		:=	LDLIBS += -lsocket -lnsl -lmd
667c478bd9Sstevel@tonic-gateipfstat		:=	LDLIBS += -lsocket -lnsl -lkvm -lelf
677c478bd9Sstevel@tonic-gateipmon		:=	LDLIBS += -lsocket -lnsl
687c478bd9Sstevel@tonic-gateipnat		:=	LDLIBS += -lsocket -lnsl -lkvm -lelf
69f4b3ec61Sdh155122ippool		:=	LDLIBS += -lsocket -lnsl -lkvm -lelf
707c478bd9Sstevel@tonic-gate
717c478bd9Sstevel@tonic-gateCLEANFILES	+= $(OBJS)
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gateROOTIPF=	$(ROOTLIB)/ipf
747c478bd9Sstevel@tonic-gateROOTIPF32=	$(ROOTIPF)/$(MACH32)
757c478bd9Sstevel@tonic-gateROOTIPF64=	$(ROOTIPF)/$(MACH64)
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gateROOTIPFPROG32=	$(IPFPROG:%=$(ROOTIPF32)/%)
787c478bd9Sstevel@tonic-gateROOTIPFPROG64=	$(IPFPROG:%=$(ROOTIPF64)/%)
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gateROOTIPFLINKS=		$(IPFPROG:%=$(ROOTIPF)/%)
817c478bd9Sstevel@tonic-gateROOTUSRSBINLINKS=	$(PROG:%=$(ROOTUSRSBIN)/%)
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate$(ROOTIPF32):
847c478bd9Sstevel@tonic-gate	$(INS.dir)
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate$(ROOTIPF64):
877c478bd9Sstevel@tonic-gate	$(INS.dir)
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gate$(ROOTIPF)/%: %
907c478bd9Sstevel@tonic-gate	$(INS.file)
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gate$(ROOTIPF32)/%: %
937c478bd9Sstevel@tonic-gate	$(INS.file)
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gate$(ROOTIPF64)/%: %
967c478bd9Sstevel@tonic-gate	$(INS.file)
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gate$(ROOTUSRSBINLINKS): FRC
997c478bd9Sstevel@tonic-gate	-$(RM) $@; $(LN) $(ISAEXEC) $@
1007c478bd9Sstevel@tonic-gate
1017c478bd9Sstevel@tonic-gate$(ROOTIPFLINKS): FRC
1027c478bd9Sstevel@tonic-gate	-$(RM) $@; $(LN) $(ISAEXEC) $@
1037c478bd9Sstevel@tonic-gate
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gate.KEEP_STATE:
1067c478bd9Sstevel@tonic-gate
10724da5b34Srieipf:	$(IPF_OBJS) $(LIBIPF) $(MAPFILE.NGB)
1087c478bd9Sstevel@tonic-gate	$(LINK.c) -o ipf $(IPF_OBJS) $(LDLIBS)
1097c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1107c478bd9Sstevel@tonic-gate
111ab25eeb5Syz155240ipf_y.o: ../ipf_y.c $(COMMONIPF)/netinet/ip_fil.h $(COMMONIPF)/ipf.h \
1127c478bd9Sstevel@tonic-gate	../ipf_y.c ../ipf_l.h
1137c478bd9Sstevel@tonic-gate
1147c478bd9Sstevel@tonic-gate../ipf_y.c ../ipf_y.h: ../ipf_y.y
1157c478bd9Sstevel@tonic-gate	$(YACC) -d -b ipf ../ipf_y.y
1167c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipf_yy/g' -e 's/y.tab.h/ipf_y.c/' \
1177c478bd9Sstevel@tonic-gate	   ipf.tab.c > ../ipf_y.c
1187c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipf_yy/g' -e 's/y.tab.h/ipf_y.h/' \
1197c478bd9Sstevel@tonic-gate	   ipf.tab.h > ../ipf_y.h
1207c478bd9Sstevel@tonic-gate
121ab25eeb5Syz155240ipf_l.o: ../ipf_l.c $(COMMONIPF)/netinet/ip_fil.h $(COMMONIPF)/ipf.h  \
1227c478bd9Sstevel@tonic-gate	 ../ipf_y.h ../ipf_l.h
1237c478bd9Sstevel@tonic-gate	$(COMPILE.c) ../ipf_l.c -o $@
1247c478bd9Sstevel@tonic-gate
125ab25eeb5Syz155240../ipf_l.c: ../lexer.c $(COMMONIPF)/ipf.h $(COMMONIPF)/netinet/ip_fil.h
1267c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipf_yy/g' -e 's/y.tab.h/ipf_y.h/' \
1277c478bd9Sstevel@tonic-gate	       -e 's/lexer.h/ipf_l.h/' ../lexer.c > $@
1287c478bd9Sstevel@tonic-gate
1297c478bd9Sstevel@tonic-gate../ipf_l.h: ../lexer.h
1307c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipf_yy/g' ../lexer.h > $@
1317c478bd9Sstevel@tonic-gate
1327c478bd9Sstevel@tonic-gateipfs:	$(IPFS_OBJS)
1337c478bd9Sstevel@tonic-gate	$(LINK.c) -o ipfs $(IPFS_OBJS) $(LDLIBS)
1347c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1357c478bd9Sstevel@tonic-gate
13624da5b34Srieipfstat:	$(IPFSTAT_OBJS) $(MAPFILE.NGB)
1377c478bd9Sstevel@tonic-gate	$(LINK.c) -o ipfstat $(IPFSTAT_OBJS) $(LDLIBS)
1387c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1397c478bd9Sstevel@tonic-gate
14024da5b34Srieipmon:	$(IPMON_OBJS) $(LIBIPF) $(MAPFILE.NGB)
1417c478bd9Sstevel@tonic-gate	$(LINK.c) -o ipmon $(IPMON_OBJS) $(LDLIBS)
1427c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1437c478bd9Sstevel@tonic-gate
1447c478bd9Sstevel@tonic-gateipmon_y.o: ../ipmon_y.c $(COMMONIPF)/ipmon.h \
1457c478bd9Sstevel@tonic-gate	../ipmon_y.h ../ipmon_l.h
1467c478bd9Sstevel@tonic-gate
1477c478bd9Sstevel@tonic-gate../ipmon_y.c ../ipmon_y.h: ../ipmon_y.y
1487c478bd9Sstevel@tonic-gate	$(YACC) -d -b ipmon ../ipmon_y.y
1497c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipmon_yy/g' \
1507c478bd9Sstevel@tonic-gate	    -e 's/extern [a-z]* .*();//' \
1517c478bd9Sstevel@tonic-gate	    -e 's/^\(static [a-z]* .*\)();/\1(void);/' \
1527c478bd9Sstevel@tonic-gate	   ipmon.tab.c > ../ipmon_y.c
1537c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipmon_yy/g' -e 's/y.tab.h/ipmon_y.h/' \
1547c478bd9Sstevel@tonic-gate	   ipmon.tab.h > ../ipmon_y.h
1557c478bd9Sstevel@tonic-gate
1567c478bd9Sstevel@tonic-gateipmon_l.o: ../ipmon_l.c $(COMMONIPF)/ipmon.h ../ipmon_y.h ../ipmon_l.h
1577c478bd9Sstevel@tonic-gate	$(COMPILE.c) ../ipmon_l.c -o $@
1587c478bd9Sstevel@tonic-gate
1597c478bd9Sstevel@tonic-gate../ipmon_l.c: ../lexer.c $(COMMONIPF)/ipmon.h
1607c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipmon_yy/g' -e 's/y.tab.h/ipmon_y.h/' \
1617c478bd9Sstevel@tonic-gate            -e 's/lexer.h/ipmon_l.h/' ../lexer.c > $@
1627c478bd9Sstevel@tonic-gate
1637c478bd9Sstevel@tonic-gate../ipmon_l.h: ../lexer.h
1647c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipmon_yy/g' ../lexer.h > $@
1657c478bd9Sstevel@tonic-gate
16624da5b34Srieipnat:	$(IPNAT_OBJS) $(LIBIPF) $(MAPFILE.NGB)
1677c478bd9Sstevel@tonic-gate	$(LINK.c) -o ipnat $(IPNAT_OBJS) $(LDLIBS)
1687c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1697c478bd9Sstevel@tonic-gate
170ab25eeb5Syz155240ipnat_y.o: ../ipnat_y.c $(COMMONIPF)/netinet/ip_nat.h \
1717c478bd9Sstevel@tonic-gate	../ipnat_y.h ../ipnat_l.h
1727c478bd9Sstevel@tonic-gate
1737c478bd9Sstevel@tonic-gate../ipnat_y.c ../ipnat_y.h: ../ipnat_y.y
1747c478bd9Sstevel@tonic-gate	$(YACC) -d -b ipnat ../ipnat_y.y
1757c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipnat_yy/g' \
1767c478bd9Sstevel@tonic-gate	    -e 's/extern [a-z]* .*();//' \
1777c478bd9Sstevel@tonic-gate	    -e 's/^\(static [a-z]* .*\)();/\1(void);/' \
1787c478bd9Sstevel@tonic-gate	   ipnat.tab.c > ../ipnat_y.c
1797c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipnat_yy/g' -e 's/y.tab.h/ipnat_y.h/' \
1807c478bd9Sstevel@tonic-gate	   ipnat.tab.h > ../ipnat_y.h
1817c478bd9Sstevel@tonic-gate
182ab25eeb5Syz155240ipnat_l.o: ../ipnat_l.c $(COMMONIPF)/netinet/ip_nat.h ../ipnat_l.h
1837c478bd9Sstevel@tonic-gate	$(COMPILE.c) ../ipnat_l.c -o $@
1847c478bd9Sstevel@tonic-gate
185ab25eeb5Syz155240../ipnat_l.c: ../lexer.c $(COMMONIPF)/netinet/ip_nat.h
1867c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipnat_yy/g' -e 's/y.tab.h/ipnat_y.h/' \
1877c478bd9Sstevel@tonic-gate	       -e 's/lexer.h/ipnat_l.h/' ../lexer.c > $@
1887c478bd9Sstevel@tonic-gate
1897c478bd9Sstevel@tonic-gate../ipnat_l.h: ../lexer.h
1907c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipnat_yy/g' ../lexer.h > $@
1917c478bd9Sstevel@tonic-gate
19224da5b34Srieippool:	$(IPPOOL_OBJS) $(LIBIPF) $(MAPFILE.NGB)
1937c478bd9Sstevel@tonic-gate	$(LINK.c) -o ippool $(IPPOOL_OBJS) $(LDLIBS)
1947c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1957c478bd9Sstevel@tonic-gate
196ab25eeb5Syz155240ippool_y.o: ../ippool_y.c $(COMMONIPF)/netinet/ip_pool.h \
1977c478bd9Sstevel@tonic-gate	../ippool_y.h ../ippool_l.h
1987c478bd9Sstevel@tonic-gate
1997c478bd9Sstevel@tonic-gate../ippool_y.c ../ippool_y.h: ../ippool_y.y
2007c478bd9Sstevel@tonic-gate	$(YACC) -d -b ippool ../ippool_y.y
2017c478bd9Sstevel@tonic-gate	sed -e 's/yy/ippool_yy/g' \
2027c478bd9Sstevel@tonic-gate	    -e 's/extern [a-z]* .*();//' \
2037c478bd9Sstevel@tonic-gate	    -e 's/^\(static [a-z]* .*\)();/\1(void);/' \
2047c478bd9Sstevel@tonic-gate	   ippool.tab.c > ../ippool_y.c
2057c478bd9Sstevel@tonic-gate	sed -e 's/yy/ippool_yy/g' -e 's/y.tab.h/ippool_y.h/' \
2067c478bd9Sstevel@tonic-gate	   ippool.tab.h > ../ippool_y.h
2077c478bd9Sstevel@tonic-gate
208ab25eeb5Syz155240ippool_l.o: ../ippool_l.c $(COMMONIPF)/netinet/ip_pool.h ../ippool_l.h
2097c478bd9Sstevel@tonic-gate	$(COMPILE.c) ../ippool_l.c -o $@
2107c478bd9Sstevel@tonic-gate
211ab25eeb5Syz155240../ippool_l.c: ../lexer.c $(COMMONIPF)/netinet/ip_pool.h
2127c478bd9Sstevel@tonic-gate	sed -e 's/yy/ippool_yy/g' -e 's/y.tab.h/ippool_y.h/' \
2137c478bd9Sstevel@tonic-gate	       -e 's/lexer.h/ippool_l.h/' ../lexer.c > $@
2147c478bd9Sstevel@tonic-gate
2157c478bd9Sstevel@tonic-gate../ippool_l.h: ../lexer.h
2167c478bd9Sstevel@tonic-gate	sed -e 's/yy/ippool_yy/g' ../lexer.h > $@
2177c478bd9Sstevel@tonic-gate
21824da5b34Srieipftest:	$(IPFTEST_OBJS) $(LIBIPF) $(MAPFILE.NGB)
21924da5b34Srie	$(LINK.c) $(ZIGNORE) -o ipftest $(IPFTEST_OBJS) $(LDLIBS)
2207c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
2217c478bd9Sstevel@tonic-gate
2227c478bd9Sstevel@tonic-gateclean:
2237c478bd9Sstevel@tonic-gate	-$(RM) $(CLEANFILES)
2247c478bd9Sstevel@tonic-gate
2257c478bd9Sstevel@tonic-gatelint: 	lint_SRCS
2267c478bd9Sstevel@tonic-gate
227*16070783SVladimir Kotal#
228*16070783SVladimir Kotal# NOTE: all rules must use relative paths otherwise absolute paths will be
229*16070783SVladimir Kotal#       embedded into the binaries making them false positives and
230*16070783SVladimir Kotal#       reported by wsdiff
231*16070783SVladimir Kotal#
232*16070783SVladimir Kotal
233*16070783SVladimir Kotal%.o:	../../../../uts/common/inet/ipf/%.c
2347c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
2357c478bd9Sstevel@tonic-gate
2367c478bd9Sstevel@tonic-gate%.o:	../%.c
2377c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
2387c478bd9Sstevel@tonic-gate
239*16070783SVladimir Kotal%.o:	../../../../common/net/patricia/%.c
240c793af95Ssangeeta	$(COMPILE.c) $<
241c793af95Ssangeeta
2427c478bd9Sstevel@tonic-gateinclude ../../../Makefile.targ
2437c478bd9Sstevel@tonic-gate
2447c478bd9Sstevel@tonic-gateFRC:
245