xref: /titanic_50/usr/src/cmd/cmd-inet/usr.sbin/Makefile (revision 41efec2219526a9b3ecce26f97aba761ef1e1d0d)
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 \
70		kssl/ksslcfg  mipagentconfig mipagentstat ping routeadm \
71		snoop sppptun traceroute wificonfig ipsecutils
72
73MSGSUBDIRS=	bootconfchk htable ifconfig in.ftpd in.routed in.talkd \
74		inetadm inetconv ipqosconf kssl/ksslcfg mipagentconfig \
75		mipagentstat 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 in.rdisc in.routed in.talkd inetadm inetconv \
88		ipqosconf mipagentstat ping routeadm sppptun traceroute \
89		wificonfig ipsecutils
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
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 += $(ZLAZYLOAD) $(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 += $(ZLAZYLOAD) -ltsnet $(ZNOLAZYLOAD)
148
149in.rarpd		:=	LDLIBS += -linetutil -ldlpi
150route			:=	CPPFLAGS += -DNDEBUG
151gettable in.comsat	:=	LDFLAGS += $(MAPFILE.NGB:%=-M%)
152
153.KEEP_STATE:
154
155.PARALLEL:
156
157all: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
158
159#
160# message catalog
161#
162_msg: $(MSGSUBDIRS) $(POFILE)
163
164syncutil: $(SYNCPROG)
165
166$(POFILE): $(POFILES)
167	$(RM) $@
168	cat $(POFILES) > $@
169
170%.o: $(CMDINETCOMMONDIR)/%.c
171	$(COMPILE.c) -o $@ $<
172
173in.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
174	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
175	$(POST_PROCESS)
176
177in.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
178	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
179	$(POST_PROCESS)
180
181in.tftpd: $(TFTPDOBJS)
182	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
183	$(POST_PROCESS)
184
185tftpsubs.o: $(OTHERSRC)
186	$(COMPILE.c) $(OTHERSRC) -o $@
187	$(POST_PROCESS_O)
188
189$(ROOTUSRSBINLINKS):
190	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
191
192install: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
193	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
194	$(ROOTMANIFEST) THIRDPARTYLICENSE.arp
195
196THIRDPARTYLICENSE.arp: arp.c
197	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
198
199CLOBBERFILES += THIRDPARTYLICENSE.arp
200
201#
202# The reason this rule checks for the existence of the
203# Makefile is that some of the directories do not exist
204# in our exportable source builds.
205#
206$(SUBDIRS): FRC
207	@if [ -f $@/Makefile  ]; then \
208		cd $@; pwd; $(MAKE) $(TARGET); \
209	else \
210		true; \
211	fi
212
213FRC:
214
215check:	$(CHKMANIFEST)
216
217clean:	$(SUBDIRS)
218	-$(RM) $(CLEANFILES)
219
220clobber: $(SUBDIRS)
221	-$(RM) $(CLEANFILES) $(CLOBBERFILES)
222
223lint: $(LINTSUBDIRS)
224	$(LINT.c) 6to4relay.c $(LDLIBS) -lsocket -lnsl
225	$(LINT.c) arp.c $(LDLIBS) -lsocket -lnsl
226	@# $(LINT.c) in.rexecd.c $(LDLIBS) -lbsm -lpam
227	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
228		-I$(SRC)/head -I$(SRC)/uts/common/ \
229		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
230		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
231		-I$(SRC)/lib/pam_modules/krb5 \
232		in.rlogind.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
233	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
234		-I$(SRC)/head -I$(SRC)/uts/common/ \
235		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
236		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
237		-I$(SRC)/lib/pam_modules/krb5 \
238		in.rshd.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
239	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 \
240		-erroff=E_GLOBAL_COULD_BE_STATIC2 \
241		-I$(SRC)/head -I$(SRC)/uts/common/ \
242		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
243		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
244		-I$(SRC)/lib/pam_modules/krb5 \
245		in.telnetd.c $(LDLIBS) -lbsm -lpam -lsocket -lnsl
246	$(LINT.c) if_mpadm.c $(LDLIBS) -lsocket -lnsl -lipmp
247	$(LINT.c) ipaddrsel.c $(LDLIBS) -lsocket -lnsl
248	$(LINT.c) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
249	$(LINT.c) syncinit.c $(LDLIBS) -ldlpi
250	$(LINT.c) syncloop.c $(LDLIBS) -ldlpi
251	$(LINT.c) syncstat.c $(LDLIBS) -ldlpi
252	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 in.rarpd.c $(LDLIBS) \
253	    -lsocket -lnsl
254	$(LINT.c) in.tftpd.c ../usr.bin/tftp/tftpsubs.c $(LDLIBS) \
255	    -lsocket -lnsl
256
257# EXPORT DELETE START
258EXPORT_SRC:
259	$(RM) Makefile+
260	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
261		< Makefile > Makefile+
262	$(RM) Makefile
263	$(MV) Makefile+ Makefile
264	$(CHMOD) 444 Makefile
265# EXPORT DELETE END
266