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