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