xref: /titanic_44/usr/src/cmd/Makefile.cmd (revision 1e4c938b57d1656808e4112127ff1dce3eba5314)
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# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23#
24# Definitions common to command source.
25#
26# include global definitions; SRC should be defined in the shell.
27# SRC is needed until RFE 1026993 is implemented.
28
29include $(SRC)/Makefile.master
30
31LN=		ln
32SH=		sh
33ECHO=		echo
34MKDIR=		mkdir
35TOUCH=		touch
36
37FILEMODE=	0555
38LIBFILEMODE=	0444
39XPG4=		$(XPG4PROG:%=%.xpg4)
40XPG6=		$(XPG6PROG:%=%.xpg6)
41
42KRB5DIR=	$(ROOT)/usr
43KRB5BIN=	$(KRB5DIR)/bin
44KRB5SBIN=	$(KRB5DIR)/sbin
45KRB5LIB=	$(KRB5DIR)/lib/krb5
46KRB5RUNPATH=	/usr/lib/krb5
47GSSRUNPATH=	/usr/lib/gss
48
49
50ROOTBIN=		$(ROOT)/usr/bin
51ROOTLIB=		$(ROOT)/usr/lib
52ROOTLIBSVCBIN=		$(ROOT)/lib/svc/bin
53ROOTLIBSVCMETHOD=	$(ROOT)/lib/svc/method
54ROOTLIBXEN=		$(ROOT)/usr/lib/xen/bin
55ROOTLIBZONES=		$(ROOT)/lib/zones
56
57ROOTSHLIB=	$(ROOT)/usr/share/lib
58ROOTPKGBIN=	$(ROOT)/usr/sadm/install/bin
59ROOTCLASS_SCR_DIR= $(ROOT)/usr/sadm/install/scripts
60ROOTADMIN_SRC_DIR= $(ROOT)/var/sadm/install/admin
61
62ROOTSHLIBCCS=	$(ROOTSHLIB)/ccs
63ROOTSBIN=	$(ROOT)/sbin
64ROOTUSRSBIN=	$(ROOT)/usr/sbin
65ROOTETC=	$(ROOT)/etc
66
67ROOTETCSECURITY=	$(ROOTETC)/security
68ROOTETCTSOL=	$(ROOTETCSECURITY)/tsol
69ROOTETCSECLIB=	$(ROOTETCSECURITY)/lib
70ROOTETCZONES=	$(ROOTETC)/zones
71
72ROOTETCINET=	$(ROOT)/etc/inet
73ROOTCCSBIN=	$(ROOT)/usr/ccs/bin
74ROOTCCSBIN64=	$(ROOTCCSBIN)/$(MACH64)
75ROOTCCSBINLINKDIR=	$(ROOT)/../../bin
76ROOTCCSBINLINKDIR64=	$(ROOT)../../../bin/$(MACH)
77ROOTUSRKVM=	$(ROOT)/usr/kvm
78ROOTHAS=	$(ROOT)/usr/has
79ROOTHASBIN=	$(ROOT)/usr/has/bin
80ROOTHASLIB=	$(ROOT)/usr/has/lib
81ROOTXPG4=	$(ROOT)/usr/xpg4
82ROOTXPG4BIN=	$(ROOT)/usr/xpg4/bin
83ROOTXPG4BIN32=	$(ROOTXPG4BIN)/$(MACH32)
84ROOTXPG4BIN64=	$(ROOTXPG4BIN)/$(MACH64)
85ROOTXPG6=	$(ROOT)/usr/xpg6
86ROOTXPG6BIN=	$(ROOT)/usr/xpg6/bin
87ROOTLOCALEDEF=	$(ROOT)/usr/lib/localedef
88ROOTCHARMAP=	$(ROOTLOCALEDEF)/charmap
89ROOTI18NEXT=	$(ROOTLOCALEDEF)/extensions
90ROOTI18NEXT64=	$(ROOTLOCALEDEF)/extensions/$(MACH64)
91ROOTBIN32=	$(ROOTBIN)/$(MACH32)
92ROOTBIN64=	$(ROOTBIN)/$(MACH64)
93ROOTCMDDIR64=	$(ROOTCMDDIR)/$(MACH64)
94ROOTLIB64=	$(ROOTLIB)/$(MACH64)
95ROOTUSRSBIN32=	$(ROOTUSRSBIN)/$(MACH32)
96ROOTUSRSBIN64=	$(ROOTUSRSBIN)/$(MACH64)
97ROOTMAN=	$(ROOT)/usr/share/man
98ROOTMAN1=	$(ROOTMAN)/man1
99ROOTMAN1M=	$(ROOTMAN)/man1m
100ROOTMAN3=	$(ROOTMAN)/man3
101ROOTVARSMB=	$(ROOT)/var/smb
102
103
104#
105# Like ROOTLIBDIR in $(SRC)/Makefile.lib, any lower-level Makefiles that
106# put their binaries in a non-standard location should reset this and use
107# $(ROOTCMD) in their `install' target. By default we set this to a bogus
108# value so that it will not conflict with any of the other values already
109# defined in this Makefile.
110#
111ROOTCMDDIR=	$(ROOT)/__nonexistent_directory__
112
113ROOTSHAUDIO=	$(ROOT)/usr/share/audio
114ROOTAUDIOSAMP=	$(ROOTSHAUDIO)/samples
115ROOTAUDIOSAMPAU=$(ROOTAUDIOSAMP)/au
116
117ISAEXEC=	$(ROOT)/usr/lib/isaexec
118PLATEXEC=	$(ROOT)/usr/lib/platexec
119
120LDLIBS =	$(LDLIBS.cmd)
121
122LDFLAGS.cmd = \
123	$(BDIRECT) $(ENVLDFLAGS1) $(ENVLDFLAGS2) $(ENVLDFLAGS3) \
124	$(MAPFILE.NES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%)
125
126LDFLAGS =	$(LDFLAGS.cmd)
127
128LINTFLAGS=	-axsm
129LINTFLAGS64=	-axsm -m64
130LINTOUT=	lint.out
131
132KRB5PROG=	$(PROG:%=$(KRB5BIN)/%)
133KRB5SBINPROG=	$(PROG:%=$(KRB5SBIN)/%)
134KRB5LIBPROG=	$(PROG:%=$(KRB5LIB)/%)
135
136ROOTPROG=	$(PROG:%=$(ROOTBIN)/%)
137ROOTCMD=	$(PROG:%=$(ROOTCMDDIR)/%)
138ROOTSHFILES=	$(SHFILES:%=$(ROOTBIN)/%)
139ROOTLIBPROG=	$(PROG:%=$(ROOTLIB)/%)
140ROOTLIBSHFILES= $(SHFILES:%=$(ROOTLIB)/%)
141ROOTSHLIBPROG=	$(PROG:%=$(ROOTSHLIB)/%)
142ROOTSBINPROG=	$(PROG:%=$(ROOTSBIN)/%)
143ROOTPKGBINPROG= $(PROG:%=$(ROOTPKGBIN)/%)
144ROOTCLASS_SCR_FILES= $(SCRIPTS:%=$(ROOTCLASS_SCR_DIR)/%)
145ROOTUSRSBINPROG=$(PROG:%=$(ROOTUSRSBIN)/%)
146ROOTUSRSBINSCRIPT=$(SCRIPT:%=$(ROOTUSRSBIN)/%)
147ROOTETCPROG=	$(PROG:%=$(ROOTETC)/%)
148ROOTHASBINPROG= $(PROG:%=$(ROOTHASBIN)/%)
149ROOTHASLIBPROG= $(PROG:%=$(ROOTHASLIB)/%)
150ROOTCCSBINPROG=	$(PROG:%=$(ROOTCCSBIN)/%)
151ROOTCCSBINPROG64=	  $(PROG:%=$(ROOTCCSBIN64)/%)
152ROOTCCSBINLINK=$(PROG:%=  $(ROOTCCSBINLINKDIR)/%)
153ROOTCCSBINLINK64=$(PROG:%=$(ROOTCCSBINLINKDIR64)/%)
154ROOTUSRKVMPROG=	$(PROG:%=$(ROOTUSRKVM)/%)
155ROOTXPG4PROG=	$(XPG4PROG:%=$(ROOTXPG4BIN)/%)
156ROOTXPG4PROG32=	$(XPG4PROG:%=$(ROOTXPG4BIN32)/%)
157ROOTXPG4PROG64=	$(XPG4PROG:%=$(ROOTXPG4BIN64)/%)
158ROOTXPG6PROG=	$(XPG6PROG:%=$(ROOTXPG6BIN)/%)
159ROOTLOCALEPROG=	$(PROG:%=$(ROOTLOCALEDEF)/%)
160ROOTPROG64=	$(PROG:%=$(ROOTBIN64)/%)
161ROOTPROG32=	$(PROG:%=$(ROOTBIN32)/%)
162ROOTCMD64=	$(PROG:%=$(ROOTCMDDIR64)/%)
163ROOTUSRSBINPROG32=	$(PROG:%=$(ROOTUSRSBIN32)/%)
164ROOTUSRSBINPROG64=	$(PROG:%=$(ROOTUSRSBIN64)/%)
165ROOTMAN1FILES=	$(MAN1FILES:%=$(ROOTMAN1)/%)
166$(ROOTMAN1FILES) := FILEMODE= 444
167ROOTMAN1MFILES=	$(MAN1MFILES:%=$(ROOTMAN1M)/%)
168$(ROOTMAN1MFILES) := FILEMODE= 444
169ROOTMAN3FILES=	$(MAN3FILES:%=$(ROOTMAN3)/%)
170$(ROOTMAN3FILES) := FILEMODE= 444
171
172# Symlink rules for /usr/ccs/bin commands. Note, those commands under
173# the rule of the linker area, are controlled by a different set of
174# rules defined in $(SRC)/cmd/sgs/Makefile.var.
175
176INS.ccsbinlink= \
177	$(RM) $(ROOTCCSBINPROG); \
178	$(SYMLINK) ../../bin/$(PROG) $(ROOTCCSBINPROG)
179
180INS.ccsbinlink64= \
181	$(RM) $(ROOTCCSBINPROG64); \
182	$(SYMLINK) ../../../bin/$(MACH64)/$(PROG) $(ROOTCCSBINPROG64)
183
184ROOTETCDEFAULT=	$(ROOTETC)/default
185ROOTETCDEFAULTFILES=	$(DEFAULTFILES:%.dfl=$(ROOTETCDEFAULT)/%)
186$(ROOTETCDEFAULTFILES) :=	FILEMODE = 0644
187
188ROOTETCSECFILES=	$(ETCSECFILES:%=$(ROOTETCSECURITY)/%)
189$(ROOTETCSECFILES) :=	FILEMODE = 0644
190
191ROOTETCTSOLFILES=	$(ETCTSOLFILES:%=$(ROOTETCTSOL)/%)
192$(ROOTETCTSOLFILES) :=	FILEMODE = 0644
193
194ROOTETCSECLIBFILES=	$(ETCSECLIBFILES:%=$(ROOTETCSECLIB)/%)
195
196ROOTETCZONESFILES=	$(ETCZONESFILES:%=$(ROOTETCZONES)/%)
197$(ROOTETCZONESFILES) :=	FILEMODE = 0444
198
199ROOTLIBZONESFILES=	$(LIBZONESFILES:%=$(ROOTLIBZONES)/%)
200$(ROOTLIBZONESFILES) :=	FILEMODE = 0555
201
202ROOTADMIN_SRC_FILE= $(ADMINFILE:%=$(ROOTADMIN_SRC_DIR)/%)
203$(ROOTADMIN_SRC_FILE) := FILEMODE = 0444
204
205#
206# Directories for smf(5) service manifests and profiles.
207#
208ROOTSVC=			$(ROOT)/lib/svc
209ROOTETCSVC=			$(ROOT)/etc/svc
210
211ROOTSVCMANIFEST=		$(ROOTSVC)/manifest
212ROOTSVCPROFILE=			$(ROOTETCSVC)/profile
213
214ROOTSVCMILESTONE=		$(ROOTSVCMANIFEST)/milestone
215ROOTSVCDEVICE=			$(ROOTSVCMANIFEST)/device
216ROOTSVCSYSTEM=			$(ROOTSVCMANIFEST)/system
217ROOTSVCSYSTEMDEVICE=		$(ROOTSVCSYSTEM)/device
218ROOTSVCSYSTEMFILESYSTEM=	$(ROOTSVCSYSTEM)/filesystem
219ROOTSVCSYSTEMSECURITY=		$(ROOTSVCSYSTEM)/security
220ROOTSVCNETWORK=			$(ROOTSVCMANIFEST)/network
221ROOTSVCNETWORKDNS=		$(ROOTSVCNETWORK)/dns
222ROOTSVCNETWORKISCSI=		$(ROOTSVCNETWORK)/iscsi
223ROOTSVCNETWORKLDAP=		$(ROOTSVCNETWORK)/ldap
224ROOTSVCNETWORKNFS=		$(ROOTSVCNETWORK)/nfs
225ROOTSVCNETWORKNIS=		$(ROOTSVCNETWORK)/nis
226ROOTSVCNETWORKROUTING=		$(ROOTSVCNETWORK)/routing
227ROOTSVCNETWORKRPC=		$(ROOTSVCNETWORK)/rpc
228ROOTSVCNETWORKSMB=		$(ROOTSVCNETWORK)/smb
229ROOTSVCNETWORKSECURITY=		$(ROOTSVCNETWORK)/security
230ROOTSVCNETWORKSSL=		$(ROOTSVCNETWORK)/ssl
231ROOTSVCNETWORKIPSEC=		$(ROOTSVCNETWORK)/ipsec
232ROOTSVCNETWORKSHARES=		$(ROOTSVCNETWORK)/shares
233ROOTSVCSMB=			$(ROOTSVCNETWORK)/smb
234ROOTSVCPLATFORM=		$(ROOTSVCMANIFEST)/platform
235ROOTSVCPLATFORMSUN4U=		$(ROOTSVCPLATFORM)/sun4u
236ROOTSVCPLATFORMSUN4V=		$(ROOTSVCPLATFORM)/sun4v
237ROOTSVCAPPLICATION=		$(ROOTSVCMANIFEST)/application
238ROOTSVCAPPLICATIONMANAGEMENT=	$(ROOTSVCAPPLICATION)/management
239ROOTSVCAPPLICATIONSECURITY=	$(ROOTSVCAPPLICATION)/security
240ROOTSVCAPPLICATIONPRINT=	$(ROOTSVCAPPLICATION)/print
241
242#
243# Commands Makefiles delivering a manifest are expected to define MANIFEST.
244#
245# Like ROOTCMDDIR, any lower-level Makefiles that put their manifests in a
246# subdirectory of the manifest directories listed above should reset
247# ROOTMANIFESTDIR and use it in their `install' target. By default we set this
248# to a bogus value so that it will not conflict with any of the other values
249# already  defined in this Makefile.
250#
251# The manifest validation of the $SRC/cmd check target is also derived from a
252# valid MANIFEST setting.
253#
254ROOTMANIFESTDIR=	$(ROOTSVCMANIFEST)/__nonexistent_directory__
255ROOTMANIFEST=		$(MANIFEST:%=$(ROOTMANIFESTDIR)/%)
256CHKMANIFEST=		$(MANIFEST:%.xml=%.xmlchk)
257
258# Manifests cannot be checked in parallel, because we are using the global
259# repository that is in $(SRC)/cmd/svc/seed/global.db.  This is a
260# repository that is built from the manifests in this workspace, whereas
261# the build machine's repository may be out of sync with these manifests.
262# Because we are using a private repository, svccfg-native must start up a
263# private copy of configd-native.  We cannot have multiple copies of
264# configd-native trying to access global.db simultaneously.
265
266.NO_PARALLEL:	$(CHKMANIFEST)
267
268#
269# For installing "starter scripts" of services
270#
271
272ROOTSVCMETHOD=		$(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
273
274ROOTSVCBINDIR=		$(ROOTLIBSVCBIN)/__nonexistent_directory__
275ROOTSVCBIN= 		$(SVCBIN:%=$(ROOTSVCBINDIR)/%)
276
277#
278
279# For programs that are installed in the root filesystem,
280# build $(ROOTFS_PROG) rather than $(PROG)
281$(ROOTFS_PROG) := LDFLAGS += -Wl,-I/lib/ld.so.1
282
283$(KRB5BIN)/%: %
284	$(INS.file)
285
286$(KRB5SBIN)/%: %
287	$(INS.file)
288
289$(KRB5LIB)/%: %
290	$(INS.file)
291
292$(ROOTBIN)/%: %
293	$(INS.file)
294
295$(ROOTLIB)/%: %
296	$(INS.file)
297
298$(ROOTBIN64)/%: %
299	$(INS.file)
300
301$(ROOTLIB64)/%: %
302	$(INS.file)
303
304$(ROOTBIN32)/%: %
305	$(INS.file)
306
307$(ROOTSHLIB)/%: %
308	$(INS.file)
309
310$(ROOTPKGBIN)/%: %
311	$(INS.file)
312
313$(ROOTCLASS_SCR_DIR)/%: %
314	$(INS.file)
315
316$(ROOTADMIN_SRC_DIR)/%: %
317	$(INS.file)
318
319$(ROOTSBIN)/%: %
320	$(INS.file)
321
322$(ROOTUSRSBIN)/%: %
323	$(INS.file)
324
325$(ROOTUSRSBIN32)/%: %
326	$(INS.file)
327
328$(ROOTUSRSBIN64)/%: %
329	$(INS.file)
330
331$(ROOTETC)/%: %
332	$(INS.file)
333
334$(ROOTETCINET)/%: %
335	$(INS.file)
336
337$(ROOTETCDEFAULT)/%:	%.dfl
338	$(INS.rename)
339
340$(ROOTETCTSOL)/%: %
341	$(INS.file)
342
343$(ROOTETCSECLIB)/%: %
344	$(INS.file)
345
346$(ROOTETCZONES)/%: %
347	$(INS.file)
348
349$(ROOTLIBZONES)/%: %
350	$(INS.file)
351
352$(ROOTLIBXEN)/%: %
353	$(INS.file)
354
355$(ROOTHASBIN)/%: %
356	$(INS.file)
357
358$(ROOTHASLIB)/%: %
359	$(INS.file)
360
361$(ROOTUSRKVM)/%: %
362	$(INS.file)
363
364$(ROOTXPG4BIN)/%: %.xpg4
365	$(INS.rename)
366
367$(ROOTXPG4BIN32)/%: %.xpg4
368	$(INS.rename)
369
370$(ROOTXPG4BIN64)/%: %.xpg4
371	$(INS.rename)
372
373$(ROOTXPG6BIN)/%: %.xpg6
374	$(INS.rename)
375
376$(ROOTLOCALEDEF)/%: %
377	$(INS.file)
378
379$(ROOTCHARMAP)/%: %
380	$(INS.file)
381
382$(ROOTI18NEXT)/%: %
383	$(INS.file)
384
385$(ROOTI18NEXT64)/%: %
386	$(INS.file)
387
388$(ROOTLIBSVCMETHOD)/%: %
389	$(INS.file)
390
391$(ROOTLIBSVCBIN)/%: %
392	$(INS.file)
393
394$(ROOTSVCMILESTONE)/%: %
395	$(INS.file)
396
397$(ROOTSVCDEVICE)/%: %
398	$(INS.file)
399
400$(ROOTSVCSYSTEM)/%: %
401	$(INS.file)
402
403$(ROOTSVCSYSTEMDEVICE)/%: %
404	$(INS.file)
405
406$(ROOTSVCSYSTEMFILESYSTEM)/%: %
407	$(INS.file)
408
409$(ROOTSVCSYSTEMSECURITY)/%: %
410	$(INS.file)
411
412$(ROOTSVCNETWORK)/%: %
413	$(INS.file)
414
415$(ROOTSVCNETWORKLDAP)/%: %
416	$(INS.file)
417
418$(ROOTSVCNETWORKNFS)/%: %
419	$(INS.file)
420
421$(ROOTSVCNETWORKNIS)/%: %
422	$(INS.file)
423
424$(ROOTSVCNETWORKRPC)/%: %
425	$(INS.file)
426
427$(ROOTSVCNETWORKSECURITY)/%: %
428	$(INS.file)
429
430$(ROOTSVCNETWORKSSL)/%: %
431	$(INS.file)
432
433$(ROOTSVCNETWORKIPSEC)/%: %
434	$(INS.file)
435
436$(ROOTSVCNETWORKSHARES)/%: %
437	$(INS.file)
438
439$(ROOTSVCNETWORKSMB)/%: %
440	$(INS.file)
441
442$(ROOTSVCAPPLICATION)/%: %
443	$(INS.file)
444
445$(ROOTSVCAPPLICATIONMANAGEMENT)/%: %
446	$(INS.file)
447
448$(ROOTSVCAPPLICATIONSECURITY)/%: %
449	$(INS.file)
450
451$(ROOTSVCAPPLICATIONPRINT)/%: %
452	$(INS.file)
453
454$(ROOTSVCPLATFORM)/%: %
455	$(INS.file)
456
457$(ROOTSVCPLATFORMSUN4U)/%: %
458	$(INS.file)
459
460$(ROOTSVCPLATFORMSUN4V)/%: %
461	$(INS.file)
462
463# Install rule for gprof, yacc, and lex dependency files
464$(ROOTSHLIBCCS)/%: ../common/%
465	$(INS.file)
466
467$(ROOTCCSBINLINKDIR)/%: %
468	$(INS.ccsbinlink)
469
470$(ROOTCCSBINLINKDIR64)/%: %
471	$(INS.ccsbinlink64)
472
473$(ROOTMAN1)/%: %.sunman
474	$(INS.rename)
475
476$(ROOTMAN1M)/%: %.sunman
477	$(INS.rename)
478
479$(ROOTMAN3)/%: %.sunman
480	$(INS.rename)
481
482$(ROOTVARSMB)/%: %
483	$(INS.file)
484
485# build rule for statically linked programs with single source file.
486%.static: %.c
487	$(LINK.c) -o $@ $< $(LDLIBS)
488	$(POST_PROCESS)
489
490%.xpg4: %.c
491	$(LINK.c) -o $@ $< $(LDLIBS)
492	$(POST_PROCESS)
493
494%.xpg6: %.c
495	$(LINK.c) -o $@ $< $(LDLIBS)
496	$(POST_PROCESS)
497
498# Define the majority text domain in this directory.
499TEXT_DOMAIN= SUNW_OST_OSCMD
500
501CLOBBERFILES += $(XPG4) $(XPG6) $(DCFILE)
502
503# This flag is for programs which should not build a 32-bit binary
504sparc_64ONLY= $(POUND_SIGN)
50564ONLY=	 $($(MACH)_64ONLY)
506