xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/Makefile (revision 32885d593baf8bac788fa78885893a51b3ad0f28)
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# 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
66K5TELNETOBJS=	in.telnetd.o
67SRCS=		$(PROGSRCS) $(OTHERSRC)
68
69SUBDIRS=	bootconfchk htable ifconfig in.ftpd in.rdisc in.routed \
70		in.talkd inetadm inetconv ipqosconf kssl/kssladm kssl/ksslcfg \
71		ping routeadm snoop sppptun traceroute wificonfig ipsecutils
72
73MSGSUBDIRS=	bootconfchk htable ifconfig in.ftpd in.routed in.talkd inetadm \
74		inetconv ipqosconf kssl/ksslcfg routeadm sppptun snoop \
75		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 in.rdisc in.routed in.talkd inetadm inetconv \
88		ipqosconf ping routeadm sppptun traceroute wificonfig ipsecutils
89# And as programs are verified not to attempt to write into constants,
90# -xstrconst should be used to ensure they stay that way.
91CONSTCLEAN=
92
93include ../../Makefile.cmd
94ROOTMANIFESTDIR=	$(ROOTSVCNETWORK)
95$(ROOTMANIFEST)		:= FILEMODE= 444
96include ../Makefile.cmd-inet
97
98ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
99ROOTUSRSBINLINKS = $(SBINLINKS:%=$(ROOTUSRSBIN)/%)
100
101KWARN_OBJS = kwarnd_clnt_stubs.o kwarnd_clnt.o kwarnd_handle.o kwarnd_xdr.o
102KWARN_SRC  = $(KWARN_OBJS:%.o=%.c)
103KWARN_SRC += kwarnd.h
104kwarnd.h:	$(SRC)/cmd/krb5/kwarn/kwarnd.x
105	$(RM) $@
106	$(RPCGEN) -M -h $(SRC)/cmd/krb5/kwarn/kwarnd.x | \
107	$(SED) -e 's!$(SRC)/cmd/krb5/kwarn/kwarnd.h!kwarnd.h!' > $@
108
109kwarnd_xdr.c:	kwarnd.h $(SRC)/cmd/krb5/kwarn/kwarnd.x
110	$(RM) $@
111	$(RPCGEN) -M -c $(SRC)/cmd/krb5/kwarn/kwarnd.x | \
112	$(SED) -e 's!$(SRC)/cmd/krb5/kwarn/kwarnd.h!kwarnd.h!' > $@
113
114kwarnd_clnt.c:   kwarnd.h $(SRC)/cmd/krb5/kwarn/kwarnd.x
115	$(RM) $@
116	$(RPCGEN) -M -l $(SRC)/cmd/krb5/kwarn/kwarnd.x | \
117	$(SED) -e 's!$(SRC)/cmd/krb5/kwarn/kwarnd.h!kwarnd.h!' > $@
118kwarnd_clnt_stubs.c: kwarnd.h $(SRC)/cmd/krb5/kwarn/kwarnd_clnt_stubs.c
119	$(RM) $@
120	$(CP) $(SRC)/cmd/krb5/kwarn/kwarnd_clnt_stubs.c $@
121
122kwarnd_handle.c: $(SRC)/cmd/krb5/kwarn/kwarnd_handle.c
123	$(RM) $@
124	$(CP) $(SRC)/cmd/krb5/kwarn/kwarnd_handle.c $@
125
126COMMONOBJS=	addr_match.o kcmd.o store_forw_creds.o
127COMMONSRCS=	$(COMMONOBJS:%.o=$(CMDINETCOMMONDIR)/%.c)
128SRCS+=		$(COMMONSRCS)
129
130#
131# Message catalog
132#
133POFILES=	6to4relay.po if_mpadm.po in.comsat.po ipaddrsel.po route.po
134POFILE=		usr.sbin.po
135
136all:=		TARGET= all
137install:=	TARGET= install
138clean:=		TARGET= clean
139clobber:=	TARGET= clobber
140lint:=		TARGET= lint
141_msg:=		TARGET= _msg
142
143CLOBBERFILES +=	$(ROOTFS_PROG) $(PROG) $(KWARN_SRC)
144CLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS)
145CLEANFILES += $(KWARN_OBJS)
146
147CPPFLAGS +=	-DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
148
149include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
150K5LIBS=
151
152# Eventually just plain CFLAGS should be += -v, but not until all in
153# PROGS are lint clean.
154$(LINTCLEAN)		:=	CFLAGS += $(CCVERBOSE)
155$(CONSTCLEAN)		:=	CFLAGS += $(XSTRCONST)
156
157$(SYNCPROG)		:=	LDLIBS += -ldlpi
158$(SOCKETPROG)		:=	LDLIBS += -lsocket
159$(NSLPROG)		:=	LDLIBS += -lnsl
160$(AUDITPROG)		:=	LDLIBS += -lbsm
161$(PAMPROG)		:=	LDLIBS += -lpam
162$(RPCSVCPROG)		:=	LDLIBS += -lrpcsvc
163$(K5PROGS)		:=	LDFLAGS += $(ZLAZYLOAD) $(KRUNPATH) \
164				-L$(ROOT)$(KLIBDIR_DO) -L$(ROOT)$(KLIBDIR_GL)
165$(K5PROGS)		:=	K5LIBS=  -lmech_krb5
166$(K5PROGS)		:=	CPPFLAGS += -I$(SRC)/head \
167				-I$(SRC)/uts/common/ \
168				-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
169				-I$(SRC)/lib/gss_mechs/mech_krb5/include \
170				-I$(SRC)/lib/pam_modules/krb5
171LDLIBS +=	$(K5LIBS)
172$(TSNETPROG)		:=	LDLIBS += $(ZLAZYLOAD) -ltsnet $(ZNOLAZYLOAD)
173
174in.rarpd		:=	LDLIBS += -linetutil -ldlpi
175route			:=	CPPFLAGS += -DNDEBUG
176ndd			:=	LDLIBS += -ldladm
177gettable in.comsat	:=	LDFLAGS += $(MAPFILE.NGB:%=-M%)
178
179.KEEP_STATE:
180
181.PARALLEL:
182
183all: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
184
185#
186# message catalog
187#
188_msg: $(MSGSUBDIRS) $(POFILE)
189
190syncutil: $(SYNCPROG)
191
192$(POFILE): $(POFILES)
193	$(RM) $@
194	cat $(POFILES) > $@
195
196%.o: $(CMDINETCOMMONDIR)/%.c
197	$(COMPILE.c) -o $@ $<
198
199in.telnetd: $(K5TELNETOBJS) $(KWARN_OBJS)
200	$(LINK.c) $(K5TELNETOBJS) $(KWARN_OBJS) -o $@ $(LDLIBS)
201	$(POST_PROCESS)
202
203in.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS) $(KWARN_OBJS)
204	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) $(KWARN_OBJS) -o $@ $(LDLIBS)
205	$(POST_PROCESS)
206
207in.rshd: $(K5RSHDOBJS) $(COMMONOBJS) $(KWARN_OBJS)
208	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) $(KWARN_OBJS) -o $@ $(LDLIBS)
209	$(POST_PROCESS)
210
211in.tftpd: $(TFTPDOBJS)
212	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
213	$(POST_PROCESS)
214
215tftpsubs.o: $(OTHERSRC)
216	$(COMPILE.c) $(OTHERSRC) -o $@
217	$(POST_PROCESS_O)
218
219$(ROOTUSRSBINLINKS):
220	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
221
222install: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
223	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
224	$(ROOTMANIFEST) THIRDPARTYLICENSE.arp
225
226THIRDPARTYLICENSE.arp: arp.c
227	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
228
229CLOBBERFILES += THIRDPARTYLICENSE.arp
230
231#
232# The reason this rule checks for the existence of the
233# Makefile is that some of the directories do not exist
234# in our exportable source builds.
235#
236$(SUBDIRS): FRC
237	@if [ -f $@/Makefile  ]; then \
238		cd $@; pwd; $(MAKE) $(TARGET); \
239	else \
240		true; \
241	fi
242
243FRC:
244
245check:	$(CHKMANIFEST)
246
247clean:	$(SUBDIRS)
248	-$(RM) $(CLEANFILES)
249
250clobber: $(SUBDIRS)
251	-$(RM) $(CLEANFILES) $(CLOBBERFILES)
252
253lint: $(LINTSUBDIRS)
254	$(LINT.c) 6to4relay.c $(LDLIBS) -lsocket -lnsl
255	$(LINT.c) arp.c $(LDLIBS) -lsocket -lnsl
256	@# $(LINT.c) in.rexecd.c $(LDLIBS) -lbsm -lpam
257	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
258		-I$(SRC)/head -I$(SRC)/uts/common/ \
259		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
260		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
261		-I$(SRC)/lib/pam_modules/krb5 \
262		in.rlogind.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
263	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
264		-I$(SRC)/head -I$(SRC)/uts/common/ \
265		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
266		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
267		-I$(SRC)/lib/pam_modules/krb5 \
268		in.rshd.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
269	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 \
270		-erroff=E_GLOBAL_COULD_BE_STATIC2 \
271		-I$(SRC)/head -I$(SRC)/uts/common/ \
272		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
273		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
274		-I$(SRC)/lib/pam_modules/krb5 \
275		in.telnetd.c $(LDLIBS) -lbsm -lpam -lsocket -lnsl
276	$(LINT.c) if_mpadm.c $(LDLIBS) -lsocket -lnsl -lipmp
277	$(LINT.c) ipaddrsel.c $(LDLIBS) -lsocket -lnsl
278	$(LINT.c) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
279	$(LINT.c) syncinit.c $(LDLIBS) -ldlpi
280	$(LINT.c) syncloop.c $(LDLIBS) -ldlpi
281	$(LINT.c) syncstat.c $(LDLIBS) -ldlpi
282	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 in.rarpd.c $(LDLIBS) \
283	    -lsocket -lnsl
284	$(LINT.c) in.tftpd.c ../usr.bin/tftp/tftpsubs.c $(LDLIBS) \
285	    -lsocket -lnsl
286
287# EXPORT DELETE START
288EXPORT_SRC:
289	$(RM) Makefile+
290	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
291		< Makefile > Makefile+
292	$(RM) Makefile
293	$(MV) Makefile+ Makefile
294	$(CHMOD) 444 Makefile
295# EXPORT DELETE END
296