xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/Makefile (revision c2785286330b58810071fc24f6ca69f401682dff)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
545916cd2Sjpk# Common Development and Distribution License (the "License").
645916cd2Sjpk# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
214e5b757fSkupfer
227c478bd9Sstevel@tonic-gate#
234045d941Ssowmini# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate#
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gateSYNCPROG=	syncinit syncloop syncstat
307c478bd9Sstevel@tonic-gateDHCPPROG=	dhcpconfig dhtadm pntadm
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gate# EXPORT DELETE START
337c478bd9Sstevel@tonic-gateXMODPROG=	wanbootutil
347c478bd9Sstevel@tonic-gate# EXPORT DELETE END
357c478bd9Sstevel@tonic-gate
36e3320f40SmarkfenPROG=		6to4relay arp gettable if_mpadm \
37a192e900Samaguire		in.comsat in.fingerd in.rarpd in.rexecd in.rlogind \
3840537fccSgd		in.rshd in.rwhod in.telnetd in.tftpd ipaddrsel \
39e3320f40Smarkfen		ndd $(SYNCPROG) $(DHCPPROG) $(XMODPROG)
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gateMANIFEST=	rarp.xml telnet.xml comsat.xml finger.xml \
4240537fccSgd		login.xml shell.xml rexec.xml
437c478bd9Sstevel@tonic-gate
44a192e900SamaguireROOTFS_PROG=	hostconfig route soconfig
45a192e900SamaguireSBINLINKS=	hostconfig route
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gateRPCSVCPROG=	hostconfig
487c478bd9Sstevel@tonic-gateAUDITPROG=	in.rexecd in.rlogind in.rshd in.telnetd
497c478bd9Sstevel@tonic-gatePAMPROG=	in.rexecd in.rlogind in.rshd in.telnetd
507c478bd9Sstevel@tonic-gateSOCKETPROG=	6to4relay arp gettable hostconfig if_mpadm in.comsat \
51a192e900Samaguire		in.fingerd in.rarpd in.rexecd in.rlogind in.rshd \
52e3320f40Smarkfen		in.rwhod in.telnetd in.tftpd ipaddrsel route
53e3320f40SmarkfenNSLPROG=	6to4relay arp gettable hostconfig in.comsat in.rarpd \
54a192e900Samaguire		in.rexecd in.rlogind in.rshd in.rwhod in.telnetd \
55e3320f40Smarkfen		in.tftpd ipaddrsel route
567c478bd9Sstevel@tonic-gateCMDPROG=	in.telnetd
577c478bd9Sstevel@tonic-gateK5PROGS=	in.telnetd in.rlogind in.rshd
5845916cd2SjpkTSNETPROG=	route
59a7872406SmeemDEFAULTFILES=	telnetd.dfl
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gatePROGSRCS=	$(PROG:%=%.c)
627c478bd9Sstevel@tonic-gateTFTPDOBJS=	in.tftpd.o tftpsubs.o
637c478bd9Sstevel@tonic-gateOTHERSRC=	../usr.bin/tftp/tftpsubs.c
647c478bd9Sstevel@tonic-gateK5RLOGINOBJS=	in.rlogind.o
657c478bd9Sstevel@tonic-gateK5RSHDOBJS=	in.rshd.o
6632885d59SgtbK5TELNETOBJS=	in.telnetd.o
677c478bd9Sstevel@tonic-gateSRCS=		$(PROGSRCS) $(OTHERSRC)
687c478bd9Sstevel@tonic-gate
69a192e900SamaguireSUBDIRS=	bootconfchk htable ifconfig in.ftpd in.rdisc in.routed \
705c0b7edeSseb		in.talkd inetadm inetconv ipqosconf kssl/kssladm kssl/ksslcfg \
715c0b7edeSseb		ping routeadm snoop sppptun traceroute wificonfig ipsecutils
727c478bd9Sstevel@tonic-gate
735c0b7edeSsebMSGSUBDIRS=	bootconfchk htable ifconfig in.ftpd in.routed in.talkd inetadm \
745c0b7edeSseb		inetconv ipqosconf kssl/ksslcfg routeadm sppptun snoop \
755c0b7edeSseb		wificonfig
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gate# As programs get lint-clean, add them here and to the 'lint' target.
787c478bd9Sstevel@tonic-gate# Eventually this hack should go away, and all in PROG should be
797c478bd9Sstevel@tonic-gate# lint-clean.
80e3320f40SmarkfenLINTCLEAN=	6to4relay arp in.rlogind in.rshd in.telnetd in.tftpd \
81e3320f40Smarkfen		ipaddrsel route \
824b908718Smeem		in.rarpd if_mpadm $(SYNCPROG)
837c478bd9Sstevel@tonic-gate# Likewise, as subdirs get lint-clean, add them here.  Once
847c478bd9Sstevel@tonic-gate# they're all clean, replace the dependency of the lint target
857c478bd9Sstevel@tonic-gate# with SUBDIRS.  Also (sigh) deal with the commented-out build lines
867c478bd9Sstevel@tonic-gate# for the lint rule.
87a192e900SamaguireLINTSUBDIRS=	bootconfchk in.rdisc in.routed in.talkd inetadm inetconv \
885c0b7edeSseb		ipqosconf ping routeadm sppptun traceroute wificonfig ipsecutils
897c478bd9Sstevel@tonic-gate# And as programs are verified not to attempt to write into constants,
907c478bd9Sstevel@tonic-gate# -xstrconst should be used to ensure they stay that way.
91e3320f40SmarkfenCONSTCLEAN=
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gateinclude ../../Makefile.cmd
947c478bd9Sstevel@tonic-gateROOTMANIFESTDIR=	$(ROOTSVCNETWORK)
957c478bd9Sstevel@tonic-gate$(ROOTMANIFEST)		:= FILEMODE= 444
967c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd-inet
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gateROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
997c478bd9Sstevel@tonic-gateROOTUSRSBINLINKS = $(SBINLINKS:%=$(ROOTUSRSBIN)/%)
1007c478bd9Sstevel@tonic-gate
10132885d59SgtbCOMMONOBJS=	addr_match.o kcmd.o store_forw_creds.o
1027243fb49SjbeckCOMMONSRCS=	$(COMMONOBJS:%.o=$(CMDINETCOMMONDIR)/%.c)
1037c478bd9Sstevel@tonic-gateSRCS+=		$(COMMONSRCS)
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gate#
1067c478bd9Sstevel@tonic-gate# Message catalog
1077c478bd9Sstevel@tonic-gate#
108e3320f40SmarkfenPOFILES=	6to4relay.po if_mpadm.po in.comsat.po ipaddrsel.po route.po
1097c478bd9Sstevel@tonic-gatePOFILE=		usr.sbin.po
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gateall:=		TARGET= all
1127c478bd9Sstevel@tonic-gateinstall:=	TARGET= install
1137c478bd9Sstevel@tonic-gateclean:=		TARGET= clean
1147c478bd9Sstevel@tonic-gateclobber:=	TARGET= clobber
1157c478bd9Sstevel@tonic-gatelint:=		TARGET= lint
1167c478bd9Sstevel@tonic-gate_msg:=		TARGET= _msg
1177c478bd9Sstevel@tonic-gate
118*c2785286SgtbCLOBBERFILES +=	$(ROOTFS_PROG) $(PROG)
1197c478bd9Sstevel@tonic-gateCLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS)
1207c478bd9Sstevel@tonic-gate
121a192e900SamaguireCPPFLAGS +=	-DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
1227c478bd9Sstevel@tonic-gate
1237c478bd9Sstevel@tonic-gateinclude $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
1247c478bd9Sstevel@tonic-gateK5LIBS=
1257c478bd9Sstevel@tonic-gate
1267c478bd9Sstevel@tonic-gate# Eventually just plain CFLAGS should be += -v, but not until all in
1277c478bd9Sstevel@tonic-gate# PROGS are lint clean.
1287c478bd9Sstevel@tonic-gate$(LINTCLEAN)		:=	CFLAGS += $(CCVERBOSE)
1297c478bd9Sstevel@tonic-gate$(CONSTCLEAN)		:=	CFLAGS += $(XSTRCONST)
1307c478bd9Sstevel@tonic-gate
1317c478bd9Sstevel@tonic-gate$(SYNCPROG)		:=	LDLIBS += -ldlpi
1327c478bd9Sstevel@tonic-gate$(SOCKETPROG)		:=	LDLIBS += -lsocket
1337c478bd9Sstevel@tonic-gate$(NSLPROG)		:=	LDLIBS += -lnsl
1347c478bd9Sstevel@tonic-gate$(AUDITPROG)		:=	LDLIBS += -lbsm
1357c478bd9Sstevel@tonic-gate$(PAMPROG)		:=	LDLIBS += -lpam
1367c478bd9Sstevel@tonic-gate$(RPCSVCPROG)		:=	LDLIBS += -lrpcsvc
13767e3a03eSrie$(K5PROGS)		:=	LDFLAGS += $(KRUNPATH) \
1387c478bd9Sstevel@tonic-gate				-L$(ROOT)$(KLIBDIR_DO) -L$(ROOT)$(KLIBDIR_GL)
1397c478bd9Sstevel@tonic-gate$(K5PROGS)		:=	K5LIBS=  -lmech_krb5
1407c478bd9Sstevel@tonic-gate$(K5PROGS)		:=	CPPFLAGS += -I$(SRC)/head \
1417c478bd9Sstevel@tonic-gate				-I$(SRC)/uts/common/ \
1427c478bd9Sstevel@tonic-gate				-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
1437c478bd9Sstevel@tonic-gate				-I$(SRC)/lib/gss_mechs/mech_krb5/include \
1447c478bd9Sstevel@tonic-gate				-I$(SRC)/lib/pam_modules/krb5
1457c478bd9Sstevel@tonic-gateLDLIBS +=	$(K5LIBS)
14667e3a03eSrie$(TSNETPROG)		:=	LDLIBS += -ltsnet
1477c478bd9Sstevel@tonic-gate
148948f2876Sssin.rarpd		:=	LDLIBS += -linetutil -ldlpi
1497c478bd9Sstevel@tonic-gateroute			:=	CPPFLAGS += -DNDEBUG
1504045d941Ssowminindd			:=	LDLIBS += -ldladm
15124da5b34Sriegettable in.comsat	:=	LDFLAGS += $(MAPFILE.NGB:%=-M%)
1527c478bd9Sstevel@tonic-gate
1537c478bd9Sstevel@tonic-gate.KEEP_STATE:
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gate.PARALLEL:
1567c478bd9Sstevel@tonic-gate
1574e5b757fSkupferall: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
1587c478bd9Sstevel@tonic-gate
1597c478bd9Sstevel@tonic-gate#
1607c478bd9Sstevel@tonic-gate# message catalog
1617c478bd9Sstevel@tonic-gate#
1627c478bd9Sstevel@tonic-gate_msg: $(MSGSUBDIRS) $(POFILE)
1637c478bd9Sstevel@tonic-gate
1647c478bd9Sstevel@tonic-gatesyncutil: $(SYNCPROG)
1657c478bd9Sstevel@tonic-gate
1667c478bd9Sstevel@tonic-gate$(POFILE): $(POFILES)
1677c478bd9Sstevel@tonic-gate	$(RM) $@
1687c478bd9Sstevel@tonic-gate	cat $(POFILES) > $@
1697c478bd9Sstevel@tonic-gate
1707243fb49Sjbeck%.o: $(CMDINETCOMMONDIR)/%.c
1717243fb49Sjbeck	$(COMPILE.c) -o $@ $<
1727c478bd9Sstevel@tonic-gate
173*c2785286Sgtbin.telnetd: $(K5TELNETOBJS)
174*c2785286Sgtb	$(LINK.c) $(K5TELNETOBJS) -o $@ $(LDLIBS)
17532885d59Sgtb	$(POST_PROCESS)
17632885d59Sgtb
177*c2785286Sgtbin.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
178*c2785286Sgtb	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
1797c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1807c478bd9Sstevel@tonic-gate
181*c2785286Sgtbin.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
182*c2785286Sgtb	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
1837c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1847c478bd9Sstevel@tonic-gate
1857c478bd9Sstevel@tonic-gatein.tftpd: $(TFTPDOBJS)
1867c478bd9Sstevel@tonic-gate	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
1877c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1887c478bd9Sstevel@tonic-gate
1897c478bd9Sstevel@tonic-gatetftpsubs.o: $(OTHERSRC)
1907c478bd9Sstevel@tonic-gate	$(COMPILE.c) $(OTHERSRC) -o $@
1917c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
1927c478bd9Sstevel@tonic-gate
1937c478bd9Sstevel@tonic-gate$(ROOTUSRSBINLINKS):
1947c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
1957c478bd9Sstevel@tonic-gate
1967c478bd9Sstevel@tonic-gateinstall: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
1977c478bd9Sstevel@tonic-gate	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
1984e5b757fSkupfer	$(ROOTMANIFEST) THIRDPARTYLICENSE.arp
1994e5b757fSkupfer
2004e5b757fSkupferTHIRDPARTYLICENSE.arp: arp.c
2014e5b757fSkupfer	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
2024e5b757fSkupfer
2034e5b757fSkupferCLOBBERFILES += THIRDPARTYLICENSE.arp
2047c478bd9Sstevel@tonic-gate
2057c478bd9Sstevel@tonic-gate#
2067c478bd9Sstevel@tonic-gate# The reason this rule checks for the existence of the
2077c478bd9Sstevel@tonic-gate# Makefile is that some of the directories do not exist
2087c478bd9Sstevel@tonic-gate# in our exportable source builds.
2097c478bd9Sstevel@tonic-gate#
2107c478bd9Sstevel@tonic-gate$(SUBDIRS): FRC
2117c478bd9Sstevel@tonic-gate	@if [ -f $@/Makefile  ]; then \
2127c478bd9Sstevel@tonic-gate		cd $@; pwd; $(MAKE) $(TARGET); \
2137c478bd9Sstevel@tonic-gate	else \
2147c478bd9Sstevel@tonic-gate		true; \
2157c478bd9Sstevel@tonic-gate	fi
2167c478bd9Sstevel@tonic-gate
2177c478bd9Sstevel@tonic-gateFRC:
2187c478bd9Sstevel@tonic-gate
2197c478bd9Sstevel@tonic-gatecheck:	$(CHKMANIFEST)
2207c478bd9Sstevel@tonic-gate
2217c478bd9Sstevel@tonic-gateclean:	$(SUBDIRS)
2227c478bd9Sstevel@tonic-gate	-$(RM) $(CLEANFILES)
2237c478bd9Sstevel@tonic-gate
2247c478bd9Sstevel@tonic-gateclobber: $(SUBDIRS)
2257c478bd9Sstevel@tonic-gate	-$(RM) $(CLEANFILES) $(CLOBBERFILES)
2267c478bd9Sstevel@tonic-gate
2277c478bd9Sstevel@tonic-gatelint: $(LINTSUBDIRS)
2287c478bd9Sstevel@tonic-gate	$(LINT.c) 6to4relay.c $(LDLIBS) -lsocket -lnsl
2297c478bd9Sstevel@tonic-gate	$(LINT.c) arp.c $(LDLIBS) -lsocket -lnsl
2307c478bd9Sstevel@tonic-gate	@# $(LINT.c) in.rexecd.c $(LDLIBS) -lbsm -lpam
2317c478bd9Sstevel@tonic-gate	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
2327c478bd9Sstevel@tonic-gate		-I$(SRC)/head -I$(SRC)/uts/common/ \
2337c478bd9Sstevel@tonic-gate		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
2347c478bd9Sstevel@tonic-gate		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
2357c478bd9Sstevel@tonic-gate		-I$(SRC)/lib/pam_modules/krb5 \
2367c478bd9Sstevel@tonic-gate		in.rlogind.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
2377c478bd9Sstevel@tonic-gate	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
2387c478bd9Sstevel@tonic-gate		-I$(SRC)/head -I$(SRC)/uts/common/ \
2397c478bd9Sstevel@tonic-gate		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
2407c478bd9Sstevel@tonic-gate		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
2417c478bd9Sstevel@tonic-gate		-I$(SRC)/lib/pam_modules/krb5 \
2427c478bd9Sstevel@tonic-gate		in.rshd.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
2437c478bd9Sstevel@tonic-gate	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 \
2447c478bd9Sstevel@tonic-gate		-erroff=E_GLOBAL_COULD_BE_STATIC2 \
2457c478bd9Sstevel@tonic-gate		-I$(SRC)/head -I$(SRC)/uts/common/ \
2467c478bd9Sstevel@tonic-gate		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
2477c478bd9Sstevel@tonic-gate		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
2487c478bd9Sstevel@tonic-gate		-I$(SRC)/lib/pam_modules/krb5 \
2497c478bd9Sstevel@tonic-gate		in.telnetd.c $(LDLIBS) -lbsm -lpam -lsocket -lnsl
2504b908718Smeem	$(LINT.c) if_mpadm.c $(LDLIBS) -lsocket -lnsl -lipmp
2517c478bd9Sstevel@tonic-gate	$(LINT.c) ipaddrsel.c $(LDLIBS) -lsocket -lnsl
25245916cd2Sjpk	$(LINT.c) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
2537c478bd9Sstevel@tonic-gate	$(LINT.c) syncinit.c $(LDLIBS) -ldlpi
2547c478bd9Sstevel@tonic-gate	$(LINT.c) syncloop.c $(LDLIBS) -ldlpi
2557c478bd9Sstevel@tonic-gate	$(LINT.c) syncstat.c $(LDLIBS) -ldlpi
2567c478bd9Sstevel@tonic-gate	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 in.rarpd.c $(LDLIBS) \
2577c478bd9Sstevel@tonic-gate	    -lsocket -lnsl
2587c478bd9Sstevel@tonic-gate	$(LINT.c) in.tftpd.c ../usr.bin/tftp/tftpsubs.c $(LDLIBS) \
2597c478bd9Sstevel@tonic-gate	    -lsocket -lnsl
2607c478bd9Sstevel@tonic-gate
2617c478bd9Sstevel@tonic-gate# EXPORT DELETE START
2627c478bd9Sstevel@tonic-gateEXPORT_SRC:
2637c478bd9Sstevel@tonic-gate	$(RM) Makefile+
2647c478bd9Sstevel@tonic-gate	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
2657c478bd9Sstevel@tonic-gate		< Makefile > Makefile+
2667c478bd9Sstevel@tonic-gate	$(RM) Makefile
2677c478bd9Sstevel@tonic-gate	$(MV) Makefile+ Makefile
2687c478bd9Sstevel@tonic-gate	$(CHMOD) 444 Makefile
2697c478bd9Sstevel@tonic-gate# EXPORT DELETE END
270