xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/Makefile (revision d0b3c59ba652f183eeec1414dd9fbdc56bf05cc8)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21
22#
23# Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
24# Copyright 2014 Garrett D'Amore <garrett@damore.org>
25# Copyright 2019, Joyent, Inc.
26#
27
28SYNCPROG=	syncinit syncloop syncstat
29
30PROG=		6to4relay arp if_mpadm \
31		in.comsat in.fingerd in.rarpd in.rexecd in.rlogind \
32		in.rshd in.rwhod in.telnetd in.tftpd ipaddrsel \
33		ndd ndp $(SYNCPROG)
34
35MANIFEST=	rarp.xml telnet.xml comsat.xml finger.xml \
36		login.xml shell.xml rexec.xml socket-filter-kssl.xml
37SVCMETHOD=	svc-sockfilter
38
39ROOTFS_PROG=	hostconfig route soconfig
40SBINLINKS=	hostconfig route
41
42RPCSVCPROG=	hostconfig
43AUDITPROG=	in.rexecd in.rlogind in.rshd in.telnetd
44PAMPROG=	in.rexecd in.rlogind in.rshd in.telnetd
45SOCKETPROG=	6to4relay arp hostconfig if_mpadm in.comsat \
46		in.fingerd in.rarpd in.rexecd in.rlogind in.rshd \
47		in.rwhod in.telnetd in.tftpd ipaddrsel ndp route
48NSLPROG=	6to4relay arp hostconfig in.comsat in.rarpd \
49		in.rexecd in.rlogind in.rshd in.rwhod in.telnetd \
50		in.tftpd ipaddrsel ndp route
51CMDPROG=	in.telnetd
52K5PROGS=	in.telnetd in.rlogind in.rshd
53TSNETPROG=	route
54DLADMPROG=	6to4relay
55DEFAULTFILES=	telnetd.dfl
56
57PROGSRCS=	$(PROG:%=%.c)
58TFTPDOBJS=	in.tftpd.o tftpsubs.o
59OTHERSRC=	../usr.bin/tftp/tftpsubs.c
60K5RLOGINOBJS=	in.rlogind.o
61K5RSHDOBJS=	in.rshd.o
62K5TELNETOBJS=	in.telnetd.o
63SRCS=		$(PROGSRCS) $(OTHERSRC)
64
65SUBDIRS=	ifconfig ilbadm in.rdisc in.routed \
66		in.talkd inetadm inetconv ipadm ipmpstat ipqosconf ipsecutils \
67		kssl/kssladm kssl/ksslcfg nwamadm nwamcfg ping routeadm \
68		snoop sppptun traceroute wificonfig
69
70MSGSUBDIRS=	ifconfig ilbadm in.routed in.talkd \
71		inetadm inetconv ipadm ipmpstat ipqosconf ipsecutils \
72		kssl/ksslcfg nwamadm nwamcfg routeadm sppptun snoop wificonfig
73
74# As programs get lint-clean, add them here and to the 'lint' target.
75# Eventually this hack should go away, and all in PROG should be
76# lint-clean.
77LINTCLEAN=	6to4relay arp in.rlogind in.rshd in.telnetd in.tftpd \
78		ipaddrsel ndp route \
79		in.rarpd if_mpadm $(SYNCPROG)
80# Likewise, as subdirs get lint-clean, add them here.  Once
81# they're all clean, replace the dependency of the lint target
82# with SUBDIRS.  Also (sigh) deal with the commented-out build lines
83# for the lint rule.
84LINTSUBDIRS=	ilbadm in.rdisc in.routed in.talkd inetadm \
85		inetconv ipmpstat ipqosconf ipsecutils kssl/kssladm \
86		kssl/ksslcfg nwamadm nwamcfg ping routeadm sppptun traceroute \
87		wificonfig
88# And as programs are verified not to attempt to write into constants,
89# -xstrconst should be used to ensure they stay that way.
90CONSTCLEAN=
91
92include ../../Makefile.cmd
93ROOTMANIFESTDIR=	$(ROOTSVCNETWORK)
94$(ROOTMANIFEST)		:= FILEMODE= 444
95include ../Makefile.cmd-inet
96
97ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
98ROOTUSRSBINLINKS = $(SBINLINKS:%=$(ROOTUSRSBIN)/%)
99
100COMMONOBJS=	addr_match.o kcmd.o store_forw_creds.o
101COMMONSRCS=	$(COMMONOBJS:%.o=$(CMDINETCOMMONDIR)/%.c)
102SRCS+=		$(COMMONSRCS)
103
104CERRWARN += -_gcc=-Wno-implicit-function-declaration
105CERRWARN += $(CNOWARN_UNINIT)
106CERRWARN += -_gcc=-Wno-unused-variable
107CERRWARN += -_gcc=-Wno-unused-function
108CERRWARN += -_gcc=-Wno-parentheses
109CERRWARN += -_gcc=-Wno-char-subscripts
110CERRWARN += -_gcc=-Wno-extra
111CERRWARN += -_gcc=-Wno-address
112
113# "missing type for func"
114SMATCH=off
115
116#
117# Message catalog
118#
119POFILES=	6to4relay.po if_mpadm.po in.comsat.po ipaddrsel.po route.po \
120		soconfig.po
121POFILE=		usr.sbin.po
122
123all:=		TARGET= all
124install:=	TARGET= install
125clean:=		TARGET= clean
126clobber:=	TARGET= clobber
127lint:=		TARGET= lint
128_msg:=		TARGET= _msg
129
130CLOBBERFILES +=	$(ROOTFS_PROG) $(PROG)
131CLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS) \
132		$(K5TELNETOBJS)
133
134CPPFLAGS +=	-DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
135
136include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
137K5LIBS=
138
139# Eventually just plain CFLAGS should be += -v, but not until all in
140# PROGS are lint clean.
141$(LINTCLEAN)		:=	CFLAGS += $(CCVERBOSE)
142$(CONSTCLEAN)		:=	CFLAGS += $(XSTRCONST)
143
144$(SYNCPROG)		:=	LDLIBS += -ldlpi
145$(SOCKETPROG)		:=	LDLIBS += -lsocket
146$(NSLPROG)		:=	LDLIBS += -lnsl
147$(AUDITPROG)		:=	LDLIBS += -lbsm
148$(PAMPROG)		:=	LDLIBS += -lpam
149$(RPCSVCPROG)		:=	LDLIBS += -lrpcsvc
150$(K5PROGS)		:=	LDFLAGS += $(KRUNPATH) \
151				-L$(ROOT)$(KLIBDIR_DO) -L$(ROOT)$(KLIBDIR_GL)
152$(K5PROGS)		:=	K5LIBS=  -lmech_krb5
153$(K5PROGS)		:=	CPPFLAGS += -I$(SRC)/head \
154				-I$(SRC)/uts/common/ \
155				-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
156				-I$(SRC)/lib/gss_mechs/mech_krb5/include \
157				-I$(SRC)/lib/pam_modules/krb5
158LDLIBS +=	$(K5LIBS)
159$(TSNETPROG)		:=	LDLIBS += -ltsnet
160$(DLADMPROG)		:=	LDLIBS += -ldladm
161
162in.rarpd		:=	LDLIBS += -linetutil -ldlpi
163if_mpadm		:=	LDLIBS += -linetutil -lipmp
164if_mpadm.po		:=	XGETFLAGS += -a
165route			:=	CPPFLAGS += -DNDEBUG
166ndd			:=	LDLIBS += -ldladm -lipadm
167$(RELEASE_BUILD)ndd	:=	CERRWARN += -_gcc=-Wno-unused
168in.comsat		:=	LDFLAGS += $(MAPFILE.NGB:%=-M%)
169
170.KEEP_STATE:
171
172.PARALLEL:
173
174all: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
175
176#
177# message catalog
178#
179_msg: $(MSGSUBDIRS) $(POFILE)
180
181syncutil: $(SYNCPROG)
182
183$(POFILE): $(POFILES)
184	$(RM) $@
185	cat $(POFILES) > $@
186
187%.o: $(CMDINETCOMMONDIR)/%.c
188	$(COMPILE.c) -o $@ $<
189
190in.telnetd: $(K5TELNETOBJS)
191	$(LINK.c) $(K5TELNETOBJS) -o $@ $(LDLIBS)
192	$(POST_PROCESS)
193
194in.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
195	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
196	$(POST_PROCESS)
197
198in.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
199	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
200	$(POST_PROCESS)
201
202in.tftpd: $(TFTPDOBJS)
203	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
204	$(POST_PROCESS)
205
206tftpsubs.o: $(OTHERSRC)
207	$(COMPILE.c) $(OTHERSRC) -o $@
208	$(POST_PROCESS_O)
209
210$(ROOTUSRSBINLINKS):
211	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
212
213install: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
214	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
215	$(ROOTMANIFEST) $(ROOTSVCMETHOD) THIRDPARTYLICENSE.arp
216
217THIRDPARTYLICENSE.arp: arp.c
218	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
219
220CLOBBERFILES += THIRDPARTYLICENSE.arp
221
222#
223# The reason this rule checks for the existence of the
224# Makefile is that some of the directories do not exist
225# in our exportable source builds.
226#
227$(SUBDIRS): FRC
228	@if [ -f $@/Makefile  ]; then \
229		cd $@; pwd; $(MAKE) $(TARGET); \
230	else \
231		true; \
232	fi
233
234FRC:
235
236check:	$(CHKMANIFEST)
237
238clean: $(SUBDIRS) clean_local
239clean_local:
240	$(RM) $(CLEANFILES)
241
242clobber: $(SUBDIRS) clobber_local
243clobber_local: clean_local
244	$(RM) $(CLOBBERFILES)
245
246lint: $(LINTSUBDIRS)
247	$(LINT.c) 6to4relay.c $(LDLIBS) -lsocket -ldladm
248	$(LINT.c) arp.c $(LDLIBS) -lsocket -lnsl
249	@# $(LINT.c) in.rexecd.c $(LDLIBS) -lbsm -lpam
250	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
251		-I$(SRC)/head -I$(SRC)/uts/common/ \
252		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
253		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
254		-I$(SRC)/lib/pam_modules/krb5 \
255		in.rlogind.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
256	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
257		-I$(SRC)/head -I$(SRC)/uts/common/ \
258		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
259		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
260		-I$(SRC)/lib/pam_modules/krb5 \
261		in.rshd.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
262	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 \
263		-erroff=E_GLOBAL_COULD_BE_STATIC2 \
264		-I$(SRC)/head -I$(SRC)/uts/common/ \
265		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
266		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
267		-I$(SRC)/lib/pam_modules/krb5 \
268		in.telnetd.c $(LDLIBS) -lbsm -lpam -lsocket -lnsl
269	$(LINT.c) if_mpadm.c $(LDLIBS) -lsocket -lnsl -lipmp -linetutil
270	$(LINT.c) ipaddrsel.c $(LDLIBS) -lsocket -lnsl
271	$(LINT.c) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
272	$(LINT.c) syncinit.c $(LDLIBS) -ldlpi
273	$(LINT.c) syncloop.c $(LDLIBS) -ldlpi
274	$(LINT.c) syncstat.c $(LDLIBS) -ldlpi
275	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 in.rarpd.c $(LDLIBS) \
276	    -lsocket -lnsl
277	$(LINT.c) ndp.c $(LDLIBS) \
278	    -lsocket -lnsl
279	$(LINT.c) in.tftpd.c ../usr.bin/tftp/tftpsubs.c $(LDLIBS) \
280	    -lsocket -lnsl
281