Makefile revision 10946:324bab2b3370
1193323Sed#
2193323Sed# CDDL HEADER START
3193323Sed#
4193323Sed# The contents of this file are subject to the terms of the
5193323Sed# Common Development and Distribution License (the "License").
6193323Sed# You may not use this file except in compliance with the License.
7193323Sed#
8193323Sed# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9193323Sed# or http://www.opensolaris.org/os/licensing.
10193323Sed# See the License for the specific language governing permissions
11193323Sed# and limitations under the License.
12193323Sed#
13193323Sed# When distributing Covered Code, include this CDDL HEADER in each
14193323Sed# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15193323Sed# If applicable, add the following below this CDDL HEADER, with the
16193323Sed# fields enclosed by brackets "[]" replaced with your own identifying
17193323Sed# information: Portions Copyright [yyyy] [name of copyright owner]
18193323Sed#
19193323Sed# CDDL HEADER END
20193323Sed#
21193323Sed
22193323Sed#
23193323Sed# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24193323Sed# Use is subject to license terms.
25193323Sed#
26193323Sed
27193323SedSYNCPROG=	syncinit syncloop syncstat
28193323SedDHCPPROG=	dhcpconfig dhtadm pntadm
29193323Sed
30193323Sed# EXPORT DELETE START
31193323SedXMODPROG=	wanbootutil
32193323Sed# EXPORT DELETE END
33193323Sed
34193323SedPROG=		6to4relay arp gettable if_mpadm \
35193323Sed		in.comsat in.fingerd in.rarpd in.rexecd in.rlogind \
36193323Sed		in.rshd in.rwhod in.telnetd in.tftpd ipaddrsel \
37193323Sed		ndd $(SYNCPROG) $(DHCPPROG) $(XMODPROG)
38193323Sed
39193323SedMANIFEST=	rarp.xml telnet.xml comsat.xml finger.xml \
40193323Sed		login.xml shell.xml rexec.xml 
41193323Sed
42193323SedROOTFS_PROG=	hostconfig route soconfig
43193323SedSBINLINKS=	hostconfig route
44193323Sed
45193323SedRPCSVCPROG=	hostconfig
46193323SedAUDITPROG=	in.rexecd in.rlogind in.rshd in.telnetd
47193323SedPAMPROG=	in.rexecd in.rlogind in.rshd in.telnetd
48193323SedSOCKETPROG=	6to4relay arp gettable hostconfig if_mpadm in.comsat \
49193323Sed		in.fingerd in.rarpd in.rexecd in.rlogind in.rshd \
50193323Sed		in.rwhod in.telnetd in.tftpd ipaddrsel route
51193323SedNSLPROG=	6to4relay arp gettable hostconfig in.comsat in.rarpd \
52193323Sed		in.rexecd in.rlogind in.rshd in.rwhod in.telnetd \
53193323Sed		in.tftpd ipaddrsel route
54193323SedCMDPROG=	in.telnetd
55193323SedK5PROGS=	in.telnetd in.rlogind in.rshd
56193323SedTSNETPROG=	route
57193323SedDLADMPROG=	6to4relay ndd
58193323SedDEFAULTFILES=	telnetd.dfl
59193323Sed
60193323SedPROGSRCS=	$(PROG:%=%.c)
61193323SedTFTPDOBJS=	in.tftpd.o tftpsubs.o
62193323SedOTHERSRC=	../usr.bin/tftp/tftpsubs.c
63193323SedK5RLOGINOBJS=	in.rlogind.o
64193323SedK5RSHDOBJS=	in.rshd.o
65193323SedK5TELNETOBJS=	in.telnetd.o
66193323SedSRCS=		$(PROGSRCS) $(OTHERSRC)
67193323Sed
68193323SedSUBDIRS=	bootconfchk htable ifconfig ilbadm in.ftpd in.rdisc in.routed \
69193323Sed		in.talkd inetadm inetconv ipmpstat ipqosconf ipsecutils \
70193323Sed		kssl/kssladm kssl/ksslcfg ping routeadm snoop sppptun \
71193323Sed		traceroute wificonfig
72193323Sed
73193323SedMSGSUBDIRS=	bootconfchk htable ifconfig ilbadm in.ftpd in.routed in.talkd \
74193323Sed		inetadm inetconv ipmpstat ipqosconf ipsecutils kssl/ksslcfg \
75193323Sed		routeadm sppptun snoop wificonfig
76193323Sed
77193323Sed# As programs get lint-clean, add them here and to the 'lint' target.
78193323Sed# Eventually this hack should go away, and all in PROG should be
79193323Sed# lint-clean.
80193323SedLINTCLEAN=	6to4relay arp in.rlogind in.rshd in.telnetd in.tftpd \
81193323Sed		ipaddrsel route \
82193323Sed		in.rarpd if_mpadm $(SYNCPROG)
83193323Sed# Likewise, as subdirs get lint-clean, add them here.  Once
84193323Sed# they're all clean, replace the dependency of the lint target
85193323Sed# with SUBDIRS.  Also (sigh) deal with the commented-out build lines
86193323Sed# for the lint rule.
87193323SedLINTSUBDIRS=	bootconfchk ilbadm in.rdisc in.routed in.talkd inetadm \
88193323Sed		inetconv ipmpstat ipqosconf ipsecutils ping routeadm sppptun \
89193323Sed		traceroute wificonfig
90193323Sed# And as programs are verified not to attempt to write into constants,
91193323Sed# -xstrconst should be used to ensure they stay that way.
92193323SedCONSTCLEAN=
93193323Sed
94193323Sedinclude ../../Makefile.cmd
95193323SedROOTMANIFESTDIR=	$(ROOTSVCNETWORK)
96193323Sed$(ROOTMANIFEST)		:= FILEMODE= 444
97193323Sedinclude ../Makefile.cmd-inet
98193323Sed
99193323SedROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
100193323SedROOTUSRSBINLINKS = $(SBINLINKS:%=$(ROOTUSRSBIN)/%)
101193323Sed
102193323SedCOMMONOBJS=	addr_match.o kcmd.o store_forw_creds.o
103193323SedCOMMONSRCS=	$(COMMONOBJS:%.o=$(CMDINETCOMMONDIR)/%.c)
104193323SedSRCS+=		$(COMMONSRCS)
105193323Sed
106193323Sed#
107193323Sed# Message catalog
108193323Sed#
109193323SedPOFILES=	6to4relay.po if_mpadm.po in.comsat.po ipaddrsel.po route.po
110193323SedPOFILE=		usr.sbin.po
111193323Sed
112193323Sedall:=		TARGET= all
113193323Sedinstall:=	TARGET= install
114193323Sedclean:=		TARGET= clean
115193323Sedclobber:=	TARGET= clobber
116193323Sedlint:=		TARGET= lint
117193323Sed_msg:=		TARGET= _msg
118193323Sed
119193323SedCLOBBERFILES +=	$(ROOTFS_PROG) $(PROG)
120193323SedCLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS)
121193323Sed
122193323SedCPPFLAGS +=	-DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
123193323Sed
124193323Sedinclude $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
125193323SedK5LIBS=
126193323Sed
127193323Sed# Eventually just plain CFLAGS should be += -v, but not until all in
128193323Sed# PROGS are lint clean.
129193323Sed$(LINTCLEAN)		:=	CFLAGS += $(CCVERBOSE)
130193323Sed$(CONSTCLEAN)		:=	CFLAGS += $(XSTRCONST)
131193323Sed
132193323Sed$(SYNCPROG)		:=	LDLIBS += -ldlpi
133193323Sed$(SOCKETPROG)		:=	LDLIBS += -lsocket
134193323Sed$(NSLPROG)		:=	LDLIBS += -lnsl
135193323Sed$(AUDITPROG)		:=	LDLIBS += -lbsm
136193323Sed$(PAMPROG)		:=	LDLIBS += -lpam
137193323Sed$(RPCSVCPROG)		:=	LDLIBS += -lrpcsvc
138193323Sed$(K5PROGS)		:=	LDFLAGS += $(KRUNPATH) \
139193323Sed				-L$(ROOT)$(KLIBDIR_DO) -L$(ROOT)$(KLIBDIR_GL)
140193323Sed$(K5PROGS)		:=	K5LIBS=  -lmech_krb5
141193323Sed$(K5PROGS)		:=	CPPFLAGS += -I$(SRC)/head \
142193323Sed				-I$(SRC)/uts/common/ \
143193323Sed				-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
144193323Sed				-I$(SRC)/lib/gss_mechs/mech_krb5/include \
145193323Sed				-I$(SRC)/lib/pam_modules/krb5
146193323SedLDLIBS +=	$(K5LIBS)
147193323Sed$(TSNETPROG)		:=	LDLIBS += -ltsnet
148193323Sed$(DLADMPROG)		:=	LDLIBS += -ldladm
149193323Sed
150193323Sedin.rarpd		:=	LDLIBS += -linetutil -ldlpi
151193323Sedif_mpadm		:=	LDLIBS += -linetutil -lipmp
152193323Sedif_mpadm.po		:=	XGETFLAGS += -a
153193323Sedroute			:=	CPPFLAGS += -DNDEBUG
154193323Sedgettable in.comsat	:=	LDFLAGS += $(MAPFILE.NGB:%=-M%)
155193323Sed
156193323Sed.KEEP_STATE:
157193323Sed
158193323Sed.PARALLEL:
159193323Sed
160193323Sedall: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) THIRDPARTYLICENSE.arp
161193323Sed
162193323Sed#
163193323Sed# message catalog
164193323Sed#
165193323Sed_msg: $(MSGSUBDIRS) $(POFILE)
166193323Sed
167193323Sedsyncutil: $(SYNCPROG)
168193323Sed
169193323Sed$(POFILE): $(POFILES)
170193323Sed	$(RM) $@
171193323Sed	cat $(POFILES) > $@
172193323Sed
173193323Sed%.o: $(CMDINETCOMMONDIR)/%.c
174193323Sed	$(COMPILE.c) -o $@ $<
175193323Sed
176193323Sedin.telnetd: $(K5TELNETOBJS)
177193323Sed	$(LINK.c) $(K5TELNETOBJS) -o $@ $(LDLIBS)
178193323Sed	$(POST_PROCESS)
179193323Sed
180193323Sedin.rlogind: $(K5RLOGINOBJS) $(COMMONOBJS)
181193323Sed	$(LINK.c) $(K5RLOGINOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
182193323Sed	$(POST_PROCESS)
183193323Sed
184193323Sedin.rshd: $(K5RSHDOBJS) $(COMMONOBJS)
185193323Sed	$(LINK.c) $(K5RSHDOBJS) $(COMMONOBJS) -o $@ $(LDLIBS)
186193323Sed	$(POST_PROCESS)
187193323Sed
188193323Sedin.tftpd: $(TFTPDOBJS)
189193323Sed	$(LINK.c) $(TFTPDOBJS) -o $@ $(LDLIBS)
190193323Sed	$(POST_PROCESS)
191193323Sed
192193323Sedtftpsubs.o: $(OTHERSRC)
193193323Sed	$(COMPILE.c) $(OTHERSRC) -o $@
194193323Sed	$(POST_PROCESS_O)
195193323Sed
196193323Sed$(ROOTUSRSBINLINKS):
197193323Sed	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
198193323Sed
199193323Sedinstall: $(PROG) $(ROOTFS_PROG) $(SUBDIRS) .WAIT $(ROOTUSRSBINPROG) \
200193323Sed	$(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTETCDEFAULTFILES) \
201193323Sed	$(ROOTMANIFEST) THIRDPARTYLICENSE.arp
202193323Sed
203193323SedTHIRDPARTYLICENSE.arp: arp.c
204193323Sed	$(SED) -n '/University of California/,/SUCH DAMAGE/p' arp.c > $@
205193323Sed
206193323SedCLOBBERFILES += THIRDPARTYLICENSE.arp
207193323Sed
208193323Sed#
209193323Sed# The reason this rule checks for the existence of the
210193323Sed# Makefile is that some of the directories do not exist
211193323Sed# in our exportable source builds.
212193323Sed#
213193323Sed$(SUBDIRS): FRC
214193323Sed	@if [ -f $@/Makefile  ]; then \
215193323Sed		cd $@; pwd; $(MAKE) $(TARGET); \
216193323Sed	else \
217193323Sed		true; \
218193323Sed	fi
219193323Sed
220193323SedFRC:
221193323Sed
222193323Sedcheck:	$(CHKMANIFEST)
223193323Sed
224193323Sedclean:	$(SUBDIRS)
225193323Sed	-$(RM) $(CLEANFILES)
226193323Sed
227193323Sedclobber: $(SUBDIRS)
228193323Sed	-$(RM) $(CLEANFILES) $(CLOBBERFILES)
229193323Sed
230193323Sedlint: $(LINTSUBDIRS)
231193323Sed	$(LINT.c) 6to4relay.c $(LDLIBS) -lsocket -ldladm
232193323Sed	$(LINT.c) arp.c $(LDLIBS) -lsocket -lnsl
233193323Sed	@# $(LINT.c) in.rexecd.c $(LDLIBS) -lbsm -lpam
234193323Sed	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
235193323Sed		-I$(SRC)/head -I$(SRC)/uts/common/ \
236193323Sed		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
237193323Sed		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
238193323Sed		-I$(SRC)/lib/pam_modules/krb5 \
239193323Sed		in.rlogind.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
240193323Sed	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 -erroff=E_NAME_DEF_NOT_USED2 \
241193323Sed		-I$(SRC)/head -I$(SRC)/uts/common/ \
242193323Sed		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
243193323Sed		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
244193323Sed		-I$(SRC)/lib/pam_modules/krb5 \
245193323Sed		in.rshd.c $(COMMONSRCS) $(LDLIBS) -lbsm -lpam -lsocket -lnsl
246193323Sed	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 \
247193323Sed		-erroff=E_GLOBAL_COULD_BE_STATIC2 \
248193323Sed		-I$(SRC)/head -I$(SRC)/uts/common/ \
249193323Sed		-I$(SRC)/uts/common/gssapi/mechs/krb5/include \
250193323Sed		-I$(SRC)/lib/gss_mechs/mech_krb5/include \
251193323Sed		-I$(SRC)/lib/pam_modules/krb5 \
252193323Sed		in.telnetd.c $(LDLIBS) -lbsm -lpam -lsocket -lnsl
253193323Sed	$(LINT.c) if_mpadm.c $(LDLIBS) -lsocket -lnsl -lipmp -linetutil
254193323Sed	$(LINT.c) ipaddrsel.c $(LDLIBS) -lsocket -lnsl
255193323Sed	$(LINT.c) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
256193323Sed	$(LINT.c) syncinit.c $(LDLIBS) -ldlpi
257193323Sed	$(LINT.c) syncloop.c $(LDLIBS) -ldlpi
258193323Sed	$(LINT.c) syncstat.c $(LDLIBS) -ldlpi
259193323Sed	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 in.rarpd.c $(LDLIBS) \
260193323Sed	    -lsocket -lnsl
261193323Sed	$(LINT.c) in.tftpd.c ../usr.bin/tftp/tftpsubs.c $(LDLIBS) \
262193323Sed	    -lsocket -lnsl
263193323Sed
264193323Sed# EXPORT DELETE START
265193323SedEXPORT_SRC:
266193323Sed	$(RM) Makefile+
267193323Sed	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
268193323Sed		< Makefile > Makefile+
269193323Sed	$(RM) Makefile
270193323Sed	$(MV) Makefile+ Makefile
271193323Sed	$(CHMOD) 444 Makefile
272193323Sed# EXPORT DELETE END
273193323Sed