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