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