xref: /titanic_51/usr/src/cmd/Makefile.cmd (revision 113f42324b1acf3e5144da27ddbda36e338fbd07)
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
208ROOTSVCPLATFORM=		$(ROOTVARSVCMANIFEST)/platform
209ROOTSVCPLATFORMI86PC=		$(ROOTSVCPLATFORM)/i86pc
210ROOTSVCPLATFORMSUN4U=		$(ROOTSVCPLATFORM)/sun4u
211ROOTSVCAPPLICATION=		$(ROOTVARSVCMANIFEST)/application
212ROOTSVCAPPLICATIONMANAGEMENT=	$(ROOTSVCAPPLICATION)/management
213ROOTSVCAPPLICATIONSECURITY=	$(ROOTSVCAPPLICATION)/security
214ROOTSVCAPPLICATIONPRINT=	$(ROOTSVCAPPLICATION)/print
215
216#
217# Commands Makefiles delivering a manifest are expected to define MANIFEST.
218#
219# Like ROOTCMDDIR, any lower-level Makefiles that put their manifests in a
220# subdirectory of the manifest directories listed above should reset
221# ROOTMANIFESTDIR and use it in their `install' target. By default we set this
222# to a bogus value so that it will not conflict with any of the other values
223# already  defined in this Makefile.
224#
225# The manifest validation of the $SRC/cmd check target is also derived from a
226# valid MANIFEST setting.
227#
228ROOTMANIFESTDIR=	$(ROOTVARSVCMANIFEST)/__nonexistent_directory__
229ROOTMANIFEST=		$(MANIFEST:%=$(ROOTMANIFESTDIR)/%)
230CHKMANIFEST=		$(MANIFEST:%.xml=%.xmlchk)
231
232#
233# For installing "starter scripts" of services
234#
235
236ROOTSVCBIN=		$(SVCBIN:%=$(ROOTLIBSVCBIN)/%)
237ROOTSVCMETHOD=		$(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
238
239ROOTSVCBINDIR=		$(ROOTLIBSVCBIN)/__nonexistent_directory__
240ROOTSVCBIN= 		$(SVCBIN:%=$(ROOTSVCBINDIR)/%)
241$(ROOTSVCBIN)		:= FILEMODE= 544
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$(ROOTSVCAPPLICATION)/%: %
367	$(INS.file)
368
369$(ROOTSVCAPPLICATIONMANAGEMENT)/%: %
370	$(INS.file)
371
372$(ROOTSVCAPPLICATIONSECURITY)/%: %
373	$(INS.file)
374
375$(ROOTSVCAPPLICATIONPRINT)/%: %
376	$(INS.file)
377
378$(ROOTSVCPLATFORM)/%: %
379	$(INS.file)
380
381$(ROOTSVCPLATFORMI86PC)/%: %
382	$(INS.file)
383
384$(ROOTSVCPLATFORMSUN4U)/%: %
385	$(INS.file)
386
387$(ROOTMAN1)/%: %.sunman
388	$(INS.rename)
389
390$(ROOTMAN1M)/%: %.sunman
391	$(INS.rename)
392
393$(ROOTMAN3)/%: %.sunman
394	$(INS.rename)
395
396# build rule for statically linked programs with single source file.
397%.static: %.c
398	$(LINK.c) -o $@ $< $(LDLIBS)
399	$(POST_PROCESS)
400
401%.xpg4: %.c
402	$(LINK.c) -o $@ $< $(LDLIBS)
403	$(POST_PROCESS)
404
405%.xpg6: %.c
406	$(LINK.c) -o $@ $< $(LDLIBS)
407	$(POST_PROCESS)
408
409# Define the majority text domain in this directory.
410TEXT_DOMAIN= SUNW_OST_OSCMD
411
412CLOBBERFILES += $(XPG4) $(XPG6) $(DCFILE)
413
414# This flag is being added only for SCO (x86) compatibility
415i386_SPFLAG=    -D_iBCS2
416sparc_SPFLAG=
417
418iBCS2FLAG = $($(MACH)_SPFLAG)
419
420# This flag is for programs which should not build a 32-bit binary
421sparc_64ONLY= $(POUND_SIGN)
42264ONLY=	 $($(MACH)_64ONLY)
423