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