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