xref: /titanic_41/usr/src/cmd/Makefile.cmd (revision 6185db853e024a486ff8837e6784dd290d866112)
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 2006 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
205ROOTSVCNETWORKRPC=		$(ROOTSVCNETWORK)/rpc
206ROOTSVCNETWORKSECURITY=		$(ROOTSVCNETWORK)/security
207ROOTSVCNETWORKSSL=		$(ROOTSVCNETWORK)/ssl
208ROOTSVCNETWORKSHARES=		$(ROOTSVCNETWORK)/shares
209ROOTSVCPLATFORM=		$(ROOTVARSVCMANIFEST)/platform
210ROOTSVCPLATFORMI86PC=		$(ROOTSVCPLATFORM)/i86pc
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
238ROOTSVCBIN=		$(SVCBIN:%=$(ROOTLIBSVCBIN)/%)
239ROOTSVCMETHOD=		$(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
240
241ROOTSVCBINDIR=		$(ROOTLIBSVCBIN)/__nonexistent_directory__
242ROOTSVCBIN= 		$(SVCBIN:%=$(ROOTSVCBINDIR)/%)
243$(ROOTSVCBIN)		:= FILEMODE= 544
244
245#
246
247# For programs that are installed in the root filesystem,
248# build $(ROOTFS_PROG) rather than $(PROG)
249$(ROOTFS_PROG) := LDFLAGS += -Wl,-I/lib/ld.so.1
250
251$(KRB5BIN)/%: %
252	$(INS.file)
253
254$(KRB5SBIN)/%: %
255	$(INS.file)
256
257$(KRB5LIB)/%: %
258	$(INS.file)
259
260$(ROOTBIN)/%: %
261	$(INS.file)
262
263$(ROOTLIB)/%: %
264	$(INS.file)
265
266$(ROOTBIN64)/%: %
267	$(INS.file)
268
269$(ROOTLIB64)/%: %
270	$(INS.file)
271
272$(ROOTBIN32)/%: %
273	$(INS.file)
274
275$(ROOTSHLIB)/%: %
276	$(INS.file)
277
278$(ROOTSBIN)/%: %
279	$(INS.file)
280
281$(ROOTUSRSBIN)/%: %
282	$(INS.file)
283
284$(ROOTUSRSBIN32)/%: %
285	$(INS.file)
286
287$(ROOTUSRSBIN64)/%: %
288	$(INS.file)
289
290$(ROOTETC)/%: %
291	$(INS.file)
292
293$(ROOTETCDEFAULT)/%:	%.dfl
294	$(INS.rename)
295
296$(ROOTCCSBIN)/%: %
297	$(INS.file)
298
299$(ROOTUSRKVM)/%: %
300	$(INS.file)
301
302$(ROOTXPG4BIN)/%: %.xpg4
303	$(INS.rename)
304
305$(ROOTXPG4BIN32)/%: %.xpg4
306	$(INS.rename)
307
308$(ROOTXPG4BIN64)/%: %.xpg4
309	$(INS.rename)
310
311$(ROOTXPG6BIN)/%: %.xpg6
312	$(INS.rename)
313
314$(ROOTLOCALEDEF)/%: %
315	$(INS.file)
316
317$(ROOTCHARMAP)/%: %
318	$(INS.file)
319
320$(ROOTI18NEXT)/%: %
321	$(INS.file)
322
323$(ROOTI18NEXT64)/%: %
324	$(INS.file)
325
326$(ROOTLIBSVCMETHOD)/%: %
327	$(INS.file)
328
329$(ROOTLIBSVCBIN)/%: %
330	$(INS.file)
331
332$(ROOTSVCMILESTONE)/%: %
333	$(INS.file)
334
335$(ROOTSVCDEVICE)/%: %
336	$(INS.file)
337
338$(ROOTSVCSYSTEM)/%: %
339	$(INS.file)
340
341$(ROOTSVCSYSTEMDEVICE)/%: %
342	$(INS.file)
343
344$(ROOTSVCSYSTEMFILESYSTEM)/%: %
345	$(INS.file)
346
347$(ROOTSVCSYSTEMSECURITY)/%: %
348	$(INS.file)
349
350$(ROOTSVCNETWORK)/%: %
351	$(INS.file)
352
353$(ROOTSVCNETWORKLDAP)/%: %
354	$(INS.file)
355
356$(ROOTSVCNETWORKNFS)/%: %
357	$(INS.file)
358
359$(ROOTSVCNETWORKNIS)/%: %
360	$(INS.file)
361
362$(ROOTSVCNETWORKRPC)/%: %
363	$(INS.file)
364
365$(ROOTSVCNETWORKSECURITY)/%: %
366	$(INS.file)
367
368$(ROOTSVCNETWORKSSL)/%: %
369	$(INS.file)
370
371$(ROOTSVCNETWORKSHARES)/%: %
372	$(INS.file)
373
374$(ROOTSVCAPPLICATION)/%: %
375	$(INS.file)
376
377$(ROOTSVCAPPLICATIONMANAGEMENT)/%: %
378	$(INS.file)
379
380$(ROOTSVCAPPLICATIONSECURITY)/%: %
381	$(INS.file)
382
383$(ROOTSVCAPPLICATIONPRINT)/%: %
384	$(INS.file)
385
386$(ROOTSVCPLATFORM)/%: %
387	$(INS.file)
388
389$(ROOTSVCPLATFORMI86PC)/%: %
390	$(INS.file)
391
392$(ROOTSVCPLATFORMSUN4U)/%: %
393	$(INS.file)
394
395$(ROOTSVCPLATFORMSUN4V)/%: %
396	$(INS.file)
397
398$(ROOTMAN1)/%: %.sunman
399	$(INS.rename)
400
401$(ROOTMAN1M)/%: %.sunman
402	$(INS.rename)
403
404$(ROOTMAN3)/%: %.sunman
405	$(INS.rename)
406
407# build rule for statically linked programs with single source file.
408%.static: %.c
409	$(LINK.c) -o $@ $< $(LDLIBS)
410	$(POST_PROCESS)
411
412%.xpg4: %.c
413	$(LINK.c) -o $@ $< $(LDLIBS)
414	$(POST_PROCESS)
415
416%.xpg6: %.c
417	$(LINK.c) -o $@ $< $(LDLIBS)
418	$(POST_PROCESS)
419
420# Define the majority text domain in this directory.
421TEXT_DOMAIN= SUNW_OST_OSCMD
422
423CLOBBERFILES += $(XPG4) $(XPG6) $(DCFILE)
424
425# This flag is being added only for SCO (x86) compatibility
426i386_SPFLAG=    -D_iBCS2
427sparc_SPFLAG=
428
429iBCS2FLAG = $($(MACH)_SPFLAG)
430
431# This flag is for programs which should not build a 32-bit binary
432sparc_64ONLY= $(POUND_SIGN)
43364ONLY=	 $($(MACH)_64ONLY)
434