xref: /titanic_41/usr/src/cmd/cmd-inet/usr.sbin/Makefile (revision 1e49577a7fcde812700ded04431b49d67cc57d6d)
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
107#
108# Message catalog
109#
110POFILES=	6to4relay.po if_mpadm.po in.comsat.po ipaddrsel.po route.po \
111		soconfig.po
112POFILE=		usr.sbin.po
113
114all:=		TARGET= all
115install:=	TARGET= install
116clean:=		TARGET= clean
117clobber:=	TARGET= clobber
118lint:=		TARGET= lint
119_msg:=		TARGET= _msg
120
121CLOBBERFILES +=	$(ROOTFS_PROG) $(PROG)
122CLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS)
123
124CPPFLAGS +=	-DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
125
126include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
127K5LIBS=
128
129# Eventually just plain CFLAGS should be += -v, but not until all in
130# PROGS are lint clean.
131$(LINTCLEAN)		:=	CFLAGS += $(CCVERBOSE)
132$(CONSTCLEAN)		:=	CFLAGS += $(XSTRCONST)
133
134$(SYNCPROG)		:=	LDLIBS += -ldlpi
135$(SOCKETPROG)		:=	LDLIBS += -lsocket
136$(NSLPROG)		:=	LDLIBS += -lnsl
137$(AUDITPROG)		:=	LDLIBS += -lbsm
138$(PAMPROG)		:=	LDLIBS += -lpam
139$(RPCSVCPROG)		:=	LDLIBS += -lrpcsvc
140$(K5PROGS)		:=	LDFLAGS += $(KRUNPATH) \
141				-L$(ROOT)$(KLIBDIR_DO) -L$(ROOT)$(KLIBDIR_GL)
142$(K5PROGS)		:=	K5LIBS=  -lmech_krb5
143$(K5PROGS)		:=	CPPFLAGS += -I$(SRC)/head \
144				-I$(SRC)/uts/common/ \
145				-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
146				-I$(SRC)/lib/gss_mechs/mech_krb5/include \
147				-I$(SRC)/lib/pam_modules/krb5
148LDLIBS +=	$(K5LIBS)
149$(TSNETPROG)		:=	LDLIBS += -ltsnet
150$(DLADMPROG)		:=	LDLIBS += -ldladm
151
152in.rarpd		:=	LDLIBS += -linetutil -ldlpi
153if_mpadm		:=	LDLIBS += -linetutil -lipmp
154if_mpadm.po		:=	XGETFLAGS += -a
155route			:=	CPPFLAGS += -DNDEBUG
156ndd			:=	LDLIBS += -ldladm -lipadm
157gettable in.comsat	:=	LDFLAGS += $(MAPFILE.NGB:%=-M%)
158
159.KEEP_STATE:
160
161.PARALLEL:
162
163all: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
164
165#
166# message catalog
167#
168_msg: $(MSGSUBDIRS) $(POFILE)
169
170syncutil: $(SYNCPROG)
171
172$(POFILE): $(POFILES)
173	$(RM) $@
174	cat $(POFILES) > $@
175
176%.o: $(CMDINETCOMMONDIR)/%.c
177	$(COMPILE.c) -o $@ $<
178
179in.telnetd: $(K5TELNETOBJS)
180	$(LINK.c) $(K5TELNETOBJS) -o $@ $(LDLIBS)
181	$(POST_PROCESS)
182
183in.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
184	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
185	$(POST_PROCESS)
186
187in.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
188	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
189	$(POST_PROCESS)
190
191in.tftpd: $(TFTPDOBJS)
192	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
193	$(POST_PROCESS)
194
195tftpsubs.o: $(OTHERSRC)
196	$(COMPILE.c) $(OTHERSRC) -o $@
197	$(POST_PROCESS_O)
198
199$(ROOTUSRSBINLINKS):
200	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
201
202install: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
203	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
204	$(ROOTMANIFEST) $(ROOTSVCMETHOD) THIRDPARTYLICENSE.arp
205
206THIRDPARTYLICENSE.arp: arp.c
207	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
208
209CLOBBERFILES += THIRDPARTYLICENSE.arp
210
211#
212# The reason this rule checks for the existence of the
213# Makefile is that some of the directories do not exist
214# in our exportable source builds.
215#
216$(SUBDIRS): FRC
217	@if [ -f $@/Makefile  ]; then \
218		cd $@; pwd; $(MAKE) $(TARGET); \
219	else \
220		true; \
221	fi
222
223FRC:
224
225check:	$(CHKMANIFEST)
226
227clean:	$(SUBDIRS)
228	-$(RM) $(CLEANFILES)
229
230clobber: $(SUBDIRS)
231	-$(RM) $(CLEANFILES) $(CLOBBERFILES)
232
233lint: $(LINTSUBDIRS)
234	$(LINT.c) 6to4relay.c $(LDLIBS) -lsocket -ldladm
235	$(LINT.c) arp.c $(LDLIBS) -lsocket -lnsl
236	@# $(LINT.c) in.rexecd.c $(LDLIBS) -lbsm -lpam
237	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
238		-I$(SRC)/head -I$(SRC)/uts/common/ \
239		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
240		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
241		-I$(SRC)/lib/pam_modules/krb5 \
242		in.rlogind.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
243	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
244		-I$(SRC)/head -I$(SRC)/uts/common/ \
245		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
246		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
247		-I$(SRC)/lib/pam_modules/krb5 \
248		in.rshd.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
249	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 \
250		-erroff=E_GLOBAL_COULD_BE_STATIC2 \
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.telnetd.c $(LDLIBS) -lbsm -lpam -lsocket -lnsl
256	$(LINT.c) if_mpadm.c $(LDLIBS) -lsocket -lnsl -lipmp -linetutil
257	$(LINT.c) ipaddrsel.c $(LDLIBS) -lsocket -lnsl
258	$(LINT.c) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
259	$(LINT.c) syncinit.c $(LDLIBS) -ldlpi
260	$(LINT.c) syncloop.c $(LDLIBS) -ldlpi
261	$(LINT.c) syncstat.c $(LDLIBS) -ldlpi
262	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 in.rarpd.c $(LDLIBS) \
263	    -lsocket -lnsl
264	$(LINT.c) in.tftpd.c ../usr.bin/tftp/tftpsubs.c $(LDLIBS) \
265	    -lsocket -lnsl
266
267# EXPORT DELETE START
268EXPORT_SRC:
269	$(RM) Makefile+
270	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
271		< Makefile > Makefile+
272	$(RM) Makefile
273	$(MV) Makefile+ Makefile
274	$(CHMOD) 444 Makefile
275# EXPORT DELETE END
276