xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/Makefile (revision 379728489ed47862c4927c75771e767b9476c9c4)
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# This controls the degree of compiler warnings emitted, and is named for
75# 'lint' for historical reasons.  Eventually this hack should go away, and all
76# in PROG should be clean.
77LINTCLEAN=	6to4relay arp in.rlogind in.rshd in.telnetd in.tftpd \
78		ipaddrsel ndp route \
79		in.rarpd if_mpadm $(SYNCPROG)
80# And as programs are verified not to attempt to write into constants,
81# -xstrconst should be used to ensure they stay that way.
82CONSTCLEAN=
83
84include ../../Makefile.cmd
85ROOTMANIFESTDIR=	$(ROOTSVCNETWORK)
86$(ROOTMANIFEST)		:= FILEMODE= 444
87include ../Makefile.cmd-inet
88
89ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
90ROOTUSRSBINLINKS = $(SBINLINKS:%=$(ROOTUSRSBIN)/%)
91
92COMMONOBJS=	addr_match.o kcmd.o store_forw_creds.o
93COMMONSRCS=	$(COMMONOBJS:%.o=$(CMDINETCOMMONDIR)/%.c)
94SRCS+=		$(COMMONSRCS)
95
96CERRWARN += -_gcc=-Wno-implicit-function-declaration
97CERRWARN += $(CNOWARN_UNINIT)
98CERRWARN += -_gcc=-Wno-unused-variable
99CERRWARN += -_gcc=-Wno-unused-function
100CERRWARN += -_gcc=-Wno-parentheses
101CERRWARN += -_gcc=-Wno-char-subscripts
102CERRWARN += -_gcc=-Wno-extra
103CERRWARN += -_gcc=-Wno-address
104
105# "missing type for func"
106SMATCH=off
107
108#
109# Message catalog
110#
111POFILES=	6to4relay.po if_mpadm.po in.comsat.po ipaddrsel.po route.po \
112		soconfig.po
113POFILE=		usr.sbin.po
114
115all:=		TARGET= all
116install:=	TARGET= install
117clean:=		TARGET= clean
118clobber:=	TARGET= clobber
119_msg:=		TARGET= _msg
120
121CLOBBERFILES +=	$(ROOTFS_PROG) $(PROG)
122CLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS) \
123		$(K5TELNETOBJS)
124
125CPPFLAGS +=	-DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
126
127include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
128K5LIBS=
129
130# Eventually just plain CFLAGS should be += -v, but not until all in
131# PROGS are lint clean.
132$(LINTCLEAN)		:=	CFLAGS += $(CCVERBOSE)
133$(CONSTCLEAN)		:=	CFLAGS += $(XSTRCONST)
134
135$(SYNCPROG)		:=	LDLIBS += -ldlpi
136$(SOCKETPROG)		:=	LDLIBS += -lsocket
137$(NSLPROG)		:=	LDLIBS += -lnsl
138$(AUDITPROG)		:=	LDLIBS += -lbsm
139$(PAMPROG)		:=	LDLIBS += -lpam
140$(RPCSVCPROG)		:=	LDLIBS += -lrpcsvc
141$(K5PROGS)		:=	LDFLAGS += $(KRUNPATH) \
142				-L$(ROOT)$(KLIBDIR_DO) -L$(ROOT)$(KLIBDIR_GL)
143$(K5PROGS)		:=	K5LIBS=  -lmech_krb5
144$(K5PROGS)		:=	CPPFLAGS += -I$(SRC)/head \
145				-I$(SRC)/uts/common/ \
146				-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
147				-I$(SRC)/lib/gss_mechs/mech_krb5/include \
148				-I$(SRC)/lib/pam_modules/krb5
149LDLIBS +=	$(K5LIBS)
150$(TSNETPROG)		:=	LDLIBS += -ltsnet
151$(DLADMPROG)		:=	LDLIBS += -ldladm
152
153in.rarpd		:=	LDLIBS += -linetutil -ldlpi
154if_mpadm		:=	LDLIBS += -linetutil -lipmp
155if_mpadm.po		:=	XGETFLAGS += -a
156route			:=	CPPFLAGS += -DNDEBUG
157ndd			:=	LDLIBS += -ldladm -lipadm
158$(RELEASE_BUILD)ndd	:=	CERRWARN += -_gcc=-Wno-unused
159in.comsat		:=	LDFLAGS += $(MAPFILE.NGB:%=-Wl,-M%)
160
161.KEEP_STATE:
162
163.PARALLEL:
164
165all: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
166
167#
168# message catalog
169#
170_msg: $(MSGSUBDIRS) $(POFILE)
171
172syncutil: $(SYNCPROG)
173
174$(POFILE): $(POFILES)
175	$(RM) $@
176	cat $(POFILES) > $@
177
178%.o: $(CMDINETCOMMONDIR)/%.c
179	$(COMPILE.c) -o $@ $<
180
181in.telnetd: $(K5TELNETOBJS)
182	$(LINK.c) $(K5TELNETOBJS) -o $@ $(LDLIBS)
183	$(POST_PROCESS)
184
185in.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
186	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
187	$(POST_PROCESS)
188
189in.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
190	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
191	$(POST_PROCESS)
192
193in.tftpd: $(TFTPDOBJS)
194	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
195	$(POST_PROCESS)
196
197tftpsubs.o: $(OTHERSRC)
198	$(COMPILE.c) $(OTHERSRC) -o $@
199	$(POST_PROCESS_O)
200
201$(ROOTUSRSBINLINKS):
202	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
203
204install: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
205	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
206	$(ROOTMANIFEST) $(ROOTSVCMETHOD) THIRDPARTYLICENSE.arp
207
208THIRDPARTYLICENSE.arp: arp.c
209	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
210
211CLOBBERFILES += THIRDPARTYLICENSE.arp
212
213#
214# The reason this rule checks for the existence of the
215# Makefile is that some of the directories do not exist
216# in our exportable source builds.
217#
218$(SUBDIRS): FRC
219	@if [ -f $@/Makefile  ]; then \
220		cd $@; pwd; $(MAKE) $(TARGET); \
221	else \
222		true; \
223	fi
224
225FRC:
226
227check:	$(CHKMANIFEST)
228
229clean: $(SUBDIRS) clean_local
230clean_local:
231	$(RM) $(CLEANFILES)
232
233clobber: $(SUBDIRS) clobber_local
234clobber_local: clean_local
235	$(RM) $(CLOBBERFILES)
236