xref: /titanic_41/usr/src/cmd/Makefile.cmd (revision 35f36846429327ed1512f8098c6a6b337055d875)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28# Definitions common to command source.
29#
30# include global definitions; SRC should be defined in the shell.
31# SRC is needed until RFE 1026993 is implemented.
32
33include $(SRC)/Makefile.master
34
35LN=		ln
36CP=		cp
37SH=		sh
38ECHO=		echo
39MKDIR=		mkdir
40TOUCH=		touch
41
42FILEMODE=	0555
43LIBFILEMODE=	0444
44XPG4=		$(XPG4PROG:%=%.xpg4)
45XPG6=		$(XPG6PROG:%=%.xpg6)
46
47KRB5DIR=	$(ROOT)/usr
48KRB5BIN=	$(KRB5DIR)/bin
49KRB5SBIN=	$(KRB5DIR)/sbin
50KRB5LIB=	$(KRB5DIR)/lib/krb5
51KRB5RUNPATH=	/usr/lib/krb5
52GSSRUNPATH=	/usr/lib/gss
53
54
55ROOTBIN=		$(ROOT)/usr/bin
56ROOTLIB=		$(ROOT)/usr/lib
57ROOTLIBSVCBIN=		$(ROOT)/lib/svc/bin
58ROOTLIBSVCMETHOD=	$(ROOT)/lib/svc/method
59
60ROOTSHLIB=	$(ROOT)/usr/share/lib
61ROOTSBIN=	$(ROOT)/sbin
62ROOTUSRSBIN=	$(ROOT)/usr/sbin
63ROOTETC=	$(ROOT)/etc
64ROOTCCSBIN=	$(ROOT)/usr/ccs/bin
65ROOTUSRKVM=	$(ROOT)/usr/kvm
66ROOTXPG4=	$(ROOT)/usr/xpg4
67ROOTXPG4BIN=	$(ROOT)/usr/xpg4/bin
68ROOTXPG4BIN32=	$(ROOTXPG4BIN)/$(MACH32)
69ROOTXPG4BIN64=	$(ROOTXPG4BIN)/$(MACH64)
70ROOTXPG6=	$(ROOT)/usr/xpg6
71ROOTXPG6BIN=	$(ROOT)/usr/xpg6/bin
72ROOTLOCALEDEF=	$(ROOT)/usr/lib/localedef
73ROOTCHARMAP=	$(ROOTLOCALEDEF)/charmap
74ROOTI18NEXT=	$(ROOTLOCALEDEF)/extensions
75ROOTI18NEXT64=	$(ROOTLOCALEDEF)/extensions/$(MACH64)
76ROOTBIN32=	$(ROOTBIN)/$(MACH32)
77ROOTBIN64=	$(ROOTBIN)/$(MACH64)
78ROOTCMDDIR64=	$(ROOTCMDDIR)/$(MACH64)
79ROOTLIB64=	$(ROOTLIB)/$(MACH64)
80ROOTUSRSBIN32=	$(ROOTUSRSBIN)/$(MACH32)
81ROOTUSRSBIN64=	$(ROOTUSRSBIN)/$(MACH64)
82ROOTMAN1=	$(ROOT)/usr/share/man/man1
83ROOTMAN1M=	$(ROOT)/usr/share/man/man1m
84ROOTMAN3=	$(ROOT)/usr/share/man/man3
85
86#
87
88# Like ROOTLIBDIR in $(SRC)/Makefile.lib, any lower-level Makefiles that
89# put their binaries in a non-standard location should reset this and use
90# $(ROOTCMD) in their `install' target. By default we set this to a bogus
91# value so that it will not conflict with any of the other values already
92# defined in this Makefile.
93#
94ROOTCMDDIR=	$(ROOT)/__nonexistent_directory__
95
96ROOTSHAUDIO=	$(ROOT)/usr/share/audio
97ROOTAUDIOSAMP=	$(ROOTSHAUDIO)/samples
98ROOTAUDIOSAMPAU=$(ROOTAUDIOSAMP)/au
99
100#
101# Begin /usr/sfw freeware rules for freeware that has "External"
102# taxonomy stability level.
103#
104ROOTSFW=	$(ROOT)/usr/sfw
105ROOTSFWBIN=	$(ROOT)/usr/sfw/bin
106ROOTSFWSBIN=	$(ROOT)/usr/sfw/sbin
107ROOTSFWSHARE=	$(ROOT)/usr/sfw/share
108ROOTSFWSHSRC=	$(ROOT)/usr/sfw/share/src
109ROOTSFWINFO=	$(ROOT)/usr/sfw/share/info
110ROOTSFWINCLUDE=	$(ROOT)/usr/sfw/include
111ROOTSFWLIB=	$(ROOT)/usr/sfw/lib
112ROOTLIBEXEC=	$(ROOT)/usr/sfw/libexec
113ROOTSFWMAN=	$(ROOT)/usr/sfw/share/man
114ROOTSFWMANN=	$(ROOT)/usr/sfw/share/mann
115ROOTSFWMAN1=	$(ROOT)/usr/sfw/share/man/man1
116ROOTSFWMAN1M=	$(ROOT)/usr/sfw/share/man/man1m
117ROOTSFWMAN3=	$(ROOT)/usr/sfw/share/man/man3
118ROOTSFWMAN5=	$(ROOT)/usr/sfw/share/man/man5
119ROOTSFWMAN7=	$(ROOT)/usr/sfw/share/man/man7
120#
121# End /usr/sfw freeware rules
122#
123
124ISAEXEC=	$(ROOT)/usr/lib/isaexec
125PLATEXEC=	$(ROOT)/usr/lib/platexec
126
127NX_MAP_i386=	$(SRC)/cmd/mapfile_noexdata
128NX_MAP_sparc=
129NX_MAP=		$(NX_MAP_$(MACH))
130NES_MAPFILE=	$(SRC)/cmd/mapfile_noexstk $(NX_MAP)
131
132LDLIBS =	$(LDLIBS.cmd)
133
134LDFLAGS.cmd = \
135	$(ENVLDFLAGS1) $(ENVLDFLAGS2) $(ENVLDFLAGS3) \
136	$(NES_MAPFILE:%=-M%) $(PGA_MAPFILE:%=-M%)
137
138LDFLAGS =	$(LDFLAGS.cmd)
139
140LINTFLAGS=	-axsm
141LINTFLAGS64=	-axsm -Xarch=$(MACH64:sparcv9=v9)
142LINTOUT=	lint.out
143
144KRB5PROG=	$(PROG:%=$(KRB5BIN)/%)
145KRB5SBINPROG=	$(PROG:%=$(KRB5SBIN)/%)
146KRB5LIBPROG=	$(PROG:%=$(KRB5LIB)/%)
147
148ROOTPROG=	$(PROG:%=$(ROOTBIN)/%)
149ROOTCMD=	$(PROG:%=$(ROOTCMDDIR)/%)
150ROOTSHFILES=	$(SHFILES:%=$(ROOTBIN)/%)
151ROOTLIBPROG=	$(PROG:%=$(ROOTLIB)/%)
152ROOTLIBSHFILES= $(SHFILES:%=$(ROOTLIB)/%)
153ROOTSHLIBPROG=	$(PROG:%=$(ROOTSHLIB)/%)
154ROOTSBINPROG=	$(PROG:%=$(ROOTSBIN)/%)
155ROOTUSRSBINPROG=$(PROG:%=$(ROOTUSRSBIN)/%)
156ROOTETCPROG=	$(PROG:%=$(ROOTETC)/%)
157ROOTCCSBINPROG=	$(PROG:%=$(ROOTCCSBIN)/%)
158ROOTUSRKVMPROG=	$(PROG:%=$(ROOTUSRKVM)/%)
159ROOTXPG4PROG=	$(XPG4PROG:%=$(ROOTXPG4BIN)/%)
160ROOTXPG4PROG32=	$(XPG4PROG:%=$(ROOTXPG4BIN32)/%)
161ROOTXPG4PROG64=	$(XPG4PROG:%=$(ROOTXPG4BIN64)/%)
162ROOTXPG6PROG=	$(XPG6PROG:%=$(ROOTXPG6BIN)/%)
163ROOTLOCALEPROG=	$(PROG:%=$(ROOTLOCALEDEF)/%)
164ROOTPROG64=	$(PROG:%=$(ROOTBIN64)/%)
165ROOTPROG32=	$(PROG:%=$(ROOTBIN32)/%)
166ROOTCMD64=	$(PROG:%=$(ROOTCMDDIR64)/%)
167ROOTUSRSBINPROG32=	$(PROG:%=$(ROOTUSRSBIN32)/%)
168ROOTUSRSBINPROG64=	$(PROG:%=$(ROOTUSRSBIN64)/%)
169ROOTMAN1FILES=	$(MAN1FILES:%=$(ROOTMAN1)/%)
170$(ROOTMAN1FILES) := FILEMODE= 444
171$(ROOTMAN1FILES) := OWNER= root
172$(ROOTMAN1FILES) := GROUP= bin
173ROOTMAN1MFILES=	$(MAN1MFILES:%=$(ROOTMAN1M)/%)
174$(ROOTMAN1MFILES) := FILEMODE= 444
175$(ROOTMAN1MFILES) := OWNER= root
176$(ROOTMAN1MFILES) := GROUP= bin
177ROOTMAN3FILES=	$(MAN3FILES:%=$(ROOTMAN3)/%)
178$(ROOTMAN3FILES) := FILEMODE= 444
179$(ROOTMAN3FILES) := OWNER= root
180$(ROOTMAN3FILES) := GROUP= bin
181
182ROOTETCDEFAULT=	$(ROOTETC)/default
183ROOTETCDEFAULTFILES=	$(DEFAULTFILES:%.dfl=$(ROOTETCDEFAULT)/%)
184$(ROOTETCDEFAULTFILES) :=	OWNER = root
185$(ROOTETCDEFAULTFILES) :=	GROUP = sys
186$(ROOTETCDEFAULTFILES) :=	FILEMODE = 0644
187
188#
189# Directories for smf(5) service manifests and profiles.
190#
191ROOTVARSVC=			$(ROOT)/var/svc
192
193ROOTVARSVCMANIFEST=		$(ROOTVARSVC)/manifest
194ROOTVARSVCPROFILE=		$(ROOTVARSVC)/profile
195
196ROOTSVCMILESTONE=		$(ROOTVARSVCMANIFEST)/milestone
197ROOTSVCDEVICE=			$(ROOTVARSVCMANIFEST)/device
198ROOTSVCSYSTEM=			$(ROOTVARSVCMANIFEST)/system
199ROOTSVCSYSTEMDEVICE=		$(ROOTSVCSYSTEM)/device
200ROOTSVCSYSTEMFILESYSTEM=	$(ROOTSVCSYSTEM)/filesystem
201ROOTSVCSYSTEMSECURITY=		$(ROOTSVCSYSTEM)/security
202ROOTSVCNETWORK=			$(ROOTVARSVCMANIFEST)/network
203ROOTSVCNETWORKLDAP=		$(ROOTSVCNETWORK)/ldap
204ROOTSVCNETWORKNFS=		$(ROOTSVCNETWORK)/nfs
205ROOTSVCNETWORKNIS=		$(ROOTSVCNETWORK)/nis
206ROOTSVCNETWORKRPC=		$(ROOTSVCNETWORK)/rpc
207ROOTSVCNETWORKSECURITY=		$(ROOTSVCNETWORK)/security
208ROOTSVCNETWORKSSL=		$(ROOTSVCNETWORK)/ssl
209ROOTSVCPLATFORM=		$(ROOTVARSVCMANIFEST)/platform
210ROOTSVCPLATFORMI86PC=		$(ROOTSVCPLATFORM)/i86pc
211ROOTSVCPLATFORMSUN4U=		$(ROOTSVCPLATFORM)/sun4u
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$(ROOTMAN1)/%: %.sunman
392	$(INS.rename)
393
394$(ROOTMAN1M)/%: %.sunman
395	$(INS.rename)
396
397$(ROOTMAN3)/%: %.sunman
398	$(INS.rename)
399
400# build rule for statically linked programs with single source file.
401%.static: %.c
402	$(LINK.c) -o $@ $< $(LDLIBS)
403	$(POST_PROCESS)
404
405%.xpg4: %.c
406	$(LINK.c) -o $@ $< $(LDLIBS)
407	$(POST_PROCESS)
408
409%.xpg6: %.c
410	$(LINK.c) -o $@ $< $(LDLIBS)
411	$(POST_PROCESS)
412
413# Define the majority text domain in this directory.
414TEXT_DOMAIN= SUNW_OST_OSCMD
415
416CLOBBERFILES += $(XPG4) $(XPG6) $(DCFILE)
417
418# This flag is being added only for SCO (x86) compatibility
419i386_SPFLAG=    -D_iBCS2
420sparc_SPFLAG=
421
422iBCS2FLAG = $($(MACH)_SPFLAG)
423
424# This flag is for programs which should not build a 32-bit binary
425sparc_64ONLY= $(POUND_SIGN)
42664ONLY=	 $($(MACH)_64ONLY)
427