xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/Makefile (revision 8b80e8cb6855118d46f605e91b5ed4ce83417395)
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 2008 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 ipqosconf kssl/kssladm kssl/ksslcfg \
69		ping routeadm snoop sppptun traceroute wificonfig ipsecutils
70
71MSGSUBDIRS=	bootconfchk htable ifconfig in.ftpd in.routed in.talkd inetadm \
72		inetconv ipqosconf kssl/ksslcfg routeadm sppptun snoop \
73		wificonfig ipsecutils
74
75# As programs get lint-clean, add them here and to the 'lint' target.
76# Eventually this hack should go away, and all in PROG should be
77# lint-clean.
78LINTCLEAN=	6to4relay arp in.rlogind in.rshd in.telnetd in.tftpd \
79		ipaddrsel route \
80		in.rarpd if_mpadm $(SYNCPROG)
81# Likewise, as subdirs get lint-clean, add them here.  Once
82# they're all clean, replace the dependency of the lint target
83# with SUBDIRS.  Also (sigh) deal with the commented-out build lines
84# for the lint rule.
85LINTSUBDIRS=	bootconfchk in.rdisc in.routed in.talkd inetadm inetconv \
86		ipqosconf ping routeadm sppptun traceroute wificonfig ipsecutils
87# And as programs are verified not to attempt to write into constants,
88# -xstrconst should be used to ensure they stay that way.
89CONSTCLEAN=
90
91include ../../Makefile.cmd
92ROOTMANIFESTDIR=	$(ROOTSVCNETWORK)
93$(ROOTMANIFEST)		:= FILEMODE= 444
94include ../Makefile.cmd-inet
95
96ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
97ROOTUSRSBINLINKS = $(SBINLINKS:%=$(ROOTUSRSBIN)/%)
98
99COMMONOBJS=	addr_match.o kcmd.o store_forw_creds.o
100COMMONSRCS=	$(COMMONOBJS:%.o=$(CMDINETCOMMONDIR)/%.c)
101SRCS+=		$(COMMONSRCS)
102
103#
104# Message catalog
105#
106POFILES=	6to4relay.po if_mpadm.po in.comsat.po ipaddrsel.po route.po
107POFILE=		usr.sbin.po
108
109all:=		TARGET= all
110install:=	TARGET= install
111clean:=		TARGET= clean
112clobber:=	TARGET= clobber
113lint:=		TARGET= lint
114_msg:=		TARGET= _msg
115
116CLOBBERFILES +=	$(ROOTFS_PROG) $(PROG)
117CLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS)
118
119CPPFLAGS +=	-DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
120
121include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
122K5LIBS=
123
124# Eventually just plain CFLAGS should be += -v, but not until all in
125# PROGS are lint clean.
126$(LINTCLEAN)		:=	CFLAGS += $(CCVERBOSE)
127$(CONSTCLEAN)		:=	CFLAGS += $(XSTRCONST)
128
129$(SYNCPROG)		:=	LDLIBS += -ldlpi
130$(SOCKETPROG)		:=	LDLIBS += -lsocket
131$(NSLPROG)		:=	LDLIBS += -lnsl
132$(AUDITPROG)		:=	LDLIBS += -lbsm
133$(PAMPROG)		:=	LDLIBS += -lpam
134$(RPCSVCPROG)		:=	LDLIBS += -lrpcsvc
135$(K5PROGS)		:=	LDFLAGS += $(KRUNPATH) \
136				-L$(ROOT)$(KLIBDIR_DO) -L$(ROOT)$(KLIBDIR_GL)
137$(K5PROGS)		:=	K5LIBS=  -lmech_krb5
138$(K5PROGS)		:=	CPPFLAGS += -I$(SRC)/head \
139				-I$(SRC)/uts/common/ \
140				-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
141				-I$(SRC)/lib/gss_mechs/mech_krb5/include \
142				-I$(SRC)/lib/pam_modules/krb5
143LDLIBS +=	$(K5LIBS)
144$(TSNETPROG)		:=	LDLIBS += -ltsnet
145
146in.rarpd		:=	LDLIBS += -linetutil -ldlpi
147route			:=	CPPFLAGS += -DNDEBUG
148ndd			:=	LDLIBS += -ldladm
149gettable in.comsat	:=	LDFLAGS += $(MAPFILE.NGB:%=-M%)
150
151.KEEP_STATE:
152
153.PARALLEL:
154
155all: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
156
157#
158# message catalog
159#
160_msg: $(MSGSUBDIRS) $(POFILE)
161
162syncutil: $(SYNCPROG)
163
164$(POFILE): $(POFILES)
165	$(RM) $@
166	cat $(POFILES) > $@
167
168%.o: $(CMDINETCOMMONDIR)/%.c
169	$(COMPILE.c) -o $@ $<
170
171in.telnetd: $(K5TELNETOBJS)
172	$(LINK.c) $(K5TELNETOBJS) -o $@ $(LDLIBS)
173	$(POST_PROCESS)
174
175in.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
176	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
177	$(POST_PROCESS)
178
179in.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
180	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
181	$(POST_PROCESS)
182
183in.tftpd: $(TFTPDOBJS)
184	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
185	$(POST_PROCESS)
186
187tftpsubs.o: $(OTHERSRC)
188	$(COMPILE.c) $(OTHERSRC) -o $@
189	$(POST_PROCESS_O)
190
191$(ROOTUSRSBINLINKS):
192	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
193
194install: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
195	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
196	$(ROOTMANIFEST) THIRDPARTYLICENSE.arp
197
198THIRDPARTYLICENSE.arp: arp.c
199	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
200
201CLOBBERFILES += THIRDPARTYLICENSE.arp
202
203#
204# The reason this rule checks for the existence of the
205# Makefile is that some of the directories do not exist
206# in our exportable source builds.
207#
208$(SUBDIRS): FRC
209	@if [ -f $@/Makefile  ]; then \
210		cd $@; pwd; $(MAKE) $(TARGET); \
211	else \
212		true; \
213	fi
214
215FRC:
216
217check:	$(CHKMANIFEST)
218
219clean:	$(SUBDIRS)
220	-$(RM) $(CLEANFILES)
221
222clobber: $(SUBDIRS)
223	-$(RM) $(CLEANFILES) $(CLOBBERFILES)
224
225lint: $(LINTSUBDIRS)
226	$(LINT.c) 6to4relay.c $(LDLIBS) -lsocket -lnsl
227	$(LINT.c) arp.c $(LDLIBS) -lsocket -lnsl
228	@# $(LINT.c) in.rexecd.c $(LDLIBS) -lbsm -lpam
229	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
230		-I$(SRC)/head -I$(SRC)/uts/common/ \
231		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
232		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
233		-I$(SRC)/lib/pam_modules/krb5 \
234		in.rlogind.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
235	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
236		-I$(SRC)/head -I$(SRC)/uts/common/ \
237		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
238		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
239		-I$(SRC)/lib/pam_modules/krb5 \
240		in.rshd.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
241	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 \
242		-erroff=E_GLOBAL_COULD_BE_STATIC2 \
243		-I$(SRC)/head -I$(SRC)/uts/common/ \
244		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
245		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
246		-I$(SRC)/lib/pam_modules/krb5 \
247		in.telnetd.c $(LDLIBS) -lbsm -lpam -lsocket -lnsl
248	$(LINT.c) if_mpadm.c $(LDLIBS) -lsocket -lnsl -lipmp
249	$(LINT.c) ipaddrsel.c $(LDLIBS) -lsocket -lnsl
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