xref: /titanic_44/usr/src/cmd/Makefile.cmd (revision b00044a2eb43864b8718585d21949611a2ee59ef)
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# Definitions common to command source.
26#
27# include global definitions; SRC should be defined in the shell.
28# SRC is needed until RFE 1026993 is implemented.
29
30include $(SRC)/Makefile.master
31
32LN=		ln
33SH=		sh
34ECHO=		echo
35MKDIR=		mkdir
36TOUCH=		touch
37
38FILEMODE=	0555
39LIBFILEMODE=	0444
40XPG4=		$(XPG4PROG:%=%.xpg4)
41XPG6=		$(XPG6PROG:%=%.xpg6)
42
43KRB5DIR=	$(ROOT)/usr
44KRB5BIN=	$(KRB5DIR)/bin
45KRB5SBIN=	$(KRB5DIR)/sbin
46KRB5LIB=	$(KRB5DIR)/lib/krb5
47KRB5RUNPATH=	/usr/lib/krb5
48GSSRUNPATH=	/usr/lib/gss
49
50
51ROOTBIN=		$(ROOT)/usr/bin
52ROOTLIB=		$(ROOT)/usr/lib
53ROOTLIBSVCBIN=		$(ROOT)/lib/svc/bin
54ROOTLIBSVCMETHOD=	$(ROOT)/lib/svc/method
55ROOTLIBXEN=		$(ROOT)/usr/lib/xen/bin
56ROOTLIBZONES=		$(ROOT)/lib/zones
57
58ROOTSHLIB=	$(ROOT)/usr/share/lib
59ROOTSHLIBCCS=	$(ROOTSHLIB)/ccs
60ROOTSBIN=	$(ROOT)/sbin
61ROOTUSRSBIN=	$(ROOT)/usr/sbin
62ROOTETC=	$(ROOT)/etc
63
64ROOTETCSECURITY=	$(ROOTETC)/security
65ROOTETCTSOL=	$(ROOTETCSECURITY)/tsol
66ROOTETCSECLIB=	$(ROOTETCSECURITY)/lib
67ROOTETCZONES=	$(ROOTETC)/zones
68
69ROOTCCSBIN=	$(ROOT)/usr/ccs/bin
70ROOTCCSBIN64=	$(ROOTCCSBIN)/$(MACH64)
71ROOTCCSBINLINKDIR=	$(ROOT)/../../bin
72ROOTCCSBINLINKDIR64=	$(ROOT)../../../bin/$(MACH)
73ROOTUSRKVM=	$(ROOT)/usr/kvm
74ROOTXPG4=	$(ROOT)/usr/xpg4
75ROOTXPG4BIN=	$(ROOT)/usr/xpg4/bin
76ROOTXPG4BIN32=	$(ROOTXPG4BIN)/$(MACH32)
77ROOTXPG4BIN64=	$(ROOTXPG4BIN)/$(MACH64)
78ROOTXPG6=	$(ROOT)/usr/xpg6
79ROOTXPG6BIN=	$(ROOT)/usr/xpg6/bin
80ROOTLOCALEDEF=	$(ROOT)/usr/lib/localedef
81ROOTCHARMAP=	$(ROOTLOCALEDEF)/charmap
82ROOTI18NEXT=	$(ROOTLOCALEDEF)/extensions
83ROOTI18NEXT64=	$(ROOTLOCALEDEF)/extensions/$(MACH64)
84ROOTBIN32=	$(ROOTBIN)/$(MACH32)
85ROOTBIN64=	$(ROOTBIN)/$(MACH64)
86ROOTCMDDIR64=	$(ROOTCMDDIR)/$(MACH64)
87ROOTLIB64=	$(ROOTLIB)/$(MACH64)
88ROOTUSRSBIN32=	$(ROOTUSRSBIN)/$(MACH32)
89ROOTUSRSBIN64=	$(ROOTUSRSBIN)/$(MACH64)
90ROOTMAN1=	$(ROOT)/usr/share/man/man1
91ROOTMAN1M=	$(ROOT)/usr/share/man/man1m
92ROOTMAN3=	$(ROOT)/usr/share/man/man3
93ROOTVARSMB=	$(ROOT)/var/smb
94
95#
96
97# Like ROOTLIBDIR in $(SRC)/Makefile.lib, any lower-level Makefiles that
98# put their binaries in a non-standard location should reset this and use
99# $(ROOTCMD) in their `install' target. By default we set this to a bogus
100# value so that it will not conflict with any of the other values already
101# defined in this Makefile.
102#
103ROOTCMDDIR=	$(ROOT)/__nonexistent_directory__
104
105ROOTSHAUDIO=	$(ROOT)/usr/share/audio
106ROOTAUDIOSAMP=	$(ROOTSHAUDIO)/samples
107ROOTAUDIOSAMPAU=$(ROOTAUDIOSAMP)/au
108
109#
110# Begin /usr/sfw freeware rules for freeware that has "External"
111# taxonomy stability level.
112#
113ROOTSFW=	$(ROOT)/usr/sfw
114ROOTSFWBIN=	$(ROOT)/usr/sfw/bin
115ROOTSFWSHARE=	$(ROOT)/usr/sfw/share
116ROOTSFWSHSRC=	$(ROOT)/usr/sfw/share/src
117ROOTSFWINFO=	$(ROOT)/usr/sfw/share/info
118ROOTSFWINCLUDE=	$(ROOT)/usr/sfw/include
119ROOTSFWLIB=	$(ROOT)/usr/sfw/lib
120ROOTLIBEXEC=	$(ROOT)/usr/sfw/libexec
121ROOTSFWMAN=	$(ROOT)/usr/sfw/share/man
122ROOTSFWMANN=	$(ROOT)/usr/sfw/share/mann
123ROOTSFWMAN1=	$(ROOT)/usr/sfw/share/man/man1
124ROOTSFWMAN1M=	$(ROOT)/usr/sfw/share/man/man1m
125ROOTSFWMAN3=	$(ROOT)/usr/sfw/share/man/man3
126ROOTSFWMAN5=	$(ROOT)/usr/sfw/share/man/man5
127ROOTSFWMAN7=	$(ROOT)/usr/sfw/share/man/man7
128#
129# End /usr/sfw freeware rules
130#
131
132ISAEXEC=	$(ROOT)/usr/lib/isaexec
133PLATEXEC=	$(ROOT)/usr/lib/platexec
134
135LDLIBS =	$(LDLIBS.cmd)
136
137LDFLAGS.cmd = \
138	$(BDIRECT) $(ENVLDFLAGS1) $(ENVLDFLAGS2) $(ENVLDFLAGS3) \
139	$(MAPFILE.NES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%)
140
141LDFLAGS =	$(LDFLAGS.cmd)
142
143LINTFLAGS=	-axsm
144LINTFLAGS64=	-axsm -Xarch=$(MACH64:sparcv9=v9)
145LINTOUT=	lint.out
146
147KRB5PROG=	$(PROG:%=$(KRB5BIN)/%)
148KRB5SBINPROG=	$(PROG:%=$(KRB5SBIN)/%)
149KRB5LIBPROG=	$(PROG:%=$(KRB5LIB)/%)
150
151ROOTPROG=	$(PROG:%=$(ROOTBIN)/%)
152ROOTCMD=	$(PROG:%=$(ROOTCMDDIR)/%)
153ROOTSHFILES=	$(SHFILES:%=$(ROOTBIN)/%)
154ROOTLIBPROG=	$(PROG:%=$(ROOTLIB)/%)
155ROOTLIBSHFILES= $(SHFILES:%=$(ROOTLIB)/%)
156ROOTSHLIBPROG=	$(PROG:%=$(ROOTSHLIB)/%)
157ROOTSBINPROG=	$(PROG:%=$(ROOTSBIN)/%)
158ROOTUSRSBINPROG=$(PROG:%=$(ROOTUSRSBIN)/%)
159ROOTUSRSBINSCRIPT=$(SCRIPT:%=$(ROOTUSRSBIN)/%)
160ROOTETCPROG=	$(PROG:%=$(ROOTETC)/%)
161ROOTCCSBINPROG=	$(PROG:%=$(ROOTCCSBIN)/%)
162ROOTCCSBINPROG64=	  $(PROG:%=$(ROOTCCSBIN64)/%)
163ROOTCCSBINLINK=$(PROG:%=  $(ROOTCCSBINLINKDIR)/%)
164ROOTCCSBINLINK64=$(PROG:%=$(ROOTCCSBINLINKDIR64)/%)
165ROOTUSRKVMPROG=	$(PROG:%=$(ROOTUSRKVM)/%)
166ROOTXPG4PROG=	$(XPG4PROG:%=$(ROOTXPG4BIN)/%)
167ROOTXPG4PROG32=	$(XPG4PROG:%=$(ROOTXPG4BIN32)/%)
168ROOTXPG4PROG64=	$(XPG4PROG:%=$(ROOTXPG4BIN64)/%)
169ROOTXPG6PROG=	$(XPG6PROG:%=$(ROOTXPG6BIN)/%)
170ROOTLOCALEPROG=	$(PROG:%=$(ROOTLOCALEDEF)/%)
171ROOTPROG64=	$(PROG:%=$(ROOTBIN64)/%)
172ROOTPROG32=	$(PROG:%=$(ROOTBIN32)/%)
173ROOTCMD64=	$(PROG:%=$(ROOTCMDDIR64)/%)
174ROOTUSRSBINPROG32=	$(PROG:%=$(ROOTUSRSBIN32)/%)
175ROOTUSRSBINPROG64=	$(PROG:%=$(ROOTUSRSBIN64)/%)
176ROOTMAN1FILES=	$(MAN1FILES:%=$(ROOTMAN1)/%)
177$(ROOTMAN1FILES) := FILEMODE= 444
178$(ROOTMAN1FILES) := OWNER= root
179$(ROOTMAN1FILES) := GROUP= bin
180ROOTMAN1MFILES=	$(MAN1MFILES:%=$(ROOTMAN1M)/%)
181$(ROOTMAN1MFILES) := FILEMODE= 444
182$(ROOTMAN1MFILES) := OWNER= root
183$(ROOTMAN1MFILES) := GROUP= bin
184ROOTMAN3FILES=	$(MAN3FILES:%=$(ROOTMAN3)/%)
185$(ROOTMAN3FILES) := FILEMODE= 444
186$(ROOTMAN3FILES) := OWNER= root
187$(ROOTMAN3FILES) := GROUP= bin
188
189# Symlink rules for /usr/ccs/bin commands. Note, those commands under
190# the rule of the linker area, are controlled by a different set of
191# rules defined in $(SRC)/cmd/sgs/Makefile.var.
192
193INS.ccsbinlink= \
194	$(RM) $(ROOTCCSBINPROG); \
195	$(SYMLINK) ../../bin/$(PROG) $(ROOTCCSBINPROG)
196
197INS.ccsbinlink64= \
198	$(RM) $(ROOTCCSBINPROG64); \
199	$(SYMLINK) ../../../bin/$(MACH64)/$(PROG) $(ROOTCCSBINPROG64)
200
201ROOTETCDEFAULT=	$(ROOTETC)/default
202ROOTETCDEFAULTFILES=	$(DEFAULTFILES:%.dfl=$(ROOTETCDEFAULT)/%)
203$(ROOTETCDEFAULTFILES) :=	OWNER = root
204$(ROOTETCDEFAULTFILES) :=	GROUP = sys
205$(ROOTETCDEFAULTFILES) :=	FILEMODE = 0644
206
207ROOTETCSECFILES=	$(ETCSECFILES:%=$(ROOTETCSECURITY)/%)
208$(ROOTETCSECFILES) :=	FILEMODE = 0644
209
210ROOTETCTSOLFILES=	$(ETCTSOLFILES:%=$(ROOTETCTSOL)/%)
211$(ROOTETCTSOLFILES) :=	FILEMODE = 0644
212
213ROOTETCSECLIBFILES=	$(ETCSECLIBFILES:%=$(ROOTETCSECLIB)/%)
214
215ROOTETCZONESFILES=	$(ETCZONESFILES:%=$(ROOTETCZONES)/%)
216$(ROOTETCZONESFILES) :=	FILEMODE = 0444
217
218ROOTLIBZONESFILES=	$(LIBZONESFILES:%=$(ROOTLIBZONES)/%)
219$(ROOTLIBZONESFILES) :=	FILEMODE = 0555
220
221
222#
223# Directories for smf(5) service manifests and profiles.
224#
225ROOTVARSVC=			$(ROOT)/var/svc
226
227ROOTVARSVCMANIFEST=		$(ROOTVARSVC)/manifest
228ROOTVARSVCPROFILE=		$(ROOTVARSVC)/profile
229
230ROOTSVCMILESTONE=		$(ROOTVARSVCMANIFEST)/milestone
231ROOTSVCDEVICE=			$(ROOTVARSVCMANIFEST)/device
232ROOTSVCSYSTEM=			$(ROOTVARSVCMANIFEST)/system
233ROOTSVCSYSTEMDEVICE=		$(ROOTSVCSYSTEM)/device
234ROOTSVCSYSTEMFILESYSTEM=	$(ROOTSVCSYSTEM)/filesystem
235ROOTSVCSYSTEMSECURITY=		$(ROOTSVCSYSTEM)/security
236ROOTSVCNETWORK=			$(ROOTVARSVCMANIFEST)/network
237ROOTSVCNETWORKDNS=		$(ROOTSVCNETWORK)/dns
238ROOTSVCNETWORKLDAP=		$(ROOTSVCNETWORK)/ldap
239ROOTSVCNETWORKNFS=		$(ROOTSVCNETWORK)/nfs
240ROOTSVCNETWORKNIS=		$(ROOTSVCNETWORK)/nis
241ROOTSVCNETWORKROUTING=		$(ROOTSVCNETWORK)/routing
242ROOTSVCNETWORKRPC=		$(ROOTSVCNETWORK)/rpc
243ROOTSVCNETWORKSMB=		$(ROOTSVCNETWORK)/smb
244ROOTSVCNETWORKSECURITY=		$(ROOTSVCNETWORK)/security
245ROOTSVCNETWORKSSL=		$(ROOTSVCNETWORK)/ssl
246ROOTSVCNETWORKIPSEC=		$(ROOTSVCNETWORK)/ipsec
247ROOTSVCNETWORKSHARES=		$(ROOTSVCNETWORK)/shares
248ROOTSVCSMB=			$(ROOTSVCNETWORK)/smb
249ROOTSVCPLATFORM=		$(ROOTVARSVCMANIFEST)/platform
250ROOTSVCPLATFORMSUN4U=		$(ROOTSVCPLATFORM)/sun4u
251ROOTSVCPLATFORMSUN4V=		$(ROOTSVCPLATFORM)/sun4v
252ROOTSVCAPPLICATION=		$(ROOTVARSVCMANIFEST)/application
253ROOTSVCAPPLICATIONMANAGEMENT=	$(ROOTSVCAPPLICATION)/management
254ROOTSVCAPPLICATIONSECURITY=	$(ROOTSVCAPPLICATION)/security
255ROOTSVCAPPLICATIONPRINT=	$(ROOTSVCAPPLICATION)/print
256
257#
258# Commands Makefiles delivering a manifest are expected to define MANIFEST.
259#
260# Like ROOTCMDDIR, any lower-level Makefiles that put their manifests in a
261# subdirectory of the manifest directories listed above should reset
262# ROOTMANIFESTDIR and use it in their `install' target. By default we set this
263# to a bogus value so that it will not conflict with any of the other values
264# already  defined in this Makefile.
265#
266# The manifest validation of the $SRC/cmd check target is also derived from a
267# valid MANIFEST setting.
268#
269ROOTMANIFESTDIR=	$(ROOTVARSVCMANIFEST)/__nonexistent_directory__
270ROOTMANIFEST=		$(MANIFEST:%=$(ROOTMANIFESTDIR)/%)
271CHKMANIFEST=		$(MANIFEST:%.xml=%.xmlchk)
272
273#
274# For installing "starter scripts" of services
275#
276
277ROOTSVCMETHOD=		$(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
278
279ROOTSVCBINDIR=		$(ROOTLIBSVCBIN)/__nonexistent_directory__
280ROOTSVCBIN= 		$(SVCBIN:%=$(ROOTSVCBINDIR)/%)
281
282#
283
284# For programs that are installed in the root filesystem,
285# build $(ROOTFS_PROG) rather than $(PROG)
286$(ROOTFS_PROG) := LDFLAGS += -Wl,-I/lib/ld.so.1
287
288$(KRB5BIN)/%: %
289	$(INS.file)
290
291$(KRB5SBIN)/%: %
292	$(INS.file)
293
294$(KRB5LIB)/%: %
295	$(INS.file)
296
297$(ROOTBIN)/%: %
298	$(INS.file)
299
300$(ROOTLIB)/%: %
301	$(INS.file)
302
303$(ROOTBIN64)/%: %
304	$(INS.file)
305
306$(ROOTLIB64)/%: %
307	$(INS.file)
308
309$(ROOTBIN32)/%: %
310	$(INS.file)
311
312$(ROOTSHLIB)/%: %
313	$(INS.file)
314
315$(ROOTSBIN)/%: %
316	$(INS.file)
317
318$(ROOTUSRSBIN)/%: %
319	$(INS.file)
320
321$(ROOTUSRSBIN32)/%: %
322	$(INS.file)
323
324$(ROOTUSRSBIN64)/%: %
325	$(INS.file)
326
327$(ROOTETC)/%: %
328	$(INS.file)
329
330$(ROOTETCDEFAULT)/%:	%.dfl
331	$(INS.rename)
332
333$(ROOTETCTSOL)/%: %
334	$(INS.file)
335
336$(ROOTETCSECLIB)/%: %
337	$(INS.file)
338
339$(ROOTETCZONES)/%: %
340	$(INS.file)
341
342$(ROOTLIBZONES)/%: %
343	$(INS.file)
344
345$(ROOTLIBXEN)/%: %
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