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