17c478bdstevel@tonic-gate#
27c478bdstevel@tonic-gate# CDDL HEADER START
37c478bdstevel@tonic-gate#
47c478bdstevel@tonic-gate# The contents of this file are subject to the terms of the
545916cdjpk# Common Development and Distribution License (the "License").
645916cdjpk# You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate#
87c478bdstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate# See the License for the specific language governing permissions
117c478bdstevel@tonic-gate# and limitations under the License.
127c478bdstevel@tonic-gate#
137c478bdstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate#
197c478bdstevel@tonic-gate# CDDL HEADER END
207c478bdstevel@tonic-gate#
214e5b757kupfer
227c478bdstevel@tonic-gate#
233e95bd4Anders Persson# Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
2490a455aGarrett D'Amore# Copyright 2014 Garrett D'Amore <garrett@damore.org>
2532e09e1John Levon# Copyright 2019, Joyent, Inc.
267c478bdstevel@tonic-gate#
277c478bdstevel@tonic-gate
287c478bdstevel@tonic-gateSYNCPROG=	syncinit syncloop syncstat
297c478bdstevel@tonic-gate
3090a455aGarrett D'AmorePROG=		6to4relay arp if_mpadm \
31a192e90amaguire		in.comsat in.fingerd in.rarpd in.rexecd in.rlogind \
3240537fcgd		in.rshd in.rwhod in.telnetd in.tftpd ipaddrsel \
33bf5d9f1Andy Fiddaman		ndd ndp $(SYNCPROG)
347c478bdstevel@tonic-gate
357c478bdstevel@tonic-gateMANIFEST=	rarp.xml telnet.xml comsat.xml finger.xml \
36dd49f12Anders Persson		login.xml shell.xml rexec.xml socket-filter-kssl.xml
373e95bd4Anders PerssonSVCMETHOD=	svc-sockfilter
387c478bdstevel@tonic-gate
39a192e90amaguireROOTFS_PROG=	hostconfig route soconfig
40a192e90amaguireSBINLINKS=	hostconfig route
417c478bdstevel@tonic-gate
427c478bdstevel@tonic-gateRPCSVCPROG=	hostconfig
437c478bdstevel@tonic-gateAUDITPROG=	in.rexecd in.rlogind in.rshd in.telnetd
447c478bdstevel@tonic-gatePAMPROG=	in.rexecd in.rlogind in.rshd in.telnetd
4590a455aGarrett D'AmoreSOCKETPROG=	6to4relay arp hostconfig if_mpadm in.comsat \
46a192e90amaguire		in.fingerd in.rarpd in.rexecd in.rlogind in.rshd \
47e7df776Cody Peter Mello		in.rwhod in.telnetd in.tftpd ipaddrsel ndp route
4890a455aGarrett D'AmoreNSLPROG=	6to4relay arp hostconfig in.comsat in.rarpd \
49a192e90amaguire		in.rexecd in.rlogind in.rshd in.rwhod in.telnetd \
50e7df776Cody Peter Mello		in.tftpd ipaddrsel ndp route
517c478bdstevel@tonic-gateCMDPROG=	in.telnetd
527c478bdstevel@tonic-gateK5PROGS=	in.telnetd in.rlogind in.rshd
5345916cdjpkTSNETPROG=	route
546e91bbaGirish MoodalbailDLADMPROG=	6to4relay
55a787240meemDEFAULTFILES=	telnetd.dfl
567c478bdstevel@tonic-gate
577c478bdstevel@tonic-gatePROGSRCS=	$(PROG:%=%.c)
587c478bdstevel@tonic-gateTFTPDOBJS=	in.tftpd.o tftpsubs.o
597c478bdstevel@tonic-gateOTHERSRC=	../usr.bin/tftp/tftpsubs.c
607c478bdstevel@tonic-gateK5RLOGINOBJS=	in.rlogind.o
617c478bdstevel@tonic-gateK5RSHDOBJS=	in.rshd.o
6232885d5gtbK5TELNETOBJS=	in.telnetd.o
637c478bdstevel@tonic-gateSRCS=		$(PROGSRCS) $(OTHERSRC)
647c478bdstevel@tonic-gate
65bf5d9f1Andy FiddamanSUBDIRS=	ifconfig ilbadm in.rdisc in.routed \
666e91bbaGirish Moodalbail		in.talkd inetadm inetconv ipadm ipmpstat ipqosconf ipsecutils \
676ba597cAnurag S. Maskey		kssl/kssladm kssl/ksslcfg nwamadm nwamcfg ping routeadm \
686ba597cAnurag S. Maskey		snoop sppptun traceroute wificonfig
697c478bdstevel@tonic-gate
70bf5d9f1Andy FiddamanMSGSUBDIRS=	ifconfig ilbadm in.routed in.talkd \
71dd49f12Anders Persson		inetadm inetconv ipadm ipmpstat ipqosconf ipsecutils \
72dd49f12Anders Persson		kssl/ksslcfg nwamadm nwamcfg routeadm sppptun snoop wificonfig
737c478bdstevel@tonic-gate
747c478bdstevel@tonic-gate# As programs get lint-clean, add them here and to the 'lint' target.
757c478bdstevel@tonic-gate# Eventually this hack should go away, and all in PROG should be
767c478bdstevel@tonic-gate# lint-clean.
77e3320f4markfenLINTCLEAN=	6to4relay arp in.rlogind in.rshd in.telnetd in.tftpd \
78e7df776Cody Peter Mello		ipaddrsel ndp route \
794b90871meem		in.rarpd if_mpadm $(SYNCPROG)
807c478bdstevel@tonic-gate# Likewise, as subdirs get lint-clean, add them here.  Once
817c478bdstevel@tonic-gate# they're all clean, replace the dependency of the lint target
827c478bdstevel@tonic-gate# with SUBDIRS.  Also (sigh) deal with the commented-out build lines
837c478bdstevel@tonic-gate# for the lint rule.
84bf5d9f1Andy FiddamanLINTSUBDIRS=	ilbadm in.rdisc in.routed in.talkd inetadm \
85dd49f12Anders Persson		inetconv ipmpstat ipqosconf ipsecutils kssl/kssladm \
86dd49f12Anders Persson		kssl/ksslcfg nwamadm nwamcfg ping routeadm sppptun traceroute \
87dd49f12Anders Persson		wificonfig
887c478bdstevel@tonic-gate# And as programs are verified not to attempt to write into constants,
897c478bdstevel@tonic-gate# -xstrconst should be used to ensure they stay that way.
90e3320f4markfenCONSTCLEAN=
917c478bdstevel@tonic-gate
927c478bdstevel@tonic-gateinclude ../../Makefile.cmd
937c478bdstevel@tonic-gateROOTMANIFESTDIR=	$(ROOTSVCNETWORK)
947c478bdstevel@tonic-gate$(ROOTMANIFEST)		:= FILEMODE= 444
957c478bdstevel@tonic-gateinclude ../Makefile.cmd-inet
967c478bdstevel@tonic-gate
977c478bdstevel@tonic-gateROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
987c478bdstevel@tonic-gateROOTUSRSBINLINKS = $(SBINLINKS:%=$(ROOTUSRSBIN)/%)
997c478bdstevel@tonic-gate
10032885d5gtbCOMMONOBJS=	addr_match.o kcmd.o store_forw_creds.o
1017243fb4jbeckCOMMONSRCS=	$(COMMONOBJS:%.o=$(CMDINETCOMMONDIR)/%.c)
1027c478bdstevel@tonic-gateSRCS+=		$(COMMONSRCS)
1037c478bdstevel@tonic-gate
1047014882Richard LoweCERRWARN += -_gcc=-Wno-implicit-function-declaration
105d3b5f56John LevonCERRWARN += $(CNOWARN_UNINIT)
1067014882Richard LoweCERRWARN += -_gcc=-Wno-unused-variable
1077014882Richard LoweCERRWARN += -_gcc=-Wno-unused-function
1087014882Richard LoweCERRWARN += -_gcc=-Wno-parentheses
1097014882Richard LoweCERRWARN += -_gcc=-Wno-char-subscripts
1107014882Richard LoweCERRWARN += -_gcc=-Wno-extra
1117014882Richard LoweCERRWARN += -_gcc=-Wno-address
1127014882Richard Lowe
1135661bb7John Levon# "missing type for func"
1145661bb7John LevonSMATCH=off
1155661bb7John Levon
1167c478bdstevel@tonic-gate#
1177c478bdstevel@tonic-gate# Message catalog
1187c478bdstevel@tonic-gate#
1193e95bd4Anders PerssonPOFILES=	6to4relay.po if_mpadm.po in.comsat.po ipaddrsel.po route.po \
1203e95bd4Anders Persson		soconfig.po
1217c478bdstevel@tonic-gatePOFILE=		usr.sbin.po
1227c478bdstevel@tonic-gate
1237c478bdstevel@tonic-gateall:=		TARGET= all
1247c478bdstevel@tonic-gateinstall:=	TARGET= install
1257c478bdstevel@tonic-gateclean:=		TARGET= clean
1267c478bdstevel@tonic-gateclobber:=	TARGET= clobber
1277c478bdstevel@tonic-gatelint:=		TARGET= lint
1287c478bdstevel@tonic-gate_msg:=		TARGET= _msg
1297c478bdstevel@tonic-gate
130c278528gtbCLOBBERFILES +=	$(ROOTFS_PROG) $(PROG)
131b6805bfGordon RossCLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS) \
132b6805bfGordon Ross		$(K5TELNETOBJS)
1337c478bdstevel@tonic-gate
134a192e90amaguireCPPFLAGS +=	-DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
1357c478bdstevel@tonic-gate
1367c478bdstevel@tonic-gateinclude $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
1377c478bdstevel@tonic-gateK5LIBS=
1387c478bdstevel@tonic-gate
1397c478bdstevel@tonic-gate# Eventually just plain CFLAGS should be += -v, but not until all in
1407c478bdstevel@tonic-gate# PROGS are lint clean.
1417c478bdstevel@tonic-gate$(LINTCLEAN)		:=	CFLAGS += $(CCVERBOSE)
1427c478bdstevel@tonic-gate$(CONSTCLEAN)		:=	CFLAGS += $(XSTRCONST)
1437c478bdstevel@tonic-gate
1447c478bdstevel@tonic-gate$(SYNCPROG)		:=	LDLIBS += -ldlpi
1457c478bdstevel@tonic-gate$(SOCKETPROG)		:=	LDLIBS += -lsocket
1467c478bdstevel@tonic-gate$(NSLPROG)		:=	LDLIBS += -lnsl
1477c478bdstevel@tonic-gate$(AUDITPROG)		:=	LDLIBS += -lbsm
1487c478bdstevel@tonic-gate$(PAMPROG)		:=	LDLIBS += -lpam
1497c478bdstevel@tonic-gate$(RPCSVCPROG)		:=	LDLIBS += -lrpcsvc
15067e3a03rie$(K5PROGS)		:=	LDFLAGS += $(KRUNPATH) \
1517c478bdstevel@tonic-gate				-L$(ROOT)$(KLIBDIR_DO) -L$(ROOT)$(KLIBDIR_GL)
1527c478bdstevel@tonic-gate$(K5PROGS)		:=	K5LIBS=  -lmech_krb5
1537c478bdstevel@tonic-gate$(K5PROGS)		:=	CPPFLAGS += -I$(SRC)/head \
1547c478bdstevel@tonic-gate				-I$(SRC)/uts/common/ \
1557c478bdstevel@tonic-gate				-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
1567c478bdstevel@tonic-gate				-I$(SRC)/lib/gss_mechs/mech_krb5/include \
1577c478bdstevel@tonic-gate				-I$(SRC)/lib/pam_modules/krb5
1587c478bdstevel@tonic-gateLDLIBS +=	$(K5LIBS)
15967e3a03rie$(TSNETPROG)		:=	LDLIBS += -ltsnet
1602b24ab6Sebastien Roy$(DLADMPROG)		:=	LDLIBS += -ldladm
1617c478bdstevel@tonic-gate
162948f287ssin.rarpd		:=	LDLIBS += -linetutil -ldlpi
163e11c3f4meemif_mpadm		:=	LDLIBS += -linetutil -lipmp
164e11c3f4meemif_mpadm.po		:=	XGETFLAGS += -a
1657c478bdstevel@tonic-gateroute			:=	CPPFLAGS += -DNDEBUG
1666e91bbaGirish Moodalbailndd			:=	LDLIBS += -ldladm -lipadm
16732e09e1John Levon$(RELEASE_BUILD)ndd	:=	CERRWARN += -_gcc=-Wno-unused
16890a455aGarrett D'Amorein.comsat		:=	LDFLAGS += $(MAPFILE.NGB:%=-M%)
1697c478bdstevel@tonic-gate
1707c478bdstevel@tonic-gate.KEEP_STATE:
1717c478bdstevel@tonic-gate
1727c478bdstevel@tonic-gate.PARALLEL:
1737c478bdstevel@tonic-gate
1744e5b757kupferall: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
1757c478bdstevel@tonic-gate
1767c478bdstevel@tonic-gate#
1777c478bdstevel@tonic-gate# message catalog
1787c478bdstevel@tonic-gate#
1797c478bdstevel@tonic-gate_msg: $(MSGSUBDIRS) $(POFILE)
1807c478bdstevel@tonic-gate
1817c478bdstevel@tonic-gatesyncutil: $(SYNCPROG)
1827c478bdstevel@tonic-gate
1837c478bdstevel@tonic-gate$(POFILE): $(POFILES)
1847c478bdstevel@tonic-gate	$(RM) $@
1857c478bdstevel@tonic-gate	cat $(POFILES) > $@
1867c478bdstevel@tonic-gate
1877243fb4jbeck%.o: $(CMDINETCOMMONDIR)/%.c
1887243fb4jbeck	$(COMPILE.c) -o $@ $<
1897c478bdstevel@tonic-gate
190c278528gtbin.telnetd: $(K5TELNETOBJS)
191c278528gtb	$(LINK.c) $(K5TELNETOBJS) -o $@ $(LDLIBS)
19232885d5gtb	$(POST_PROCESS)
19332885d5gtb
194c278528gtbin.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
195c278528gtb	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
1967c478bdstevel@tonic-gate	$(POST_PROCESS)
1977c478bdstevel@tonic-gate
198c278528gtbin.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
199c278528gtb	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
2007c478bdstevel@tonic-gate	$(POST_PROCESS)
2017c478bdstevel@tonic-gate
2027c478bdstevel@tonic-gatein.tftpd: $(TFTPDOBJS)
2037c478bdstevel@tonic-gate	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
2047c478bdstevel@tonic-gate	$(POST_PROCESS)
2057c478bdstevel@tonic-gate
2067c478bdstevel@tonic-gatetftpsubs.o: $(OTHERSRC)
2077c478bdstevel@tonic-gate	$(COMPILE.c) $(OTHERSRC) -o $@
2087c478bdstevel@tonic-gate	$(POST_PROCESS_O)
2097c478bdstevel@tonic-gate
2107c478bdstevel@tonic-gate$(ROOTUSRSBINLINKS):
2117c478bdstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
2127c478bdstevel@tonic-gate
2137c478bdstevel@tonic-gateinstall: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
2147c478bdstevel@tonic-gate	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
2153e95bd4Anders Persson	$(ROOTMANIFEST) $(ROOTSVCMETHOD) THIRDPARTYLICENSE.arp
2164e5b757kupfer
2174e5b757kupferTHIRDPARTYLICENSE.arp: arp.c
2184e5b757kupfer	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
2194e5b757kupfer
2204e5b757kupferCLOBBERFILES += THIRDPARTYLICENSE.arp
2217c478bdstevel@tonic-gate
2227c478bdstevel@tonic-gate#
2237c478bdstevel@tonic-gate# The reason this rule checks for the existence of the
2247c478bdstevel@tonic-gate# Makefile is that some of the directories do not exist
2257c478bdstevel@tonic-gate# in our exportable source builds.
2267c478bdstevel@tonic-gate#
2277c478bdstevel@tonic-gate$(SUBDIRS): FRC
2287c478bdstevel@tonic-gate	@if [ -f $@/Makefile  ]; then \
2297c478bdstevel@tonic-gate		cd $@; pwd; $(MAKE) $(TARGET); \
2307c478bdstevel@tonic-gate	else \
2317c478bdstevel@tonic-gate		true; \
2327c478bdstevel@tonic-gate	fi
2337c478bdstevel@tonic-gate
2347c478bdstevel@tonic-gateFRC:
2357c478bdstevel@tonic-gate
2367c478bdstevel@tonic-gatecheck:	$(CHKMANIFEST)
2377c478bdstevel@tonic-gate
238b6805bfGordon Rossclean: $(SUBDIRS) clean_local
239b6805bfGordon Rossclean_local:
240b6805bfGordon Ross	$(RM) $(CLEANFILES)
2417c478bdstevel@tonic-gate
242b6805bfGordon Rossclobber: $(SUBDIRS) clobber_local
243b6805bfGordon Rossclobber_local: clean_local
244b6805bfGordon Ross	$(RM) $(CLOBBERFILES)
2457c478bdstevel@tonic-gate
2467c478bdstevel@tonic-gatelint: $(LINTSUBDIRS)
2472b24ab6Sebastien Roy	$(LINT.c) 6to4relay.c $(LDLIBS) -lsocket -ldladm
2487c478bdstevel@tonic-gate	$(LINT.c) arp.c $(LDLIBS) -lsocket -lnsl
2497c478bdstevel@tonic-gate	@# $(LINT.c) in.rexecd.c $(LDLIBS) -lbsm -lpam
2507c478bdstevel@tonic-gate	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
2517c478bdstevel@tonic-gate		-I$(SRC)/head -I$(SRC)/uts/common/ \
2527c478bdstevel@tonic-gate		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
2537c478bdstevel@tonic-gate		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
2547c478bdstevel@tonic-gate		-I$(SRC)/lib/pam_modules/krb5 \
2557c478bdstevel@tonic-gate		in.rlogind.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
2567c478bdstevel@tonic-gate	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
2577c478bdstevel@tonic-gate		-I$(SRC)/head -I$(SRC)/uts/common/ \
2587c478bdstevel@tonic-gate		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
2597c478bdstevel@tonic-gate		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
2607c478bdstevel@tonic-gate		-I$(SRC)/lib/pam_modules/krb5 \
2617c478bdstevel@tonic-gate		in.rshd.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
2627c478bdstevel@tonic-gate	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 \
2637c478bdstevel@tonic-gate		-erroff=E_GLOBAL_COULD_BE_STATIC2 \
2647c478bdstevel@tonic-gate		-I$(SRC)/head -I$(SRC)/uts/common/ \
2657c478bdstevel@tonic-gate		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
2667c478bdstevel@tonic-gate		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
2677c478bdstevel@tonic-gate		-I$(SRC)/lib/pam_modules/krb5 \
2687c478bdstevel@tonic-gate		in.telnetd.c $(LDLIBS) -lbsm -lpam -lsocket -lnsl
269e11c3f4meem	$(LINT.c) if_mpadm.c $(LDLIBS) -lsocket -lnsl -lipmp -linetutil
2707c478bdstevel@tonic-gate	$(LINT.c) ipaddrsel.c $(LDLIBS) -lsocket -lnsl
27145916cdjpk	$(LINT.c) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
2727c478bdstevel@tonic-gate	$(LINT.c) syncinit.c $(LDLIBS) -ldlpi
2737c478bdstevel@tonic-gate	$(LINT.c) syncloop.c $(LDLIBS) -ldlpi
2747c478bdstevel@tonic-gate	$(LINT.c) syncstat.c $(LDLIBS) -ldlpi
2757c478bdstevel@tonic-gate	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 in.rarpd.c $(LDLIBS) \
2767c478bdstevel@tonic-gate	    -lsocket -lnsl
277e7df776Cody Peter Mello	$(LINT.c) ndp.c $(LDLIBS) \
278e7df776Cody Peter Mello	    -lsocket -lnsl
2797c478bdstevel@tonic-gate	$(LINT.c) in.tftpd.c ../usr.bin/tftp/tftpsubs.c $(LDLIBS) \
2807c478bdstevel@tonic-gate	    -lsocket -lnsl
281