xref: /titanic_44/usr/src/cmd/Makefile.cmd (revision 032cbfeb31ca7a979f1bfc44d634f28fc24a70dd)
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 (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23#
24# Definitions common to command source.
25#
26# include global definitions; SRC should be defined in the shell.
27# SRC is needed until RFE 1026993 is implemented.
28
29include $(SRC)/Makefile.master
30
31LN=		ln
32SH=		sh
33ECHO=		echo
34MKDIR=		mkdir
35TOUCH=		touch
36
37FILEMODE=	0555
38LIBFILEMODE=	0444
39XPG4=		$(XPG4PROG:%=%.xpg4)
40XPG6=		$(XPG6PROG:%=%.xpg6)
41
42KRB5DIR=	$(ROOT)/usr
43KRB5BIN=	$(KRB5DIR)/bin
44KRB5SBIN=	$(KRB5DIR)/sbin
45KRB5LIB=	$(KRB5DIR)/lib/krb5
46KRB5RUNPATH=	/usr/lib/krb5
47GSSRUNPATH=	/usr/lib/gss
48
49
50ROOTBIN=		$(ROOT)/usr/bin
51ROOTLIB=		$(ROOT)/usr/lib
52ROOTLIBSVCBIN=		$(ROOT)/lib/svc/bin
53ROOTLIBSVCMETHOD=	$(ROOT)/lib/svc/method
54ROOTLIBXEN=		$(ROOT)/usr/lib/xen/bin
55ROOTLIBZONES=		$(ROOT)/lib/zones
56
57ROOTSHLIB=	$(ROOT)/usr/share/lib
58ROOTPKGBIN=	$(ROOT)/usr/sadm/install/bin
59ROOTCLASS_SCR_DIR= $(ROOT)/usr/sadm/install/scripts
60ROOTADMIN_SRC_DIR= $(ROOT)/var/sadm/install/admin
61
62ROOTSHLIBCCS=	$(ROOTSHLIB)/ccs
63ROOTSBIN=	$(ROOT)/sbin
64ROOTUSRSBIN=	$(ROOT)/usr/sbin
65ROOTETC=	$(ROOT)/etc
66
67ROOTETCSECURITY=	$(ROOTETC)/security
68ROOTETCTSOL=	$(ROOTETCSECURITY)/tsol
69ROOTETCSECLIB=	$(ROOTETCSECURITY)/lib
70ROOTETCZONES=	$(ROOTETC)/zones
71
72ROOTETCFTPD=	$(ROOT)/etc/ftpd
73ROOTETCINET=	$(ROOT)/etc/inet
74ROOTCCSBIN=	$(ROOT)/usr/ccs/bin
75ROOTCCSBIN64=	$(ROOTCCSBIN)/$(MACH64)
76ROOTCCSBINLINKDIR=	$(ROOT)/../../bin
77ROOTCCSBINLINKDIR64=	$(ROOT)../../../bin/$(MACH)
78ROOTCCSLIB=	$(ROOT)/usr/ccs/lib
79ROOTUSRKVM=	$(ROOT)/usr/kvm
80ROOTHAS=	$(ROOT)/usr/has
81ROOTHASBIN=	$(ROOT)/usr/has/bin
82ROOTHASLIB=	$(ROOT)/usr/has/lib
83ROOTXPG4=	$(ROOT)/usr/xpg4
84ROOTXPG4BIN=	$(ROOT)/usr/xpg4/bin
85ROOTXPG4BIN32=	$(ROOTXPG4BIN)/$(MACH32)
86ROOTXPG4BIN64=	$(ROOTXPG4BIN)/$(MACH64)
87ROOTXPG6=	$(ROOT)/usr/xpg6
88ROOTXPG6BIN=	$(ROOT)/usr/xpg6/bin
89ROOTLOCALEDEF=	$(ROOT)/usr/lib/localedef
90ROOTCHARMAP=	$(ROOTLOCALEDEF)/charmap
91ROOTI18NEXT=	$(ROOTLOCALEDEF)/extensions
92ROOTI18NEXT64=	$(ROOTLOCALEDEF)/extensions/$(MACH64)
93ROOTBIN32=	$(ROOTBIN)/$(MACH32)
94ROOTBIN64=	$(ROOTBIN)/$(MACH64)
95ROOTCMDDIR64=	$(ROOTCMDDIR)/$(MACH64)
96ROOTLIB64=	$(ROOTLIB)/$(MACH64)
97ROOTUSRSBIN32=	$(ROOTUSRSBIN)/$(MACH32)
98ROOTUSRSBIN64=	$(ROOTUSRSBIN)/$(MACH64)
99ROOTMAN=	$(ROOT)/usr/share/man
100ROOTMAN1=	$(ROOTMAN)/man1
101ROOTMAN1M=	$(ROOTMAN)/man1m
102ROOTMAN3=	$(ROOTMAN)/man3
103ROOTVARSMB=	$(ROOT)/var/smb
104
105
106#
107# Like ROOTLIBDIR in $(SRC)/Makefile.lib, any lower-level Makefiles that
108# put their binaries in a non-standard location should reset this and use
109# $(ROOTCMD) in their `install' target. By default we set this to a bogus
110# value so that it will not conflict with any of the other values already
111# defined in this Makefile.
112#
113ROOTCMDDIR=	$(ROOT)/__nonexistent_directory__
114
115ROOTSHAUDIO=	$(ROOT)/usr/share/audio
116ROOTAUDIOSAMP=	$(ROOTSHAUDIO)/samples
117ROOTAUDIOSAMPAU=$(ROOTAUDIOSAMP)/au
118
119ISAEXEC=	$(ROOT)/usr/lib/isaexec
120PLATEXEC=	$(ROOT)/usr/lib/platexec
121
122LDLIBS =	$(LDLIBS.cmd)
123
124LDFLAGS.cmd = \
125	$(BDIRECT) $(ENVLDFLAGS1) $(ENVLDFLAGS2) $(ENVLDFLAGS3) \
126	$(MAPFILE.NES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%)
127
128LDFLAGS =	$(LDFLAGS.cmd)
129
130LINTFLAGS=	-axsm
131LINTFLAGS64=	-axsm -m64
132LINTOUT=	lint.out
133
134KRB5PROG=	$(PROG:%=$(KRB5BIN)/%)
135KRB5SBINPROG=	$(PROG:%=$(KRB5SBIN)/%)
136KRB5LIBPROG=	$(PROG:%=$(KRB5LIB)/%)
137
138ROOTPROG=	$(PROG:%=$(ROOTBIN)/%)
139ROOTCMD=	$(PROG:%=$(ROOTCMDDIR)/%)
140ROOTSHFILES=	$(SHFILES:%=$(ROOTBIN)/%)
141ROOTLIBPROG=	$(PROG:%=$(ROOTLIB)/%)
142ROOTLIBSHFILES= $(SHFILES:%=$(ROOTLIB)/%)
143ROOTSHLIBPROG=	$(PROG:%=$(ROOTSHLIB)/%)
144ROOTSBINPROG=	$(PROG:%=$(ROOTSBIN)/%)
145ROOTPKGBINPROG= $(PROG:%=$(ROOTPKGBIN)/%)
146ROOTCLASS_SCR_FILES= $(SCRIPTS:%=$(ROOTCLASS_SCR_DIR)/%)
147ROOTUSRSBINPROG=$(PROG:%=$(ROOTUSRSBIN)/%)
148ROOTUSRSBINSCRIPT=$(SCRIPT:%=$(ROOTUSRSBIN)/%)
149ROOTETCPROG=	$(PROG:%=$(ROOTETC)/%)
150ROOTHASBINPROG= $(PROG:%=$(ROOTHASBIN)/%)
151ROOTHASLIBPROG= $(PROG:%=$(ROOTHASLIB)/%)
152ROOTCCSBINPROG=	$(PROG:%=$(ROOTCCSBIN)/%)
153ROOTCCSBINPROG64=	  $(PROG:%=$(ROOTCCSBIN64)/%)
154ROOTCCSBINLINK=$(PROG:%=  $(ROOTCCSBINLINKDIR)/%)
155ROOTCCSBINLINK64=$(PROG:%=$(ROOTCCSBINLINKDIR64)/%)
156ROOTUSRKVMPROG=	$(PROG:%=$(ROOTUSRKVM)/%)
157ROOTXPG4PROG=	$(XPG4PROG:%=$(ROOTXPG4BIN)/%)
158ROOTXPG4PROG32=	$(XPG4PROG:%=$(ROOTXPG4BIN32)/%)
159ROOTXPG4PROG64=	$(XPG4PROG:%=$(ROOTXPG4BIN64)/%)
160ROOTXPG6PROG=	$(XPG6PROG:%=$(ROOTXPG6BIN)/%)
161ROOTLOCALEPROG=	$(PROG:%=$(ROOTLOCALEDEF)/%)
162ROOTPROG64=	$(PROG:%=$(ROOTBIN64)/%)
163ROOTPROG32=	$(PROG:%=$(ROOTBIN32)/%)
164ROOTCMD64=	$(PROG:%=$(ROOTCMDDIR64)/%)
165ROOTUSRSBINPROG32=	$(PROG:%=$(ROOTUSRSBIN32)/%)
166ROOTUSRSBINPROG64=	$(PROG:%=$(ROOTUSRSBIN64)/%)
167ROOTMAN1FILES=	$(MAN1FILES:%=$(ROOTMAN1)/%)
168$(ROOTMAN1FILES) := FILEMODE= 444
169ROOTMAN1MFILES=	$(MAN1MFILES:%=$(ROOTMAN1M)/%)
170$(ROOTMAN1MFILES) := FILEMODE= 444
171ROOTMAN3FILES=	$(MAN3FILES:%=$(ROOTMAN3)/%)
172$(ROOTMAN3FILES) := FILEMODE= 444
173
174# Symlink rules for /usr/ccs/bin commands. Note, those commands under
175# the rule of the linker area, are controlled by a different set of
176# rules defined in $(SRC)/cmd/sgs/Makefile.var.
177
178INS.ccsbinlink= \
179	$(RM) $(ROOTCCSBINPROG); \
180	$(SYMLINK) ../../bin/$(PROG) $(ROOTCCSBINPROG)
181
182INS.ccsbinlink64= \
183	$(RM) $(ROOTCCSBINPROG64); \
184	$(SYMLINK) ../../../bin/$(MACH64)/$(PROG) $(ROOTCCSBINPROG64)
185
186ROOTETCDEFAULT=	$(ROOTETC)/default
187ROOTETCDEFAULTFILES=	$(DEFAULTFILES:%.dfl=$(ROOTETCDEFAULT)/%)
188$(ROOTETCDEFAULTFILES) :=	FILEMODE = 0644
189
190ROOTETCSECFILES=	$(ETCSECFILES:%=$(ROOTETCSECURITY)/%)
191$(ROOTETCSECFILES) :=	FILEMODE = 0644
192
193ROOTETCTSOLFILES=	$(ETCTSOLFILES:%=$(ROOTETCTSOL)/%)
194$(ROOTETCTSOLFILES) :=	FILEMODE = 0644
195
196ROOTETCSECLIBFILES=	$(ETCSECLIBFILES:%=$(ROOTETCSECLIB)/%)
197
198ROOTETCZONESFILES=	$(ETCZONESFILES:%=$(ROOTETCZONES)/%)
199$(ROOTETCZONESFILES) :=	FILEMODE = 0444
200
201ROOTLIBZONESFILES=	$(LIBZONESFILES:%=$(ROOTLIBZONES)/%)
202$(ROOTLIBZONESFILES) :=	FILEMODE = 0555
203
204ROOTADMIN_SRC_FILE= $(ADMINFILE:%=$(ROOTADMIN_SRC_DIR)/%)
205$(ROOTADMIN_SRC_FILE) := FILEMODE = 0444
206
207#
208# Directories for smf(5) service manifests and profiles.
209#
210ROOTSVC=			$(ROOT)/lib/svc
211ROOTETCSVC=			$(ROOT)/etc/svc
212
213ROOTSVCMANIFEST=		$(ROOTSVC)/manifest
214ROOTSVCPROFILE=			$(ROOTETCSVC)/profile
215
216ROOTSVCMILESTONE=		$(ROOTSVCMANIFEST)/milestone
217ROOTSVCDEVICE=			$(ROOTSVCMANIFEST)/device
218ROOTSVCSYSTEM=			$(ROOTSVCMANIFEST)/system
219ROOTSVCSYSTEMDEVICE=		$(ROOTSVCSYSTEM)/device
220ROOTSVCSYSTEMFILESYSTEM=	$(ROOTSVCSYSTEM)/filesystem
221ROOTSVCSYSTEMSECURITY=		$(ROOTSVCSYSTEM)/security
222ROOTSVCNETWORK=			$(ROOTSVCMANIFEST)/network
223ROOTSVCNETWORKDNS=		$(ROOTSVCNETWORK)/dns
224ROOTSVCNETWORKISCSI=		$(ROOTSVCNETWORK)/iscsi
225ROOTSVCNETWORKLDAP=		$(ROOTSVCNETWORK)/ldap
226ROOTSVCNETWORKNFS=		$(ROOTSVCNETWORK)/nfs
227ROOTSVCNETWORKNIS=		$(ROOTSVCNETWORK)/nis
228ROOTSVCNETWORKROUTING=		$(ROOTSVCNETWORK)/routing
229ROOTSVCNETWORKRPC=		$(ROOTSVCNETWORK)/rpc
230ROOTSVCNETWORKSMB=		$(ROOTSVCNETWORK)/smb
231ROOTSVCNETWORKSECURITY=		$(ROOTSVCNETWORK)/security
232ROOTSVCNETWORKSSL=		$(ROOTSVCNETWORK)/ssl
233ROOTSVCNETWORKIPSEC=		$(ROOTSVCNETWORK)/ipsec
234ROOTSVCNETWORKSHARES=		$(ROOTSVCNETWORK)/shares
235ROOTSVCSMB=			$(ROOTSVCNETWORK)/smb
236ROOTSVCPLATFORM=		$(ROOTSVCMANIFEST)/platform
237ROOTSVCPLATFORMSUN4U=		$(ROOTSVCPLATFORM)/sun4u
238ROOTSVCPLATFORMSUN4V=		$(ROOTSVCPLATFORM)/sun4v
239ROOTSVCAPPLICATION=		$(ROOTSVCMANIFEST)/application
240ROOTSVCAPPLICATIONMANAGEMENT=	$(ROOTSVCAPPLICATION)/management
241ROOTSVCAPPLICATIONSECURITY=	$(ROOTSVCAPPLICATION)/security
242ROOTSVCAPPLICATIONPRINT=	$(ROOTSVCAPPLICATION)/print
243
244#
245# Commands Makefiles delivering a manifest are expected to define MANIFEST.
246#
247# Like ROOTCMDDIR, any lower-level Makefiles that put their manifests in a
248# subdirectory of the manifest directories listed above should reset
249# ROOTMANIFESTDIR and use it in their `install' target. By default we set this
250# to a bogus value so that it will not conflict with any of the other values
251# already  defined in this Makefile.
252#
253# The manifest validation of the $SRC/cmd check target is also derived from a
254# valid MANIFEST setting.
255#
256ROOTMANIFESTDIR=	$(ROOTSVCMANIFEST)/__nonexistent_directory__
257ROOTMANIFEST=		$(MANIFEST:%=$(ROOTMANIFESTDIR)/%)
258CHKMANIFEST=		$(MANIFEST:%.xml=%.xmlchk)
259
260# Manifests cannot be checked in parallel, because we are using the global
261# repository that is in $(SRC)/cmd/svc/seed/global.db.  This is a
262# repository that is built from the manifests in this workspace, whereas
263# the build machine's repository may be out of sync with these manifests.
264# Because we are using a private repository, svccfg-native must start up a
265# private copy of configd-native.  We cannot have multiple copies of
266# configd-native trying to access global.db simultaneously.
267
268.NO_PARALLEL:	$(CHKMANIFEST)
269
270#
271# For installing "starter scripts" of services
272#
273
274ROOTSVCMETHOD=		$(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
275
276ROOTSVCBINDIR=		$(ROOTLIBSVCBIN)/__nonexistent_directory__
277ROOTSVCBIN= 		$(SVCBIN:%=$(ROOTSVCBINDIR)/%)
278
279#
280
281# For programs that are installed in the root filesystem,
282# build $(ROOTFS_PROG) rather than $(PROG)
283$(ROOTFS_PROG) := LDFLAGS += -Wl,-I/lib/ld.so.1
284
285$(KRB5BIN)/%: %
286	$(INS.file)
287
288$(KRB5SBIN)/%: %
289	$(INS.file)
290
291$(KRB5LIB)/%: %
292	$(INS.file)
293
294$(ROOTBIN)/%: %
295	$(INS.file)
296
297$(ROOTLIB)/%: %
298	$(INS.file)
299
300$(ROOTBIN64)/%: %
301	$(INS.file)
302
303$(ROOTLIB64)/%: %
304	$(INS.file)
305
306$(ROOTBIN32)/%: %
307	$(INS.file)
308
309$(ROOTSHLIB)/%: %
310	$(INS.file)
311
312$(ROOTPKGBIN)/%: %
313	$(INS.file)
314
315$(ROOTCLASS_SCR_DIR)/%: %
316	$(INS.file)
317
318$(ROOTADMIN_SRC_DIR)/%: %
319	$(INS.file)
320
321$(ROOTSBIN)/%: %
322	$(INS.file)
323
324$(ROOTUSRSBIN)/%: %
325	$(INS.file)
326
327$(ROOTUSRSBIN32)/%: %
328	$(INS.file)
329
330$(ROOTUSRSBIN64)/%: %
331	$(INS.file)
332
333$(ROOTETC)/%: %
334	$(INS.file)
335
336$(ROOTETCFTPD)/%: %
337	$(INS.file)
338
339$(ROOTETCINET)/%: %
340	$(INS.file)
341
342$(ROOTETCDEFAULT)/%:	%.dfl
343	$(INS.rename)
344
345$(ROOTETCTSOL)/%: %
346	$(INS.file)
347
348$(ROOTETCSECLIB)/%: %
349	$(INS.file)
350
351$(ROOTETCZONES)/%: %
352	$(INS.file)
353
354$(ROOTLIBZONES)/%: %
355	$(INS.file)
356
357$(ROOTLIBXEN)/%: %
358	$(INS.file)
359
360$(ROOTHASBIN)/%: %
361	$(INS.file)
362
363$(ROOTHASLIB)/%: %
364	$(INS.file)
365
366$(ROOTUSRKVM)/%: %
367	$(INS.file)
368
369$(ROOTXPG4BIN)/%: %.xpg4
370	$(INS.rename)
371
372$(ROOTXPG4BIN32)/%: %.xpg4
373	$(INS.rename)
374
375$(ROOTXPG4BIN64)/%: %.xpg4
376	$(INS.rename)
377
378$(ROOTXPG6BIN)/%: %.xpg6
379	$(INS.rename)
380
381$(ROOTLOCALEDEF)/%: %
382	$(INS.file)
383
384$(ROOTCHARMAP)/%: %
385	$(INS.file)
386
387$(ROOTI18NEXT)/%: %
388	$(INS.file)
389
390$(ROOTI18NEXT64)/%: %
391	$(INS.file)
392
393$(ROOTLIBSVCMETHOD)/%: %
394	$(INS.file)
395
396$(ROOTLIBSVCBIN)/%: %
397	$(INS.file)
398
399$(ROOTSVCMILESTONE)/%: %
400	$(INS.file)
401
402$(ROOTSVCDEVICE)/%: %
403	$(INS.file)
404
405$(ROOTSVCSYSTEM)/%: %
406	$(INS.file)
407
408$(ROOTSVCSYSTEMDEVICE)/%: %
409	$(INS.file)
410
411$(ROOTSVCSYSTEMFILESYSTEM)/%: %
412	$(INS.file)
413
414$(ROOTSVCSYSTEMSECURITY)/%: %
415	$(INS.file)
416
417$(ROOTSVCNETWORK)/%: %
418	$(INS.file)
419
420$(ROOTSVCNETWORKLDAP)/%: %
421	$(INS.file)
422
423$(ROOTSVCNETWORKNFS)/%: %
424	$(INS.file)
425
426$(ROOTSVCNETWORKNIS)/%: %
427	$(INS.file)
428
429$(ROOTSVCNETWORKRPC)/%: %
430	$(INS.file)
431
432$(ROOTSVCNETWORKSECURITY)/%: %
433	$(INS.file)
434
435$(ROOTSVCNETWORKSSL)/%: %
436	$(INS.file)
437
438$(ROOTSVCNETWORKIPSEC)/%: %
439	$(INS.file)
440
441$(ROOTSVCNETWORKSHARES)/%: %
442	$(INS.file)
443
444$(ROOTSVCNETWORKSMB)/%: %
445	$(INS.file)
446
447$(ROOTSVCAPPLICATION)/%: %
448	$(INS.file)
449
450$(ROOTSVCAPPLICATIONMANAGEMENT)/%: %
451	$(INS.file)
452
453$(ROOTSVCAPPLICATIONSECURITY)/%: %
454	$(INS.file)
455
456$(ROOTSVCAPPLICATIONPRINT)/%: %
457	$(INS.file)
458
459$(ROOTSVCPLATFORM)/%: %
460	$(INS.file)
461
462$(ROOTSVCPLATFORMSUN4U)/%: %
463	$(INS.file)
464
465$(ROOTSVCPLATFORMSUN4V)/%: %
466	$(INS.file)
467
468# Install rule for gprof, yacc, and lex dependency files
469$(ROOTSHLIBCCS)/%: ../common/%
470	$(INS.file)
471
472$(ROOTCCSBINLINKDIR)/%: %
473	$(INS.ccsbinlink)
474
475$(ROOTCCSBINLINKDIR64)/%: %
476	$(INS.ccsbinlink64)
477
478$(ROOTMAN1)/%: %.sunman
479	$(INS.rename)
480
481$(ROOTMAN1M)/%: %.sunman
482	$(INS.rename)
483
484$(ROOTMAN3)/%: %.sunman
485	$(INS.rename)
486
487$(ROOTVARSMB)/%: %
488	$(INS.file)
489
490# build rule for statically linked programs with single source file.
491%.static: %.c
492	$(LINK.c) -o $@ $< $(LDLIBS)
493	$(POST_PROCESS)
494
495%.xpg4: %.c
496	$(LINK.c) -o $@ $< $(LDLIBS)
497	$(POST_PROCESS)
498
499%.xpg6: %.c
500	$(LINK.c) -o $@ $< $(LDLIBS)
501	$(POST_PROCESS)
502
503# Define the majority text domain in this directory.
504TEXT_DOMAIN= SUNW_OST_OSCMD
505
506CLOBBERFILES += $(XPG4) $(XPG6) $(DCFILE)
507
508# This flag is for programs which should not build a 32-bit binary
509sparc_64ONLY= $(POUND_SIGN)
51064ONLY=	 $($(MACH)_64ONLY)
511