xref: /titanic_53/usr/src/cmd/ipf/tools/Makefile.tools (revision f4b3ec61df05330d25f55a36b975b4d7519fdeb1)
17c478bd9Sstevel@tonic-gate#
2*f4b3ec61Sdh155122# CDDL HEADER START
3*f4b3ec61Sdh155122#
4*f4b3ec61Sdh155122# The contents of this file are subject to the terms of the
5*f4b3ec61Sdh155122# Common Development and Distribution License (the "License").
6*f4b3ec61Sdh155122# You may not use this file except in compliance with the License.
7*f4b3ec61Sdh155122#
8*f4b3ec61Sdh155122# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*f4b3ec61Sdh155122# or http://www.opensolaris.org/os/licensing.
10*f4b3ec61Sdh155122# See the License for the specific language governing permissions
11*f4b3ec61Sdh155122# and limitations under the License.
12*f4b3ec61Sdh155122#
13*f4b3ec61Sdh155122# When distributing Covered Code, include this CDDL HEADER in each
14*f4b3ec61Sdh155122# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*f4b3ec61Sdh155122# If applicable, add the following below this CDDL HEADER, with the
16*f4b3ec61Sdh155122# fields enclosed by brackets "[]" replaced with your own identifying
17*f4b3ec61Sdh155122# information: Portions Copyright [yyyy] [name of copyright owner]
18*f4b3ec61Sdh155122#
19*f4b3ec61Sdh155122# CDDL HEADER END
20*f4b3ec61Sdh155122#
21*f4b3ec61Sdh155122#
22*f4b3ec61Sdh155122# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate#
26734b6a94Sdarrenm# ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate#
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gatePROG=		ipf ipfs ipmon ipnat ippool ipfstat
307c478bd9Sstevel@tonic-gateIPFPROG=	ipftest
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gateIPF_OBJS=	ipf.o ipfcomp.o ipf_y.o ipf_l.o
337c478bd9Sstevel@tonic-gateIPFS_OBJS=	ipfs.o
347c478bd9Sstevel@tonic-gateIPFSTAT_OBJS=	ipfstat.o
357c478bd9Sstevel@tonic-gateIPMON_OBJS=	ipmon.o ipmon_y.o ipmon_l.o
367c478bd9Sstevel@tonic-gateIPNAT_OBJS=	ipnat.o ipnat_y.o ipnat_l.o
377c478bd9Sstevel@tonic-gateIPPOOL_OBJS=	ippool.o ippool_y.o ippool_l.o
387c478bd9Sstevel@tonic-gateIPFTEST_OBJS=	ipftest.o  \
397c478bd9Sstevel@tonic-gate		ip_fil.o ip_state.o \
407c478bd9Sstevel@tonic-gate		ip_frag.o ip_nat.o fil.o \
417c478bd9Sstevel@tonic-gate		ip_htable.o ip_lookup.o \
427c478bd9Sstevel@tonic-gate		ip_proxy.o ip_auth.o ip_log.o \
437c478bd9Sstevel@tonic-gate		ipf_y.o ipf_l.o \
447c478bd9Sstevel@tonic-gate		ipnat_y.o ipnat_l.o \
457c478bd9Sstevel@tonic-gate		ippool_y.o ippool_l.o \
467c478bd9Sstevel@tonic-gate		ip_pool.o radix.o
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gateOBJS=		$(IPF_OBJS) $(IPFS_OBJS) $(IPFSTAT_OBJS) \
497c478bd9Sstevel@tonic-gate		$(IPMON_OBJS) $(IPNAT_OBJS) $(IPFTEST_OBJS)
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gateOBJSL=		$(IPF_OBJS) $(IPFS_OBJS) $(IPFSTAT_OBJS) \
527c478bd9Sstevel@tonic-gate		$(IPMON_OBJS) $(IPNAT_OBJS)
537c478bd9Sstevel@tonic-gate
547c478bd9Sstevel@tonic-gateSRCS=		$(OBJSL:%.o=../%.c)
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gateinclude ../../../Makefile.cmd
577c478bd9Sstevel@tonic-gateinclude ../../Makefile.ipf
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gateLDLIBS		+= $(LIBBPF)
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gateCPPFLAGS	+= -I. -DIPFILTER_LOOKUP -DIPFILTER_LOG
627c478bd9Sstevel@tonic-gate
637c478bd9Sstevel@tonic-gateipfstat.o	:=	CPPFLAGS += -DSTATETOP
647c478bd9Sstevel@tonic-gateipfstat		:=	LDLIBS += -lcurses
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gateipf		:=	LDLIBS += -lsocket -lnsl
67734b6a94Sdarrenmipftest		:=	LDLIBS += -lsocket -lnsl -lmd
687c478bd9Sstevel@tonic-gateipfstat		:=	LDLIBS += -lsocket -lnsl -lkvm -lelf
697c478bd9Sstevel@tonic-gateipmon		:=	LDLIBS += -lsocket -lnsl
707c478bd9Sstevel@tonic-gateipnat		:=	LDLIBS += -lsocket -lnsl -lkvm -lelf
71*f4b3ec61Sdh155122ippool		:=	LDLIBS += -lsocket -lnsl -lkvm -lelf
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gateCLEANFILES	+= $(OBJS)
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gateROOTIPF=	$(ROOTLIB)/ipf
767c478bd9Sstevel@tonic-gateROOTIPF32=	$(ROOTIPF)/$(MACH32)
777c478bd9Sstevel@tonic-gateROOTIPF64=	$(ROOTIPF)/$(MACH64)
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gateROOTIPFPROG32=	$(IPFPROG:%=$(ROOTIPF32)/%)
807c478bd9Sstevel@tonic-gateROOTIPFPROG64=	$(IPFPROG:%=$(ROOTIPF64)/%)
817c478bd9Sstevel@tonic-gate
827c478bd9Sstevel@tonic-gateROOTIPFLINKS=		$(IPFPROG:%=$(ROOTIPF)/%)
837c478bd9Sstevel@tonic-gateROOTUSRSBINLINKS=	$(PROG:%=$(ROOTUSRSBIN)/%)
847c478bd9Sstevel@tonic-gate
857c478bd9Sstevel@tonic-gate$(ROOTIPF32):
867c478bd9Sstevel@tonic-gate	$(INS.dir)
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gate$(ROOTIPF64):
897c478bd9Sstevel@tonic-gate	$(INS.dir)
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gate$(ROOTIPF)/%: %
927c478bd9Sstevel@tonic-gate	$(INS.file)
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate$(ROOTIPF32)/%: %
957c478bd9Sstevel@tonic-gate	$(INS.file)
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate$(ROOTIPF64)/%: %
987c478bd9Sstevel@tonic-gate	$(INS.file)
997c478bd9Sstevel@tonic-gate
1007c478bd9Sstevel@tonic-gate$(ROOTUSRSBINLINKS): FRC
1017c478bd9Sstevel@tonic-gate	-$(RM) $@; $(LN) $(ISAEXEC) $@
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gate$(ROOTIPFLINKS): FRC
1047c478bd9Sstevel@tonic-gate	-$(RM) $@; $(LN) $(ISAEXEC) $@
1057c478bd9Sstevel@tonic-gate
1067c478bd9Sstevel@tonic-gate
1077c478bd9Sstevel@tonic-gate.KEEP_STATE:
1087c478bd9Sstevel@tonic-gate
1097c478bd9Sstevel@tonic-gateipf:	$(IPF_OBJS) $(LIBIPF)
1107c478bd9Sstevel@tonic-gate	$(LINK.c) -o ipf $(IPF_OBJS) $(LDLIBS)
1117c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1127c478bd9Sstevel@tonic-gate
113ab25eeb5Syz155240ipf_y.o: ../ipf_y.c $(COMMONIPF)/netinet/ip_fil.h $(COMMONIPF)/ipf.h \
1147c478bd9Sstevel@tonic-gate	../ipf_y.c ../ipf_l.h
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gate../ipf_y.c ../ipf_y.h: ../ipf_y.y
1177c478bd9Sstevel@tonic-gate	$(YACC) -d -b ipf ../ipf_y.y
1187c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipf_yy/g' -e 's/y.tab.h/ipf_y.c/' \
1197c478bd9Sstevel@tonic-gate	   ipf.tab.c > ../ipf_y.c
1207c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipf_yy/g' -e 's/y.tab.h/ipf_y.h/' \
1217c478bd9Sstevel@tonic-gate	   ipf.tab.h > ../ipf_y.h
1227c478bd9Sstevel@tonic-gate
123ab25eeb5Syz155240ipf_l.o: ../ipf_l.c $(COMMONIPF)/netinet/ip_fil.h $(COMMONIPF)/ipf.h  \
1247c478bd9Sstevel@tonic-gate	 ../ipf_y.h ../ipf_l.h
1257c478bd9Sstevel@tonic-gate	$(COMPILE.c) ../ipf_l.c -o $@
1267c478bd9Sstevel@tonic-gate
127ab25eeb5Syz155240../ipf_l.c: ../lexer.c $(COMMONIPF)/ipf.h $(COMMONIPF)/netinet/ip_fil.h
1287c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipf_yy/g' -e 's/y.tab.h/ipf_y.h/' \
1297c478bd9Sstevel@tonic-gate	       -e 's/lexer.h/ipf_l.h/' ../lexer.c > $@
1307c478bd9Sstevel@tonic-gate
1317c478bd9Sstevel@tonic-gate../ipf_l.h: ../lexer.h
1327c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipf_yy/g' ../lexer.h > $@
1337c478bd9Sstevel@tonic-gate
1347c478bd9Sstevel@tonic-gateipfs:	$(IPFS_OBJS)
1357c478bd9Sstevel@tonic-gate	$(LINK.c) -o ipfs $(IPFS_OBJS) $(LDLIBS)
1367c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gateipfstat:	$(IPFSTAT_OBJS)
1397c478bd9Sstevel@tonic-gate	$(LINK.c) -o ipfstat $(IPFSTAT_OBJS) $(LDLIBS)
1407c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1417c478bd9Sstevel@tonic-gate
1427c478bd9Sstevel@tonic-gateipmon:	$(IPMON_OBJS) $(LIBIPF)
1437c478bd9Sstevel@tonic-gate	$(LINK.c) -o ipmon $(IPMON_OBJS) $(LDLIBS)
1447c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1457c478bd9Sstevel@tonic-gate
1467c478bd9Sstevel@tonic-gateipmon_y.o: ../ipmon_y.c $(COMMONIPF)/ipmon.h \
1477c478bd9Sstevel@tonic-gate	../ipmon_y.h ../ipmon_l.h
1487c478bd9Sstevel@tonic-gate
1497c478bd9Sstevel@tonic-gate../ipmon_y.c ../ipmon_y.h: ../ipmon_y.y
1507c478bd9Sstevel@tonic-gate	$(YACC) -d -b ipmon ../ipmon_y.y
1517c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipmon_yy/g' \
1527c478bd9Sstevel@tonic-gate	    -e 's/extern [a-z]* .*();//' \
1537c478bd9Sstevel@tonic-gate	    -e 's/^\(static [a-z]* .*\)();/\1(void);/' \
1547c478bd9Sstevel@tonic-gate	   ipmon.tab.c > ../ipmon_y.c
1557c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipmon_yy/g' -e 's/y.tab.h/ipmon_y.h/' \
1567c478bd9Sstevel@tonic-gate	   ipmon.tab.h > ../ipmon_y.h
1577c478bd9Sstevel@tonic-gate
1587c478bd9Sstevel@tonic-gateipmon_l.o: ../ipmon_l.c $(COMMONIPF)/ipmon.h ../ipmon_y.h ../ipmon_l.h
1597c478bd9Sstevel@tonic-gate	$(COMPILE.c) ../ipmon_l.c -o $@
1607c478bd9Sstevel@tonic-gate
1617c478bd9Sstevel@tonic-gate../ipmon_l.c: ../lexer.c $(COMMONIPF)/ipmon.h
1627c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipmon_yy/g' -e 's/y.tab.h/ipmon_y.h/' \
1637c478bd9Sstevel@tonic-gate            -e 's/lexer.h/ipmon_l.h/' ../lexer.c > $@
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gate../ipmon_l.h: ../lexer.h
1667c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipmon_yy/g' ../lexer.h > $@
1677c478bd9Sstevel@tonic-gate
1687c478bd9Sstevel@tonic-gateipnat:	$(IPNAT_OBJS) $(LIBIPF)
1697c478bd9Sstevel@tonic-gate	$(LINK.c) -o ipnat $(IPNAT_OBJS) $(LDLIBS)
1707c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1717c478bd9Sstevel@tonic-gate
172ab25eeb5Syz155240ipnat_y.o: ../ipnat_y.c $(COMMONIPF)/netinet/ip_nat.h \
1737c478bd9Sstevel@tonic-gate	../ipnat_y.h ../ipnat_l.h
1747c478bd9Sstevel@tonic-gate
1757c478bd9Sstevel@tonic-gate../ipnat_y.c ../ipnat_y.h: ../ipnat_y.y
1767c478bd9Sstevel@tonic-gate	$(YACC) -d -b ipnat ../ipnat_y.y
1777c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipnat_yy/g' \
1787c478bd9Sstevel@tonic-gate	    -e 's/extern [a-z]* .*();//' \
1797c478bd9Sstevel@tonic-gate	    -e 's/^\(static [a-z]* .*\)();/\1(void);/' \
1807c478bd9Sstevel@tonic-gate	   ipnat.tab.c > ../ipnat_y.c
1817c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipnat_yy/g' -e 's/y.tab.h/ipnat_y.h/' \
1827c478bd9Sstevel@tonic-gate	   ipnat.tab.h > ../ipnat_y.h
1837c478bd9Sstevel@tonic-gate
184ab25eeb5Syz155240ipnat_l.o: ../ipnat_l.c $(COMMONIPF)/netinet/ip_nat.h ../ipnat_l.h
1857c478bd9Sstevel@tonic-gate	$(COMPILE.c) ../ipnat_l.c -o $@
1867c478bd9Sstevel@tonic-gate
187ab25eeb5Syz155240../ipnat_l.c: ../lexer.c $(COMMONIPF)/netinet/ip_nat.h
1887c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipnat_yy/g' -e 's/y.tab.h/ipnat_y.h/' \
1897c478bd9Sstevel@tonic-gate	       -e 's/lexer.h/ipnat_l.h/' ../lexer.c > $@
1907c478bd9Sstevel@tonic-gate
1917c478bd9Sstevel@tonic-gate../ipnat_l.h: ../lexer.h
1927c478bd9Sstevel@tonic-gate	sed -e 's/yy/ipnat_yy/g' ../lexer.h > $@
1937c478bd9Sstevel@tonic-gate
1947c478bd9Sstevel@tonic-gateippool:	$(IPPOOL_OBJS) $(LIBIPF)
1957c478bd9Sstevel@tonic-gate	$(LINK.c) -o ippool $(IPPOOL_OBJS) $(LDLIBS)
1967c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1977c478bd9Sstevel@tonic-gate
198ab25eeb5Syz155240ippool_y.o: ../ippool_y.c $(COMMONIPF)/netinet/ip_pool.h \
1997c478bd9Sstevel@tonic-gate	../ippool_y.h ../ippool_l.h
2007c478bd9Sstevel@tonic-gate
2017c478bd9Sstevel@tonic-gate../ippool_y.c ../ippool_y.h: ../ippool_y.y
2027c478bd9Sstevel@tonic-gate	$(YACC) -d -b ippool ../ippool_y.y
2037c478bd9Sstevel@tonic-gate	sed -e 's/yy/ippool_yy/g' \
2047c478bd9Sstevel@tonic-gate	    -e 's/extern [a-z]* .*();//' \
2057c478bd9Sstevel@tonic-gate	    -e 's/^\(static [a-z]* .*\)();/\1(void);/' \
2067c478bd9Sstevel@tonic-gate	   ippool.tab.c > ../ippool_y.c
2077c478bd9Sstevel@tonic-gate	sed -e 's/yy/ippool_yy/g' -e 's/y.tab.h/ippool_y.h/' \
2087c478bd9Sstevel@tonic-gate	   ippool.tab.h > ../ippool_y.h
2097c478bd9Sstevel@tonic-gate
210ab25eeb5Syz155240ippool_l.o: ../ippool_l.c $(COMMONIPF)/netinet/ip_pool.h ../ippool_l.h
2117c478bd9Sstevel@tonic-gate	$(COMPILE.c) ../ippool_l.c -o $@
2127c478bd9Sstevel@tonic-gate
213ab25eeb5Syz155240../ippool_l.c: ../lexer.c $(COMMONIPF)/netinet/ip_pool.h
2147c478bd9Sstevel@tonic-gate	sed -e 's/yy/ippool_yy/g' -e 's/y.tab.h/ippool_y.h/' \
2157c478bd9Sstevel@tonic-gate	       -e 's/lexer.h/ippool_l.h/' ../lexer.c > $@
2167c478bd9Sstevel@tonic-gate
2177c478bd9Sstevel@tonic-gate../ippool_l.h: ../lexer.h
2187c478bd9Sstevel@tonic-gate	sed -e 's/yy/ippool_yy/g' ../lexer.h > $@
2197c478bd9Sstevel@tonic-gate
2207c478bd9Sstevel@tonic-gateipftest:	$(IPFTEST_OBJS) $(LIBIPF)
2217c478bd9Sstevel@tonic-gate	$(LINK.c) -zignore -o ipftest $(IPFTEST_OBJS) $(LDLIBS)
2227c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
2237c478bd9Sstevel@tonic-gate
2247c478bd9Sstevel@tonic-gateclean:
2257c478bd9Sstevel@tonic-gate	-$(RM) $(CLEANFILES)
2267c478bd9Sstevel@tonic-gate
2277c478bd9Sstevel@tonic-gatelint: 	lint_SRCS
2287c478bd9Sstevel@tonic-gate
229ab25eeb5Syz155240%.o:	$(SRC)/uts/common/inet/ipf/%.c
2307c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
2317c478bd9Sstevel@tonic-gate
2327c478bd9Sstevel@tonic-gate%.o:	../%.c
2337c478bd9Sstevel@tonic-gate	$(COMPILE.c) $<
2347c478bd9Sstevel@tonic-gate
235c793af95Ssangeeta%.o:	$(SRC)/common/net/patricia/%.c
236c793af95Ssangeeta	$(COMPILE.c) $<
237c793af95Ssangeeta
2387c478bd9Sstevel@tonic-gateinclude ../../../Makefile.targ
2397c478bd9Sstevel@tonic-gate
2407c478bd9Sstevel@tonic-gateFRC:
241