xref: /titanic_41/usr/src/cmd/cmd-inet/usr.sbin/Makefile (revision 9a0e82381c494d655823a54fc713a8c2a571131c)
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 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27SYNCPROG=	syncinit syncloop syncstat
28DHCPPROG=	dhcpconfig dhtadm pntadm
29
30# EXPORT DELETE START
31XMODPROG=	wanbootutil
32# EXPORT DELETE END
33
34PROG=		6to4relay arp gettable if_mpadm \
35		in.comsat in.fingerd in.rarpd in.rexecd in.rlogind \
36		in.rshd in.rwhod in.telnetd in.tftpd ipaddrsel \
37		ndd $(SYNCPROG) $(DHCPPROG) $(XMODPROG)
38
39MANIFEST=	rarp.xml telnet.xml comsat.xml finger.xml \
40		login.xml shell.xml rexec.xml
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
57DEFAULTFILES=	telnetd.dfl
58
59PROGSRCS=	$(PROG:%=%.c)
60TFTPDOBJS=	in.tftpd.o tftpsubs.o
61OTHERSRC=	../usr.bin/tftp/tftpsubs.c
62K5RLOGINOBJS=	in.rlogind.o
63K5RSHDOBJS=	in.rshd.o
64K5TELNETOBJS=	in.telnetd.o
65SRCS=		$(PROGSRCS) $(OTHERSRC)
66
67SUBDIRS=	bootconfchk htable ifconfig in.ftpd in.rdisc in.routed \
68		in.talkd inetadm inetconv ipmpstat ipqosconf ipsecutils \
69		kssl/kssladm kssl/ksslcfg ping routeadm snoop sppptun \
70		traceroute wificonfig
71
72MSGSUBDIRS=	bootconfchk htable ifconfig in.ftpd in.routed in.talkd inetadm \
73		inetconv ipmpstat ipqosconf ipsecutils kssl/ksslcfg routeadm \
74		sppptun snoop wificonfig
75
76# As programs get lint-clean, add them here and to the 'lint' target.
77# Eventually this hack should go away, and all in PROG should be
78# lint-clean.
79LINTCLEAN=	6to4relay arp in.rlogind in.rshd in.telnetd in.tftpd \
80		ipaddrsel route \
81		in.rarpd if_mpadm $(SYNCPROG)
82# Likewise, as subdirs get lint-clean, add them here.  Once
83# they're all clean, replace the dependency of the lint target
84# with SUBDIRS.  Also (sigh) deal with the commented-out build lines
85# for the lint rule.
86LINTSUBDIRS=	bootconfchk in.rdisc in.routed in.talkd inetadm inetconv \
87		ipmpstat ipqosconf ipsecutils ping routeadm sppptun traceroute \
88		wificonfig
89# And as programs are verified not to attempt to write into constants,
90# -xstrconst should be used to ensure they stay that way.
91CONSTCLEAN=
92
93include ../../Makefile.cmd
94ROOTMANIFESTDIR=	$(ROOTSVCNETWORK)
95$(ROOTMANIFEST)		:= FILEMODE= 444
96include ../Makefile.cmd-inet
97
98ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
99ROOTUSRSBINLINKS = $(SBINLINKS:%=$(ROOTUSRSBIN)/%)
100
101COMMONOBJS=	addr_match.o kcmd.o store_forw_creds.o
102COMMONSRCS=	$(COMMONOBJS:%.o=$(CMDINETCOMMONDIR)/%.c)
103SRCS+=		$(COMMONSRCS)
104
105#
106# Message catalog
107#
108POFILES=	6to4relay.po if_mpadm.po in.comsat.po ipaddrsel.po route.po
109POFILE=		usr.sbin.po
110
111all:=		TARGET= all
112install:=	TARGET= install
113clean:=		TARGET= clean
114clobber:=	TARGET= clobber
115lint:=		TARGET= lint
116_msg:=		TARGET= _msg
117
118CLOBBERFILES +=	$(ROOTFS_PROG) $(PROG)
119CLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS)
120
121CPPFLAGS +=	-DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
122
123include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
124K5LIBS=
125
126# Eventually just plain CFLAGS should be += -v, but not until all in
127# PROGS are lint clean.
128$(LINTCLEAN)		:=	CFLAGS += $(CCVERBOSE)
129$(CONSTCLEAN)		:=	CFLAGS += $(XSTRCONST)
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
148in.rarpd		:=	LDLIBS += -linetutil -ldlpi
149if_mpadm		:=	LDLIBS += -linetutil -lipmp
150if_mpadm.po		:=	XGETFLAGS += -a
151route			:=	CPPFLAGS += -DNDEBUG
152ndd			:=	LDLIBS += -ldladm
153gettable in.comsat	:=	LDFLAGS += $(MAPFILE.NGB:%=-M%)
154
155.KEEP_STATE:
156
157.PARALLEL:
158
159all: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
160
161#
162# message catalog
163#
164_msg: $(MSGSUBDIRS) $(POFILE)
165
166syncutil: $(SYNCPROG)
167
168$(POFILE): $(POFILES)
169	$(RM) $@
170	cat $(POFILES) > $@
171
172%.o: $(CMDINETCOMMONDIR)/%.c
173	$(COMPILE.c) -o $@ $<
174
175in.telnetd: $(K5TELNETOBJS)
176	$(LINK.c) $(K5TELNETOBJS) -o $@ $(LDLIBS)
177	$(POST_PROCESS)
178
179in.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
180	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
181	$(POST_PROCESS)
182
183in.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
184	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
185	$(POST_PROCESS)
186
187in.tftpd: $(TFTPDOBJS)
188	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
189	$(POST_PROCESS)
190
191tftpsubs.o: $(OTHERSRC)
192	$(COMPILE.c) $(OTHERSRC) -o $@
193	$(POST_PROCESS_O)
194
195$(ROOTUSRSBINLINKS):
196	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
197
198install: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
199	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
200	$(ROOTMANIFEST) THIRDPARTYLICENSE.arp
201
202THIRDPARTYLICENSE.arp: arp.c
203	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
204
205CLOBBERFILES += THIRDPARTYLICENSE.arp
206
207#
208# The reason this rule checks for the existence of the
209# Makefile is that some of the directories do not exist
210# in our exportable source builds.
211#
212$(SUBDIRS): FRC
213	@if [ -f $@/Makefile  ]; then \
214		cd $@; pwd; $(MAKE) $(TARGET); \
215	else \
216		true; \
217	fi
218
219FRC:
220
221check:	$(CHKMANIFEST)
222
223clean:	$(SUBDIRS)
224	-$(RM) $(CLEANFILES)
225
226clobber: $(SUBDIRS)
227	-$(RM) $(CLEANFILES) $(CLOBBERFILES)
228
229lint: $(LINTSUBDIRS)
230	$(LINT.c) 6to4relay.c $(LDLIBS) -lsocket -lnsl
231	$(LINT.c) arp.c $(LDLIBS) -lsocket -lnsl
232	@# $(LINT.c) in.rexecd.c $(LDLIBS) -lbsm -lpam
233	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
234		-I$(SRC)/head -I$(SRC)/uts/common/ \
235		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
236		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
237		-I$(SRC)/lib/pam_modules/krb5 \
238		in.rlogind.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
239	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
240		-I$(SRC)/head -I$(SRC)/uts/common/ \
241		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
242		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
243		-I$(SRC)/lib/pam_modules/krb5 \
244		in.rshd.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
245	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 \
246		-erroff=E_GLOBAL_COULD_BE_STATIC2 \
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.telnetd.c $(LDLIBS) -lbsm -lpam -lsocket -lnsl
252	$(LINT.c) if_mpadm.c $(LDLIBS) -lsocket -lnsl -lipmp -linetutil
253	$(LINT.c) ipaddrsel.c $(LDLIBS) -lsocket -lnsl
254	$(LINT.c) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
255	$(LINT.c) syncinit.c $(LDLIBS) -ldlpi
256	$(LINT.c) syncloop.c $(LDLIBS) -ldlpi
257	$(LINT.c) syncstat.c $(LDLIBS) -ldlpi
258	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 in.rarpd.c $(LDLIBS) \
259	    -lsocket -lnsl
260	$(LINT.c) in.tftpd.c ../usr.bin/tftp/tftpsubs.c $(LDLIBS) \
261	    -lsocket -lnsl
262
263# EXPORT DELETE START
264EXPORT_SRC:
265	$(RM) Makefile+
266	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
267		< Makefile > Makefile+
268	$(RM) Makefile
269	$(MV) Makefile+ Makefile
270	$(CHMOD) 444 Makefile
271# EXPORT DELETE END
272