xref: /titanic_44/usr/src/cmd/Makefile.cmd (revision c5c4113dfcabb1eed3d4bdf7609de5170027a794)
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
126LDLIBS =	$(LDLIBS.cmd)
127
128LDFLAGS.cmd = \
129	$(ENVLDFLAGS1) $(ENVLDFLAGS2) $(ENVLDFLAGS3) \
130	$(MAPFILE.NES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%)
131
132LDFLAGS =	$(LDFLAGS.cmd)
133
134LINTFLAGS=	-axsm
135LINTFLAGS64=	-axsm -Xarch=$(MACH64:sparcv9=v9)
136LINTOUT=	lint.out
137
138KRB5PROG=	$(PROG:%=$(KRB5BIN)/%)
139KRB5SBINPROG=	$(PROG:%=$(KRB5SBIN)/%)
140KRB5LIBPROG=	$(PROG:%=$(KRB5LIB)/%)
141
142ROOTPROG=	$(PROG:%=$(ROOTBIN)/%)
143ROOTCMD=	$(PROG:%=$(ROOTCMDDIR)/%)
144ROOTSHFILES=	$(SHFILES:%=$(ROOTBIN)/%)
145ROOTLIBPROG=	$(PROG:%=$(ROOTLIB)/%)
146ROOTLIBSHFILES= $(SHFILES:%=$(ROOTLIB)/%)
147ROOTSHLIBPROG=	$(PROG:%=$(ROOTSHLIB)/%)
148ROOTSBINPROG=	$(PROG:%=$(ROOTSBIN)/%)
149ROOTUSRSBINPROG=$(PROG:%=$(ROOTUSRSBIN)/%)
150ROOTETCPROG=	$(PROG:%=$(ROOTETC)/%)
151ROOTCCSBINPROG=	$(PROG:%=$(ROOTCCSBIN)/%)
152ROOTUSRKVMPROG=	$(PROG:%=$(ROOTUSRKVM)/%)
153ROOTXPG4PROG=	$(XPG4PROG:%=$(ROOTXPG4BIN)/%)
154ROOTXPG4PROG32=	$(XPG4PROG:%=$(ROOTXPG4BIN32)/%)
155ROOTXPG4PROG64=	$(XPG4PROG:%=$(ROOTXPG4BIN64)/%)
156ROOTXPG6PROG=	$(XPG6PROG:%=$(ROOTXPG6BIN)/%)
157ROOTLOCALEPROG=	$(PROG:%=$(ROOTLOCALEDEF)/%)
158ROOTPROG64=	$(PROG:%=$(ROOTBIN64)/%)
159ROOTPROG32=	$(PROG:%=$(ROOTBIN32)/%)
160ROOTCMD64=	$(PROG:%=$(ROOTCMDDIR64)/%)
161ROOTUSRSBINPROG32=	$(PROG:%=$(ROOTUSRSBIN32)/%)
162ROOTUSRSBINPROG64=	$(PROG:%=$(ROOTUSRSBIN64)/%)
163ROOTMAN1FILES=	$(MAN1FILES:%=$(ROOTMAN1)/%)
164$(ROOTMAN1FILES) := FILEMODE= 444
165$(ROOTMAN1FILES) := OWNER= root
166$(ROOTMAN1FILES) := GROUP= bin
167ROOTMAN1MFILES=	$(MAN1MFILES:%=$(ROOTMAN1M)/%)
168$(ROOTMAN1MFILES) := FILEMODE= 444
169$(ROOTMAN1MFILES) := OWNER= root
170$(ROOTMAN1MFILES) := GROUP= bin
171ROOTMAN3FILES=	$(MAN3FILES:%=$(ROOTMAN3)/%)
172$(ROOTMAN3FILES) := FILEMODE= 444
173$(ROOTMAN3FILES) := OWNER= root
174$(ROOTMAN3FILES) := GROUP= bin
175
176ROOTETCDEFAULT=	$(ROOTETC)/default
177ROOTETCDEFAULTFILES=	$(DEFAULTFILES:%.dfl=$(ROOTETCDEFAULT)/%)
178$(ROOTETCDEFAULTFILES) :=	OWNER = root
179$(ROOTETCDEFAULTFILES) :=	GROUP = sys
180$(ROOTETCDEFAULTFILES) :=	FILEMODE = 0644
181
182#
183# Directories for smf(5) service manifests and profiles.
184#
185ROOTVARSVC=			$(ROOT)/var/svc
186
187ROOTVARSVCMANIFEST=		$(ROOTVARSVC)/manifest
188ROOTVARSVCPROFILE=		$(ROOTVARSVC)/profile
189
190ROOTSVCMILESTONE=		$(ROOTVARSVCMANIFEST)/milestone
191ROOTSVCDEVICE=			$(ROOTVARSVCMANIFEST)/device
192ROOTSVCSYSTEM=			$(ROOTVARSVCMANIFEST)/system
193ROOTSVCSYSTEMDEVICE=		$(ROOTSVCSYSTEM)/device
194ROOTSVCSYSTEMFILESYSTEM=	$(ROOTSVCSYSTEM)/filesystem
195ROOTSVCSYSTEMSECURITY=		$(ROOTSVCSYSTEM)/security
196ROOTSVCNETWORK=			$(ROOTVARSVCMANIFEST)/network
197ROOTSVCNETWORKLDAP=		$(ROOTSVCNETWORK)/ldap
198ROOTSVCNETWORKNFS=		$(ROOTSVCNETWORK)/nfs
199ROOTSVCNETWORKNIS=		$(ROOTSVCNETWORK)/nis
200ROOTSVCNETWORKROUTING=		$(ROOTSVCNETWORK)/routing
201ROOTSVCNETWORKRPC=		$(ROOTSVCNETWORK)/rpc
202ROOTSVCNETWORKSECURITY=		$(ROOTSVCNETWORK)/security
203ROOTSVCNETWORKSSL=		$(ROOTSVCNETWORK)/ssl
204ROOTSVCNETWORKIPSEC=		$(ROOTSVCNETWORK)/ipsec
205ROOTSVCNETWORKSHARES=		$(ROOTSVCNETWORK)/shares
206ROOTSVCPLATFORM=		$(ROOTVARSVCMANIFEST)/platform
207ROOTSVCPLATFORMSUN4U=		$(ROOTSVCPLATFORM)/sun4u
208ROOTSVCPLATFORMSUN4V=		$(ROOTSVCPLATFORM)/sun4v
209ROOTSVCAPPLICATION=		$(ROOTVARSVCMANIFEST)/application
210ROOTSVCAPPLICATIONMANAGEMENT=	$(ROOTSVCAPPLICATION)/management
211ROOTSVCAPPLICATIONSECURITY=	$(ROOTSVCAPPLICATION)/security
212ROOTSVCAPPLICATIONPRINT=	$(ROOTSVCAPPLICATION)/print
213
214#
215# Commands Makefiles delivering a manifest are expected to define MANIFEST.
216#
217# Like ROOTCMDDIR, any lower-level Makefiles that put their manifests in a
218# subdirectory of the manifest directories listed above should reset
219# ROOTMANIFESTDIR and use it in their `install' target. By default we set this
220# to a bogus value so that it will not conflict with any of the other values
221# already  defined in this Makefile.
222#
223# The manifest validation of the $SRC/cmd check target is also derived from a
224# valid MANIFEST setting.
225#
226ROOTMANIFESTDIR=	$(ROOTVARSVCMANIFEST)/__nonexistent_directory__
227ROOTMANIFEST=		$(MANIFEST:%=$(ROOTMANIFESTDIR)/%)
228CHKMANIFEST=		$(MANIFEST:%.xml=%.xmlchk)
229
230#
231# For installing "starter scripts" of services
232#
233
234ROOTSVCMETHOD=		$(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
235
236ROOTSVCBINDIR=		$(ROOTLIBSVCBIN)/__nonexistent_directory__
237ROOTSVCBIN= 		$(SVCBIN:%=$(ROOTSVCBINDIR)/%)
238
239#
240
241# For programs that are installed in the root filesystem,
242# build $(ROOTFS_PROG) rather than $(PROG)
243$(ROOTFS_PROG) := LDFLAGS += -Wl,-I/lib/ld.so.1
244
245$(KRB5BIN)/%: %
246	$(INS.file)
247
248$(KRB5SBIN)/%: %
249	$(INS.file)
250
251$(KRB5LIB)/%: %
252	$(INS.file)
253
254$(ROOTBIN)/%: %
255	$(INS.file)
256
257$(ROOTLIB)/%: %
258	$(INS.file)
259
260$(ROOTBIN64)/%: %
261	$(INS.file)
262
263$(ROOTLIB64)/%: %
264	$(INS.file)
265
266$(ROOTBIN32)/%: %
267	$(INS.file)
268
269$(ROOTSHLIB)/%: %
270	$(INS.file)
271
272$(ROOTSBIN)/%: %
273	$(INS.file)
274
275$(ROOTUSRSBIN)/%: %
276	$(INS.file)
277
278$(ROOTUSRSBIN32)/%: %
279	$(INS.file)
280
281$(ROOTUSRSBIN64)/%: %
282	$(INS.file)
283
284$(ROOTETC)/%: %
285	$(INS.file)
286
287$(ROOTETCDEFAULT)/%:	%.dfl
288	$(INS.rename)
289
290$(ROOTCCSBIN)/%: %
291	$(INS.file)
292
293$(ROOTUSRKVM)/%: %
294	$(INS.file)
295
296$(ROOTXPG4BIN)/%: %.xpg4
297	$(INS.rename)
298
299$(ROOTXPG4BIN32)/%: %.xpg4
300	$(INS.rename)
301
302$(ROOTXPG4BIN64)/%: %.xpg4
303	$(INS.rename)
304
305$(ROOTXPG6BIN)/%: %.xpg6
306	$(INS.rename)
307
308$(ROOTLOCALEDEF)/%: %
309	$(INS.file)
310
311$(ROOTCHARMAP)/%: %
312	$(INS.file)
313
314$(ROOTI18NEXT)/%: %
315	$(INS.file)
316
317$(ROOTI18NEXT64)/%: %
318	$(INS.file)
319
320$(ROOTLIBSVCMETHOD)/%: %
321	$(INS.file)
322
323$(ROOTLIBSVCBIN)/%: %
324	$(INS.file)
325
326$(ROOTSVCMILESTONE)/%: %
327	$(INS.file)
328
329$(ROOTSVCDEVICE)/%: %
330	$(INS.file)
331
332$(ROOTSVCSYSTEM)/%: %
333	$(INS.file)
334
335$(ROOTSVCSYSTEMDEVICE)/%: %
336	$(INS.file)
337
338$(ROOTSVCSYSTEMFILESYSTEM)/%: %
339	$(INS.file)
340
341$(ROOTSVCSYSTEMSECURITY)/%: %
342	$(INS.file)
343
344$(ROOTSVCNETWORK)/%: %
345	$(INS.file)
346
347$(ROOTSVCNETWORKLDAP)/%: %
348	$(INS.file)
349
350$(ROOTSVCNETWORKNFS)/%: %
351	$(INS.file)
352
353$(ROOTSVCNETWORKNIS)/%: %
354	$(INS.file)
355
356$(ROOTSVCNETWORKRPC)/%: %
357	$(INS.file)
358
359$(ROOTSVCNETWORKSECURITY)/%: %
360	$(INS.file)
361
362$(ROOTSVCNETWORKSSL)/%: %
363	$(INS.file)
364
365$(ROOTSVCNETWORKIPSEC)/%: %
366	$(INS.file)
367
368$(ROOTSVCNETWORKSHARES)/%: %
369	$(INS.file)
370
371$(ROOTSVCAPPLICATION)/%: %
372	$(INS.file)
373
374$(ROOTSVCAPPLICATIONMANAGEMENT)/%: %
375	$(INS.file)
376
377$(ROOTSVCAPPLICATIONSECURITY)/%: %
378	$(INS.file)
379
380$(ROOTSVCAPPLICATIONPRINT)/%: %
381	$(INS.file)
382
383$(ROOTSVCPLATFORM)/%: %
384	$(INS.file)
385
386$(ROOTSVCPLATFORMSUN4U)/%: %
387	$(INS.file)
388
389$(ROOTSVCPLATFORMSUN4V)/%: %
390	$(INS.file)
391
392$(ROOTMAN1)/%: %.sunman
393	$(INS.rename)
394
395$(ROOTMAN1M)/%: %.sunman
396	$(INS.rename)
397
398$(ROOTMAN3)/%: %.sunman
399	$(INS.rename)
400
401# build rule for statically linked programs with single source file.
402%.static: %.c
403	$(LINK.c) -o $@ $< $(LDLIBS)
404	$(POST_PROCESS)
405
406%.xpg4: %.c
407	$(LINK.c) -o $@ $< $(LDLIBS)
408	$(POST_PROCESS)
409
410%.xpg6: %.c
411	$(LINK.c) -o $@ $< $(LDLIBS)
412	$(POST_PROCESS)
413
414# Define the majority text domain in this directory.
415TEXT_DOMAIN= SUNW_OST_OSCMD
416
417CLOBBERFILES += $(XPG4) $(XPG6) $(DCFILE)
418
419# This flag is being added only for SCO (x86) compatibility
420i386_SPFLAG=    -D_iBCS2
421sparc_SPFLAG=
422
423iBCS2FLAG = $($(MACH)_SPFLAG)
424
425# This flag is for programs which should not build a 32-bit binary
426sparc_64ONLY= $(POUND_SIGN)
42764ONLY=	 $($(MACH)_64ONLY)
428