xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.sbin/Makefile (revision 3e95bd4ab92abca814bd28e854607d1975c7dc88)
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 (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
24#
25
26SYNCPROG=	syncinit syncloop syncstat
27DHCPPROG=	dhcpconfig dhtadm pntadm
28
29# EXPORT DELETE START
30XMODPROG=	wanbootutil
31# EXPORT DELETE END
32
33PROG=		6to4relay arp gettable if_mpadm \
34		in.comsat in.fingerd in.rarpd in.rexecd in.rlogind \
35		in.rshd in.rwhod in.telnetd in.tftpd ipaddrsel \
36		ndd $(SYNCPROG) $(DHCPPROG) $(XMODPROG)
37
38MANIFEST=	rarp.xml telnet.xml comsat.xml finger.xml \
39		login.xml shell.xml rexec.xml
40SVCMETHOD=	svc-sockfilter
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 \
110		soconfig.po
111POFILE=		usr.sbin.po
112
113all:=		TARGET= all
114install:=	TARGET= install
115clean:=		TARGET= clean
116clobber:=	TARGET= clobber
117lint:=		TARGET= lint
118_msg:=		TARGET= _msg
119
120CLOBBERFILES +=	$(ROOTFS_PROG) $(PROG)
121CLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS)
122
123CPPFLAGS +=	-DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
124
125include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
126K5LIBS=
127
128# Eventually just plain CFLAGS should be += -v, but not until all in
129# PROGS are lint clean.
130$(LINTCLEAN)		:=	CFLAGS += $(CCVERBOSE)
131$(CONSTCLEAN)		:=	CFLAGS += $(XSTRCONST)
132
133$(SYNCPROG)		:=	LDLIBS += -ldlpi
134$(SOCKETPROG)		:=	LDLIBS += -lsocket
135$(NSLPROG)		:=	LDLIBS += -lnsl
136$(AUDITPROG)		:=	LDLIBS += -lbsm
137$(PAMPROG)		:=	LDLIBS += -lpam
138$(RPCSVCPROG)		:=	LDLIBS += -lrpcsvc
139$(K5PROGS)		:=	LDFLAGS += $(KRUNPATH) \
140				-L$(ROOT)$(KLIBDIR_DO) -L$(ROOT)$(KLIBDIR_GL)
141$(K5PROGS)		:=	K5LIBS=  -lmech_krb5
142$(K5PROGS)		:=	CPPFLAGS += -I$(SRC)/head \
143				-I$(SRC)/uts/common/ \
144				-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
145				-I$(SRC)/lib/gss_mechs/mech_krb5/include \
146				-I$(SRC)/lib/pam_modules/krb5
147LDLIBS +=	$(K5LIBS)
148$(TSNETPROG)		:=	LDLIBS += -ltsnet
149$(DLADMPROG)		:=	LDLIBS += -ldladm
150
151in.rarpd		:=	LDLIBS += -linetutil -ldlpi
152if_mpadm		:=	LDLIBS += -linetutil -lipmp
153if_mpadm.po		:=	XGETFLAGS += -a
154route			:=	CPPFLAGS += -DNDEBUG
155ndd			:=	LDLIBS += -ldladm -lipadm
156gettable in.comsat	:=	LDFLAGS += $(MAPFILE.NGB:%=-M%)
157
158.KEEP_STATE:
159
160.PARALLEL:
161
162all: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
163
164#
165# message catalog
166#
167_msg: $(MSGSUBDIRS) $(POFILE)
168
169syncutil: $(SYNCPROG)
170
171$(POFILE): $(POFILES)
172	$(RM) $@
173	cat $(POFILES) > $@
174
175%.o: $(CMDINETCOMMONDIR)/%.c
176	$(COMPILE.c) -o $@ $<
177
178in.telnetd: $(K5TELNETOBJS)
179	$(LINK.c) $(K5TELNETOBJS) -o $@ $(LDLIBS)
180	$(POST_PROCESS)
181
182in.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
183	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
184	$(POST_PROCESS)
185
186in.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
187	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
188	$(POST_PROCESS)
189
190in.tftpd: $(TFTPDOBJS)
191	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
192	$(POST_PROCESS)
193
194tftpsubs.o: $(OTHERSRC)
195	$(COMPILE.c) $(OTHERSRC) -o $@
196	$(POST_PROCESS_O)
197
198$(ROOTUSRSBINLINKS):
199	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
200
201install: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
202	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
203	$(ROOTMANIFEST) $(ROOTSVCMETHOD) THIRDPARTYLICENSE.arp
204
205THIRDPARTYLICENSE.arp: arp.c
206	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
207
208CLOBBERFILES += THIRDPARTYLICENSE.arp
209
210#
211# The reason this rule checks for the existence of the
212# Makefile is that some of the directories do not exist
213# in our exportable source builds.
214#
215$(SUBDIRS): FRC
216	@if [ -f $@/Makefile  ]; then \
217		cd $@; pwd; $(MAKE) $(TARGET); \
218	else \
219		true; \
220	fi
221
222FRC:
223
224check:	$(CHKMANIFEST)
225
226clean:	$(SUBDIRS)
227	-$(RM) $(CLEANFILES)
228
229clobber: $(SUBDIRS)
230	-$(RM) $(CLEANFILES) $(CLOBBERFILES)
231
232lint: $(LINTSUBDIRS)
233	$(LINT.c) 6to4relay.c $(LDLIBS) -lsocket -ldladm
234	$(LINT.c) arp.c $(LDLIBS) -lsocket -lnsl
235	@# $(LINT.c) in.rexecd.c $(LDLIBS) -lbsm -lpam
236	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
237		-I$(SRC)/head -I$(SRC)/uts/common/ \
238		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
239		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
240		-I$(SRC)/lib/pam_modules/krb5 \
241		in.rlogind.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
242	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
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.rshd.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
248	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 \
249		-erroff=E_GLOBAL_COULD_BE_STATIC2 \
250		-I$(SRC)/head -I$(SRC)/uts/common/ \
251		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
252		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
253		-I$(SRC)/lib/pam_modules/krb5 \
254		in.telnetd.c $(LDLIBS) -lbsm -lpam -lsocket -lnsl
255	$(LINT.c) if_mpadm.c $(LDLIBS) -lsocket -lnsl -lipmp -linetutil
256	$(LINT.c) ipaddrsel.c $(LDLIBS) -lsocket -lnsl
257	$(LINT.c) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
258	$(LINT.c) syncinit.c $(LDLIBS) -ldlpi
259	$(LINT.c) syncloop.c $(LDLIBS) -ldlpi
260	$(LINT.c) syncstat.c $(LDLIBS) -ldlpi
261	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 in.rarpd.c $(LDLIBS) \
262	    -lsocket -lnsl
263	$(LINT.c) in.tftpd.c ../usr.bin/tftp/tftpsubs.c $(LDLIBS) \
264	    -lsocket -lnsl
265
266# EXPORT DELETE START
267EXPORT_SRC:
268	$(RM) Makefile+
269	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
270		< Makefile > Makefile+
271	$(RM) Makefile
272	$(MV) Makefile+ Makefile
273	$(CHMOD) 444 Makefile
274# EXPORT DELETE END
275