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