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