xref: /titanic_51/usr/src/cmd/Makefile.cmd (revision 8a40a695ee676a322b094e9afe5375567bfb51e3)
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
208ROOTSVCPLATFORM=		$(ROOTVARSVCMANIFEST)/platform
209ROOTSVCPLATFORMI86PC=		$(ROOTSVCPLATFORM)/i86pc
210ROOTSVCPLATFORMSUN4U=		$(ROOTSVCPLATFORM)/sun4u
211ROOTSVCPLATFORMSUN4V=		$(ROOTSVCPLATFORM)/sun4v
212ROOTSVCAPPLICATION=		$(ROOTVARSVCMANIFEST)/application
213ROOTSVCAPPLICATIONMANAGEMENT=	$(ROOTSVCAPPLICATION)/management
214ROOTSVCAPPLICATIONSECURITY=	$(ROOTSVCAPPLICATION)/security
215ROOTSVCAPPLICATIONPRINT=	$(ROOTSVCAPPLICATION)/print
216
217#
218# Commands Makefiles delivering a manifest are expected to define MANIFEST.
219#
220# Like ROOTCMDDIR, any lower-level Makefiles that put their manifests in a
221# subdirectory of the manifest directories listed above should reset
222# ROOTMANIFESTDIR and use it in their `install' target. By default we set this
223# to a bogus value so that it will not conflict with any of the other values
224# already  defined in this Makefile.
225#
226# The manifest validation of the $SRC/cmd check target is also derived from a
227# valid MANIFEST setting.
228#
229ROOTMANIFESTDIR=	$(ROOTVARSVCMANIFEST)/__nonexistent_directory__
230ROOTMANIFEST=		$(MANIFEST:%=$(ROOTMANIFESTDIR)/%)
231CHKMANIFEST=		$(MANIFEST:%.xml=%.xmlchk)
232
233#
234# For installing "starter scripts" of services
235#
236
237ROOTSVCBIN=		$(SVCBIN:%=$(ROOTLIBSVCBIN)/%)
238ROOTSVCMETHOD=		$(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
239
240ROOTSVCBINDIR=		$(ROOTLIBSVCBIN)/__nonexistent_directory__
241ROOTSVCBIN= 		$(SVCBIN:%=$(ROOTSVCBINDIR)/%)
242$(ROOTSVCBIN)		:= FILEMODE= 544
243
244#
245
246# For programs that are installed in the root filesystem,
247# build $(ROOTFS_PROG) rather than $(PROG)
248$(ROOTFS_PROG) := LDFLAGS += -Wl,-I/lib/ld.so.1
249
250$(KRB5BIN)/%: %
251	$(INS.file)
252
253$(KRB5SBIN)/%: %
254	$(INS.file)
255
256$(KRB5LIB)/%: %
257	$(INS.file)
258
259$(ROOTBIN)/%: %
260	$(INS.file)
261
262$(ROOTLIB)/%: %
263	$(INS.file)
264
265$(ROOTBIN64)/%: %
266	$(INS.file)
267
268$(ROOTLIB64)/%: %
269	$(INS.file)
270
271$(ROOTBIN32)/%: %
272	$(INS.file)
273
274$(ROOTSHLIB)/%: %
275	$(INS.file)
276
277$(ROOTSBIN)/%: %
278	$(INS.file)
279
280$(ROOTUSRSBIN)/%: %
281	$(INS.file)
282
283$(ROOTUSRSBIN32)/%: %
284	$(INS.file)
285
286$(ROOTUSRSBIN64)/%: %
287	$(INS.file)
288
289$(ROOTETC)/%: %
290	$(INS.file)
291
292$(ROOTETCDEFAULT)/%:	%.dfl
293	$(INS.rename)
294
295$(ROOTCCSBIN)/%: %
296	$(INS.file)
297
298$(ROOTUSRKVM)/%: %
299	$(INS.file)
300
301$(ROOTXPG4BIN)/%: %.xpg4
302	$(INS.rename)
303
304$(ROOTXPG4BIN32)/%: %.xpg4
305	$(INS.rename)
306
307$(ROOTXPG4BIN64)/%: %.xpg4
308	$(INS.rename)
309
310$(ROOTXPG6BIN)/%: %.xpg6
311	$(INS.rename)
312
313$(ROOTLOCALEDEF)/%: %
314	$(INS.file)
315
316$(ROOTCHARMAP)/%: %
317	$(INS.file)
318
319$(ROOTI18NEXT)/%: %
320	$(INS.file)
321
322$(ROOTI18NEXT64)/%: %
323	$(INS.file)
324
325$(ROOTLIBSVCMETHOD)/%: %
326	$(INS.file)
327
328$(ROOTLIBSVCBIN)/%: %
329	$(INS.file)
330
331$(ROOTSVCMILESTONE)/%: %
332	$(INS.file)
333
334$(ROOTSVCDEVICE)/%: %
335	$(INS.file)
336
337$(ROOTSVCSYSTEM)/%: %
338	$(INS.file)
339
340$(ROOTSVCSYSTEMDEVICE)/%: %
341	$(INS.file)
342
343$(ROOTSVCSYSTEMFILESYSTEM)/%: %
344	$(INS.file)
345
346$(ROOTSVCSYSTEMSECURITY)/%: %
347	$(INS.file)
348
349$(ROOTSVCNETWORK)/%: %
350	$(INS.file)
351
352$(ROOTSVCNETWORKLDAP)/%: %
353	$(INS.file)
354
355$(ROOTSVCNETWORKNFS)/%: %
356	$(INS.file)
357
358$(ROOTSVCNETWORKNIS)/%: %
359	$(INS.file)
360
361$(ROOTSVCNETWORKRPC)/%: %
362	$(INS.file)
363
364$(ROOTSVCNETWORKSECURITY)/%: %
365	$(INS.file)
366
367$(ROOTSVCNETWORKSSL)/%: %
368	$(INS.file)
369
370$(ROOTSVCAPPLICATION)/%: %
371	$(INS.file)
372
373$(ROOTSVCAPPLICATIONMANAGEMENT)/%: %
374	$(INS.file)
375
376$(ROOTSVCAPPLICATIONSECURITY)/%: %
377	$(INS.file)
378
379$(ROOTSVCAPPLICATIONPRINT)/%: %
380	$(INS.file)
381
382$(ROOTSVCPLATFORM)/%: %
383	$(INS.file)
384
385$(ROOTSVCPLATFORMI86PC)/%: %
386	$(INS.file)
387
388$(ROOTSVCPLATFORMSUN4U)/%: %
389	$(INS.file)
390
391$(ROOTSVCPLATFORMSUN4V)/%: %
392	$(INS.file)
393
394$(ROOTMAN1)/%: %.sunman
395	$(INS.rename)
396
397$(ROOTMAN1M)/%: %.sunman
398	$(INS.rename)
399
400$(ROOTMAN3)/%: %.sunman
401	$(INS.rename)
402
403# build rule for statically linked programs with single source file.
404%.static: %.c
405	$(LINK.c) -o $@ $< $(LDLIBS)
406	$(POST_PROCESS)
407
408%.xpg4: %.c
409	$(LINK.c) -o $@ $< $(LDLIBS)
410	$(POST_PROCESS)
411
412%.xpg6: %.c
413	$(LINK.c) -o $@ $< $(LDLIBS)
414	$(POST_PROCESS)
415
416# Define the majority text domain in this directory.
417TEXT_DOMAIN= SUNW_OST_OSCMD
418
419CLOBBERFILES += $(XPG4) $(XPG6) $(DCFILE)
420
421# This flag is being added only for SCO (x86) compatibility
422i386_SPFLAG=    -D_iBCS2
423sparc_SPFLAG=
424
425iBCS2FLAG = $($(MACH)_SPFLAG)
426
427# This flag is for programs which should not build a 32-bit binary
428sparc_64ONLY= $(POUND_SIGN)
42964ONLY=	 $($(MACH)_64ONLY)
430