xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/Makefile (revision 2df1fe9ca32bb227b9158c67f5c00b54c20b10fd)
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 \
37		in.comsat in.fingerd in.rarpd in.rexecd in.rlogind \
38		in.rshd in.rwhod in.telnetd in.tftpd ipaddrsel \
39		ndd $(SYNCPROG) $(DHCPPROG) $(XMODPROG)
40
41MANIFEST=	rarp.xml telnet.xml comsat.xml finger.xml \
42		login.xml shell.xml rexec.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 ipaddrsel route
53NSLPROG=	6to4relay arp gettable hostconfig in.comsat in.rarpd \
54		in.rexecd in.rlogind in.rshd in.rwhod in.telnetd \
55		in.tftpd ipaddrsel route
56CMDPROG=	in.telnetd
57K5PROGS=	in.telnetd in.rlogind in.rshd
58TSNETPROG=	route
59DEFAULTFILES=	telnetd.dfl
60
61PROGSRCS=	$(PROG:%=%.c)
62TFTPDOBJS=	in.tftpd.o tftpsubs.o
63OTHERSRC=	../usr.bin/tftp/tftpsubs.c
64K5RLOGINOBJS=	in.rlogind.o
65K5RSHDOBJS=	in.rshd.o
66SRCS=		$(PROGSRCS) $(OTHERSRC)
67
68SUBDIRS=	bootconfchk htable ifconfig in.ftpd in.rdisc in.routed \
69		in.talkd inetadm inetconv ipqosconf kssl/kssladm kssl/ksslcfg \
70		ping routeadm snoop sppptun traceroute wificonfig ipsecutils
71
72MSGSUBDIRS=	bootconfchk htable ifconfig in.ftpd in.routed in.talkd inetadm \
73		inetconv ipqosconf kssl/ksslcfg routeadm sppptun snoop \
74		wificonfig
75
76# As programs get lint-clean, add them here and to the 'lint' target.
77# Eventually this hack should go away, and all in PROG should be
78# lint-clean.
79LINTCLEAN=	6to4relay arp in.rlogind in.rshd in.telnetd in.tftpd \
80		ipaddrsel route \
81		in.rarpd if_mpadm $(SYNCPROG)
82# Likewise, as subdirs get lint-clean, add them here.  Once
83# they're all clean, replace the dependency of the lint target
84# with SUBDIRS.  Also (sigh) deal with the commented-out build lines
85# for the lint rule.
86LINTSUBDIRS=	bootconfchk in.rdisc in.routed in.talkd inetadm inetconv \
87		ipqosconf ping routeadm sppptun traceroute wificonfig ipsecutils
88# And as programs are verified not to attempt to write into constants,
89# -xstrconst should be used to ensure they stay that way.
90CONSTCLEAN=
91
92include ../../Makefile.cmd
93ROOTMANIFESTDIR=	$(ROOTSVCNETWORK)
94$(ROOTMANIFEST)		:= FILEMODE= 444
95include ../Makefile.cmd-inet
96
97ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
98ROOTUSRSBINLINKS = $(SBINLINKS:%=$(ROOTUSRSBIN)/%)
99
100COMMONOBJS=	addr_match.o kcmd.o
101COMMONSRCS=	$(COMMONOBJS:%.o=$(CMDINETCOMMONDIR)/%.c)
102SRCS+=		$(COMMONSRCS)
103
104#
105# Message catalog
106#
107POFILES=	6to4relay.po if_mpadm.po in.comsat.po ipaddrsel.po route.po
108POFILE=		usr.sbin.po
109
110all:=		TARGET= all
111install:=	TARGET= install
112clean:=		TARGET= clean
113clobber:=	TARGET= clobber
114lint:=		TARGET= lint
115_msg:=		TARGET= _msg
116
117CLOBBERFILES +=	$(ROOTFS_PROG) $(PROG)
118CLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS)
119
120CPPFLAGS +=	-DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
121
122include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
123K5LIBS=
124
125# Eventually just plain CFLAGS should be += -v, but not until all in
126# PROGS are lint clean.
127$(LINTCLEAN)		:=	CFLAGS += $(CCVERBOSE)
128$(CONSTCLEAN)		:=	CFLAGS += $(XSTRCONST)
129
130$(SYNCPROG)		:=	LDLIBS += -ldlpi
131$(SOCKETPROG)		:=	LDLIBS += -lsocket
132$(NSLPROG)		:=	LDLIBS += -lnsl
133$(AUDITPROG)		:=	LDLIBS += -lbsm
134$(PAMPROG)		:=	LDLIBS += -lpam
135$(RPCSVCPROG)		:=	LDLIBS += -lrpcsvc
136$(K5PROGS)		:=	LDFLAGS += $(ZLAZYLOAD) $(KRUNPATH) \
137				-L$(ROOT)$(KLIBDIR_DO) -L$(ROOT)$(KLIBDIR_GL)
138$(K5PROGS)		:=	K5LIBS=  -lmech_krb5
139$(K5PROGS)		:=	CPPFLAGS += -I$(SRC)/head \
140				-I$(SRC)/uts/common/ \
141				-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
142				-I$(SRC)/lib/gss_mechs/mech_krb5/include \
143				-I$(SRC)/lib/pam_modules/krb5
144LDLIBS +=	$(K5LIBS)
145$(TSNETPROG)		:=	LDLIBS += $(ZLAZYLOAD) -ltsnet $(ZNOLAZYLOAD)
146
147in.rarpd		:=	LDLIBS += -linetutil -ldlpi
148route			:=	CPPFLAGS += -DNDEBUG
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.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
172	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
173	$(POST_PROCESS)
174
175in.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
176	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
177	$(POST_PROCESS)
178
179in.tftpd: $(TFTPDOBJS)
180	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
181	$(POST_PROCESS)
182
183tftpsubs.o: $(OTHERSRC)
184	$(COMPILE.c) $(OTHERSRC) -o $@
185	$(POST_PROCESS_O)
186
187$(ROOTUSRSBINLINKS):
188	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
189
190install: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
191	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
192	$(ROOTMANIFEST) THIRDPARTYLICENSE.arp
193
194THIRDPARTYLICENSE.arp: arp.c
195	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
196
197CLOBBERFILES += THIRDPARTYLICENSE.arp
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) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
247	$(LINT.c) syncinit.c $(LDLIBS) -ldlpi
248	$(LINT.c) syncloop.c $(LDLIBS) -ldlpi
249	$(LINT.c) syncstat.c $(LDLIBS) -ldlpi
250	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 in.rarpd.c $(LDLIBS) \
251	    -lsocket -lnsl
252	$(LINT.c) in.tftpd.c ../usr.bin/tftp/tftpsubs.c $(LDLIBS) \
253	    -lsocket -lnsl
254
255# EXPORT DELETE START
256EXPORT_SRC:
257	$(RM) Makefile+
258	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
259		< Makefile > Makefile+
260	$(RM) Makefile
261	$(MV) Makefile+ Makefile
262	$(CHMOD) 444 Makefile
263# EXPORT DELETE END
264