xref: /titanic_41/usr/src/cmd/Makefile.cmd (revision 8d4e547db823a866b8f73efc0acdc423e2963caf)
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 2007 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
58
59ROOTSHLIB=	$(ROOT)/usr/share/lib
60ROOTSBIN=	$(ROOT)/sbin
61ROOTUSRSBIN=	$(ROOT)/usr/sbin
62ROOTETC=	$(ROOT)/etc
63ROOTCCSBIN=	$(ROOT)/usr/ccs/bin
64ROOTUSRKVM=	$(ROOT)/usr/kvm
65ROOTXPG4=	$(ROOT)/usr/xpg4
66ROOTXPG4BIN=	$(ROOT)/usr/xpg4/bin
67ROOTXPG4BIN32=	$(ROOTXPG4BIN)/$(MACH32)
68ROOTXPG4BIN64=	$(ROOTXPG4BIN)/$(MACH64)
69ROOTXPG6=	$(ROOT)/usr/xpg6
70ROOTXPG6BIN=	$(ROOT)/usr/xpg6/bin
71ROOTLOCALEDEF=	$(ROOT)/usr/lib/localedef
72ROOTCHARMAP=	$(ROOTLOCALEDEF)/charmap
73ROOTI18NEXT=	$(ROOTLOCALEDEF)/extensions
74ROOTI18NEXT64=	$(ROOTLOCALEDEF)/extensions/$(MACH64)
75ROOTBIN32=	$(ROOTBIN)/$(MACH32)
76ROOTBIN64=	$(ROOTBIN)/$(MACH64)
77ROOTCMDDIR64=	$(ROOTCMDDIR)/$(MACH64)
78ROOTLIB64=	$(ROOTLIB)/$(MACH64)
79ROOTUSRSBIN32=	$(ROOTUSRSBIN)/$(MACH32)
80ROOTUSRSBIN64=	$(ROOTUSRSBIN)/$(MACH64)
81ROOTMAN1=	$(ROOT)/usr/share/man/man1
82ROOTMAN1M=	$(ROOT)/usr/share/man/man1m
83ROOTMAN3=	$(ROOT)/usr/share/man/man3
84
85#
86
87# Like ROOTLIBDIR in $(SRC)/Makefile.lib, any lower-level Makefiles that
88# put their binaries in a non-standard location should reset this and use
89# $(ROOTCMD) in their `install' target. By default we set this to a bogus
90# value so that it will not conflict with any of the other values already
91# defined in this Makefile.
92#
93ROOTCMDDIR=	$(ROOT)/__nonexistent_directory__
94
95ROOTSHAUDIO=	$(ROOT)/usr/share/audio
96ROOTAUDIOSAMP=	$(ROOTSHAUDIO)/samples
97ROOTAUDIOSAMPAU=$(ROOTAUDIOSAMP)/au
98
99#
100# Begin /usr/sfw freeware rules for freeware that has "External"
101# taxonomy stability level.
102#
103ROOTSFW=	$(ROOT)/usr/sfw
104ROOTSFWBIN=	$(ROOT)/usr/sfw/bin
105ROOTSFWSBIN=	$(ROOT)/usr/sfw/sbin
106ROOTSFWSHARE=	$(ROOT)/usr/sfw/share
107ROOTSFWSHSRC=	$(ROOT)/usr/sfw/share/src
108ROOTSFWINFO=	$(ROOT)/usr/sfw/share/info
109ROOTSFWINCLUDE=	$(ROOT)/usr/sfw/include
110ROOTSFWLIB=	$(ROOT)/usr/sfw/lib
111ROOTLIBEXEC=	$(ROOT)/usr/sfw/libexec
112ROOTSFWMAN=	$(ROOT)/usr/sfw/share/man
113ROOTSFWMANN=	$(ROOT)/usr/sfw/share/mann
114ROOTSFWMAN1=	$(ROOT)/usr/sfw/share/man/man1
115ROOTSFWMAN1M=	$(ROOT)/usr/sfw/share/man/man1m
116ROOTSFWMAN3=	$(ROOT)/usr/sfw/share/man/man3
117ROOTSFWMAN5=	$(ROOT)/usr/sfw/share/man/man5
118ROOTSFWMAN7=	$(ROOT)/usr/sfw/share/man/man7
119#
120# End /usr/sfw freeware rules
121#
122
123ISAEXEC=	$(ROOT)/usr/lib/isaexec
124PLATEXEC=	$(ROOT)/usr/lib/platexec
125
126NX_MAP_i386=	$(SRC)/cmd/mapfile_noexdata
127NX_MAP_sparc=
128NX_MAP=		$(NX_MAP_$(MACH))
129NES_MAPFILE=	$(SRC)/cmd/mapfile_noexstk $(NX_MAP)
130
131LDLIBS =	$(LDLIBS.cmd)
132
133LDFLAGS.cmd = \
134	$(ENVLDFLAGS1) $(ENVLDFLAGS2) $(ENVLDFLAGS3) \
135	$(NES_MAPFILE:%=-M%) $(PGA_MAPFILE:%=-M%)
136
137LDFLAGS =	$(LDFLAGS.cmd)
138
139LINTFLAGS=	-axsm
140LINTFLAGS64=	-axsm -Xarch=$(MACH64:sparcv9=v9)
141LINTOUT=	lint.out
142
143KRB5PROG=	$(PROG:%=$(KRB5BIN)/%)
144KRB5SBINPROG=	$(PROG:%=$(KRB5SBIN)/%)
145KRB5LIBPROG=	$(PROG:%=$(KRB5LIB)/%)
146
147ROOTPROG=	$(PROG:%=$(ROOTBIN)/%)
148ROOTCMD=	$(PROG:%=$(ROOTCMDDIR)/%)
149ROOTSHFILES=	$(SHFILES:%=$(ROOTBIN)/%)
150ROOTLIBPROG=	$(PROG:%=$(ROOTLIB)/%)
151ROOTLIBSHFILES= $(SHFILES:%=$(ROOTLIB)/%)
152ROOTSHLIBPROG=	$(PROG:%=$(ROOTSHLIB)/%)
153ROOTSBINPROG=	$(PROG:%=$(ROOTSBIN)/%)
154ROOTUSRSBINPROG=$(PROG:%=$(ROOTUSRSBIN)/%)
155ROOTETCPROG=	$(PROG:%=$(ROOTETC)/%)
156ROOTCCSBINPROG=	$(PROG:%=$(ROOTCCSBIN)/%)
157ROOTUSRKVMPROG=	$(PROG:%=$(ROOTUSRKVM)/%)
158ROOTXPG4PROG=	$(XPG4PROG:%=$(ROOTXPG4BIN)/%)
159ROOTXPG4PROG32=	$(XPG4PROG:%=$(ROOTXPG4BIN32)/%)
160ROOTXPG4PROG64=	$(XPG4PROG:%=$(ROOTXPG4BIN64)/%)
161ROOTXPG6PROG=	$(XPG6PROG:%=$(ROOTXPG6BIN)/%)
162ROOTLOCALEPROG=	$(PROG:%=$(ROOTLOCALEDEF)/%)
163ROOTPROG64=	$(PROG:%=$(ROOTBIN64)/%)
164ROOTPROG32=	$(PROG:%=$(ROOTBIN32)/%)
165ROOTCMD64=	$(PROG:%=$(ROOTCMDDIR64)/%)
166ROOTUSRSBINPROG32=	$(PROG:%=$(ROOTUSRSBIN32)/%)
167ROOTUSRSBINPROG64=	$(PROG:%=$(ROOTUSRSBIN64)/%)
168ROOTMAN1FILES=	$(MAN1FILES:%=$(ROOTMAN1)/%)
169$(ROOTMAN1FILES) := FILEMODE= 444
170$(ROOTMAN1FILES) := OWNER= root
171$(ROOTMAN1FILES) := GROUP= bin
172ROOTMAN1MFILES=	$(MAN1MFILES:%=$(ROOTMAN1M)/%)
173$(ROOTMAN1MFILES) := FILEMODE= 444
174$(ROOTMAN1MFILES) := OWNER= root
175$(ROOTMAN1MFILES) := GROUP= bin
176ROOTMAN3FILES=	$(MAN3FILES:%=$(ROOTMAN3)/%)
177$(ROOTMAN3FILES) := FILEMODE= 444
178$(ROOTMAN3FILES) := OWNER= root
179$(ROOTMAN3FILES) := GROUP= bin
180
181ROOTETCDEFAULT=	$(ROOTETC)/default
182ROOTETCDEFAULTFILES=	$(DEFAULTFILES:%.dfl=$(ROOTETCDEFAULT)/%)
183$(ROOTETCDEFAULTFILES) :=	OWNER = root
184$(ROOTETCDEFAULTFILES) :=	GROUP = sys
185$(ROOTETCDEFAULTFILES) :=	FILEMODE = 0644
186
187#
188# Directories for smf(5) service manifests and profiles.
189#
190ROOTVARSVC=			$(ROOT)/var/svc
191
192ROOTVARSVCMANIFEST=		$(ROOTVARSVC)/manifest
193ROOTVARSVCPROFILE=		$(ROOTVARSVC)/profile
194
195ROOTSVCMILESTONE=		$(ROOTVARSVCMANIFEST)/milestone
196ROOTSVCDEVICE=			$(ROOTVARSVCMANIFEST)/device
197ROOTSVCSYSTEM=			$(ROOTVARSVCMANIFEST)/system
198ROOTSVCSYSTEMDEVICE=		$(ROOTSVCSYSTEM)/device
199ROOTSVCSYSTEMFILESYSTEM=	$(ROOTSVCSYSTEM)/filesystem
200ROOTSVCSYSTEMSECURITY=		$(ROOTSVCSYSTEM)/security
201ROOTSVCNETWORK=			$(ROOTVARSVCMANIFEST)/network
202ROOTSVCNETWORKLDAP=		$(ROOTSVCNETWORK)/ldap
203ROOTSVCNETWORKNFS=		$(ROOTSVCNETWORK)/nfs
204ROOTSVCNETWORKNIS=		$(ROOTSVCNETWORK)/nis
205ROOTSVCNETWORKROUTING=		$(ROOTSVCNETWORK)/routing
206ROOTSVCNETWORKRPC=		$(ROOTSVCNETWORK)/rpc
207ROOTSVCNETWORKSECURITY=		$(ROOTSVCNETWORK)/security
208ROOTSVCNETWORKSSL=		$(ROOTSVCNETWORK)/ssl
209ROOTSVCNETWORKSHARES=		$(ROOTSVCNETWORK)/shares
210ROOTSVCPLATFORM=		$(ROOTVARSVCMANIFEST)/platform
211ROOTSVCPLATFORMSUN4U=		$(ROOTSVCPLATFORM)/sun4u
212ROOTSVCPLATFORMSUN4V=		$(ROOTSVCPLATFORM)/sun4v
213ROOTSVCAPPLICATION=		$(ROOTVARSVCMANIFEST)/application
214ROOTSVCAPPLICATIONMANAGEMENT=	$(ROOTSVCAPPLICATION)/management
215ROOTSVCAPPLICATIONSECURITY=	$(ROOTSVCAPPLICATION)/security
216ROOTSVCAPPLICATIONPRINT=	$(ROOTSVCAPPLICATION)/print
217
218#
219# Commands Makefiles delivering a manifest are expected to define MANIFEST.
220#
221# Like ROOTCMDDIR, any lower-level Makefiles that put their manifests in a
222# subdirectory of the manifest directories listed above should reset
223# ROOTMANIFESTDIR and use it in their `install' target. By default we set this
224# to a bogus value so that it will not conflict with any of the other values
225# already  defined in this Makefile.
226#
227# The manifest validation of the $SRC/cmd check target is also derived from a
228# valid MANIFEST setting.
229#
230ROOTMANIFESTDIR=	$(ROOTVARSVCMANIFEST)/__nonexistent_directory__
231ROOTMANIFEST=		$(MANIFEST:%=$(ROOTMANIFESTDIR)/%)
232CHKMANIFEST=		$(MANIFEST:%.xml=%.xmlchk)
233
234#
235# For installing "starter scripts" of services
236#
237
238ROOTSVCMETHOD=		$(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
239
240ROOTSVCBINDIR=		$(ROOTLIBSVCBIN)/__nonexistent_directory__
241ROOTSVCBIN= 		$(SVCBIN:%=$(ROOTSVCBINDIR)/%)
242
243#
244
245# For programs that are installed in the root filesystem,
246# build $(ROOTFS_PROG) rather than $(PROG)
247$(ROOTFS_PROG) := LDFLAGS += -Wl,-I/lib/ld.so.1
248
249$(KRB5BIN)/%: %
250	$(INS.file)
251
252$(KRB5SBIN)/%: %
253	$(INS.file)
254
255$(KRB5LIB)/%: %
256	$(INS.file)
257
258$(ROOTBIN)/%: %
259	$(INS.file)
260
261$(ROOTLIB)/%: %
262	$(INS.file)
263
264$(ROOTBIN64)/%: %
265	$(INS.file)
266
267$(ROOTLIB64)/%: %
268	$(INS.file)
269
270$(ROOTBIN32)/%: %
271	$(INS.file)
272
273$(ROOTSHLIB)/%: %
274	$(INS.file)
275
276$(ROOTSBIN)/%: %
277	$(INS.file)
278
279$(ROOTUSRSBIN)/%: %
280	$(INS.file)
281
282$(ROOTUSRSBIN32)/%: %
283	$(INS.file)
284
285$(ROOTUSRSBIN64)/%: %
286	$(INS.file)
287
288$(ROOTETC)/%: %
289	$(INS.file)
290
291$(ROOTETCDEFAULT)/%:	%.dfl
292	$(INS.rename)
293
294$(ROOTCCSBIN)/%: %
295	$(INS.file)
296
297$(ROOTUSRKVM)/%: %
298	$(INS.file)
299
300$(ROOTXPG4BIN)/%: %.xpg4
301	$(INS.rename)
302
303$(ROOTXPG4BIN32)/%: %.xpg4
304	$(INS.rename)
305
306$(ROOTXPG4BIN64)/%: %.xpg4
307	$(INS.rename)
308
309$(ROOTXPG6BIN)/%: %.xpg6
310	$(INS.rename)
311
312$(ROOTLOCALEDEF)/%: %
313	$(INS.file)
314
315$(ROOTCHARMAP)/%: %
316	$(INS.file)
317
318$(ROOTI18NEXT)/%: %
319	$(INS.file)
320
321$(ROOTI18NEXT64)/%: %
322	$(INS.file)
323
324$(ROOTLIBSVCMETHOD)/%: %
325	$(INS.file)
326
327$(ROOTLIBSVCBIN)/%: %
328	$(INS.file)
329
330$(ROOTSVCMILESTONE)/%: %
331	$(INS.file)
332
333$(ROOTSVCDEVICE)/%: %
334	$(INS.file)
335
336$(ROOTSVCSYSTEM)/%: %
337	$(INS.file)
338
339$(ROOTSVCSYSTEMDEVICE)/%: %
340	$(INS.file)
341
342$(ROOTSVCSYSTEMFILESYSTEM)/%: %
343	$(INS.file)
344
345$(ROOTSVCSYSTEMSECURITY)/%: %
346	$(INS.file)
347
348$(ROOTSVCNETWORK)/%: %
349	$(INS.file)
350
351$(ROOTSVCNETWORKLDAP)/%: %
352	$(INS.file)
353
354$(ROOTSVCNETWORKNFS)/%: %
355	$(INS.file)
356
357$(ROOTSVCNETWORKNIS)/%: %
358	$(INS.file)
359
360$(ROOTSVCNETWORKRPC)/%: %
361	$(INS.file)
362
363$(ROOTSVCNETWORKSECURITY)/%: %
364	$(INS.file)
365
366$(ROOTSVCNETWORKSSL)/%: %
367	$(INS.file)
368
369$(ROOTSVCNETWORKSHARES)/%: %
370	$(INS.file)
371
372$(ROOTSVCAPPLICATION)/%: %
373	$(INS.file)
374
375$(ROOTSVCAPPLICATIONMANAGEMENT)/%: %
376	$(INS.file)
377
378$(ROOTSVCAPPLICATIONSECURITY)/%: %
379	$(INS.file)
380
381$(ROOTSVCAPPLICATIONPRINT)/%: %
382	$(INS.file)
383
384$(ROOTSVCPLATFORM)/%: %
385	$(INS.file)
386
387$(ROOTSVCPLATFORMSUN4U)/%: %
388	$(INS.file)
389
390$(ROOTSVCPLATFORMSUN4V)/%: %
391	$(INS.file)
392
393$(ROOTMAN1)/%: %.sunman
394	$(INS.rename)
395
396$(ROOTMAN1M)/%: %.sunman
397	$(INS.rename)
398
399$(ROOTMAN3)/%: %.sunman
400	$(INS.rename)
401
402# build rule for statically linked programs with single source file.
403%.static: %.c
404	$(LINK.c) -o $@ $< $(LDLIBS)
405	$(POST_PROCESS)
406
407%.xpg4: %.c
408	$(LINK.c) -o $@ $< $(LDLIBS)
409	$(POST_PROCESS)
410
411%.xpg6: %.c
412	$(LINK.c) -o $@ $< $(LDLIBS)
413	$(POST_PROCESS)
414
415# Define the majority text domain in this directory.
416TEXT_DOMAIN= SUNW_OST_OSCMD
417
418CLOBBERFILES += $(XPG4) $(XPG6) $(DCFILE)
419
420# This flag is being added only for SCO (x86) compatibility
421i386_SPFLAG=    -D_iBCS2
422sparc_SPFLAG=
423
424iBCS2FLAG = $($(MACH)_SPFLAG)
425
426# This flag is for programs which should not build a 32-bit binary
427sparc_64ONLY= $(POUND_SIGN)
42864ONLY=	 $($(MACH)_64ONLY)
429