Merge branch 'less_closed'
[unleashed.git] / usr / src / cmd / Makefile.cmd
blob9a29be551cbaa07711b1e5c6fb51e3dc68c030ed
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
22 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25 # Definitions common to command source.
27 # include global definitions; SRC should be defined in the shell.
28 # SRC is needed until RFE 1026993 is implemented.
30 include $(SRC)/Makefile.master
32 LN= ln
33 SH= sh
34 ECHO= echo
35 MKDIR= mkdir
36 TOUCH= touch
38 FILEMODE= 0555
39 LIBFILEMODE= 0444
40 XPG4= $(XPG4PROG:%=%.xpg4)
41 XPG6= $(XPG6PROG:%=%.xpg6)
43 KRB5DIR= $(ROOT)/usr
44 KRB5BIN= $(KRB5DIR)/bin
45 KRB5SBIN= $(KRB5DIR)/sbin
46 KRB5LIB= $(KRB5DIR)/lib/krb5
47 KRB5RUNPATH= /usr/lib/krb5
48 GSSRUNPATH= /usr/lib/gss
51 ROOTBIN= $(ROOT)/usr/bin
52 ROOTLIB= $(ROOT)/usr/lib
53 ROOTLIBSVCBIN= $(ROOT)/lib/svc/bin
54 ROOTLIBSVCMETHOD= $(ROOT)/lib/svc/method
55 ROOTLIBXEN= $(ROOT)/usr/lib/xen/bin
56 ROOTLIBZONES= $(ROOT)/lib/zones
58 ROOTSHLIB= $(ROOT)/usr/share/lib
59 ROOTPKGBIN= $(ROOT)/usr/sadm/install/bin
60 ROOTCLASS_SCR_DIR= $(ROOT)/usr/sadm/install/scripts
61 ROOTADMIN_SRC_DIR= $(ROOT)/var/sadm/install/admin
63 ROOTSHLIBCCS= $(ROOTSHLIB)/ccs
64 ROOTSBIN= $(ROOT)/sbin
65 ROOTUSRSBIN= $(ROOT)/usr/sbin
66 ROOTETC= $(ROOT)/etc
68 ROOTETCSECURITY= $(ROOTETC)/security
69 ROOTETCTSOL= $(ROOTETCSECURITY)/tsol
70 ROOTETCSECLIB= $(ROOTETCSECURITY)/lib
71 ROOTETCZONES= $(ROOTETC)/zones
73 ROOTETCFTPD= $(ROOT)/etc/ftpd
74 ROOTETCINET= $(ROOT)/etc/inet
75 ROOTCCSBIN= $(ROOT)/usr/ccs/bin
76 ROOTCCSBIN64= $(ROOTCCSBIN)/$(MACH64)
77 ROOTCCSBINLINKDIR= $(ROOT)/../../bin
78 ROOTCCSBINLINKDIR64= $(ROOT)../../../bin/$(MACH)
79 ROOTCCSLIB= $(ROOT)/usr/ccs/lib
80 ROOTXPG4= $(ROOT)/usr/xpg4
81 ROOTXPG4BIN= $(ROOT)/usr/xpg4/bin
82 ROOTXPG4BIN32= $(ROOTXPG4BIN)/$(MACH32)
83 ROOTXPG4BIN64= $(ROOTXPG4BIN)/$(MACH64)
84 ROOTXPG6= $(ROOT)/usr/xpg6
85 ROOTXPG6BIN= $(ROOT)/usr/xpg6/bin
86 ROOTBIN32= $(ROOTBIN)/$(MACH32)
87 ROOTBIN64= $(ROOTBIN)/$(MACH64)
88 ROOTCMDDIR64= $(ROOTCMDDIR)/$(MACH64)
89 ROOTLIB64= $(ROOTLIB)/$(MACH64)
90 ROOTUSRSBIN32= $(ROOTUSRSBIN)/$(MACH32)
91 ROOTUSRSBIN64= $(ROOTUSRSBIN)/$(MACH64)
92 ROOTMAN= $(ROOT)/usr/share/man
93 ROOTMAN1= $(ROOTMAN)/man1
94 ROOTMAN1M= $(ROOTMAN)/man1m
95 ROOTMAN3= $(ROOTMAN)/man3
96 ROOTVARSMB= $(ROOT)/var/smb
100 # Like ROOTLIBDIR in $(SRC)/Makefile.lib, any lower-level Makefiles that
101 # put their binaries in a non-standard location should reset this and use
102 # $(ROOTCMD) in their `install' target. By default we set this to a bogus
103 # value so that it will not conflict with any of the other values already
104 # defined in this Makefile.
106 ROOTCMDDIR= $(ROOT)/__nonexistent_directory__
108 ROOTSHAUDIO= $(ROOT)/usr/share/audio
109 ROOTAUDIOSAMP= $(ROOTSHAUDIO)/samples
110 ROOTAUDIOSAMPAU=$(ROOTAUDIOSAMP)/au
112 ISAEXEC= $(ROOT)/usr/lib/isaexec
113 PLATEXEC= $(ROOT)/usr/lib/platexec
115 LDLIBS = $(LDLIBS.cmd)
117 LDFLAGS.cmd = \
118 $(BDIRECT) $(ENVLDFLAGS1) $(ENVLDFLAGS2) $(ENVLDFLAGS3) \
119 $(MAPFILE.NES:%=-Wl,-M%) $(MAPFILE.PGA:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%)
121 LDFLAGS = $(LDFLAGS.cmd)
124 KRB5PROG= $(PROG:%=$(KRB5BIN)/%)
125 KRB5SBINPROG= $(PROG:%=$(KRB5SBIN)/%)
126 KRB5LIBPROG= $(PROG:%=$(KRB5LIB)/%)
128 ROOTPROG= $(PROG:%=$(ROOTBIN)/%)
129 ROOTCMD= $(PROG:%=$(ROOTCMDDIR)/%)
130 ROOTSHFILES= $(SHFILES:%=$(ROOTBIN)/%)
131 ROOTLIBPROG= $(PROG:%=$(ROOTLIB)/%)
132 ROOTLIBSHFILES= $(SHFILES:%=$(ROOTLIB)/%)
133 ROOTSHLIBPROG= $(PROG:%=$(ROOTSHLIB)/%)
134 ROOTSBINPROG= $(PROG:%=$(ROOTSBIN)/%)
135 ROOTPKGBINPROG= $(PROG:%=$(ROOTPKGBIN)/%)
136 ROOTCLASS_SCR_FILES= $(SCRIPTS:%=$(ROOTCLASS_SCR_DIR)/%)
137 ROOTUSRSBINPROG=$(PROG:%=$(ROOTUSRSBIN)/%)
138 ROOTUSRSBINSCRIPT=$(SCRIPT:%=$(ROOTUSRSBIN)/%)
139 ROOTETCPROG= $(PROG:%=$(ROOTETC)/%)
140 ROOTCCSBINPROG= $(PROG:%=$(ROOTCCSBIN)/%)
141 ROOTCCSBINPROG64= $(PROG:%=$(ROOTCCSBIN64)/%)
142 ROOTCCSBINLINK=$(PROG:%= $(ROOTCCSBINLINKDIR)/%)
143 ROOTCCSBINLINK64=$(PROG:%=$(ROOTCCSBINLINKDIR64)/%)
144 ROOTXPG4PROG= $(XPG4PROG:%=$(ROOTXPG4BIN)/%)
145 ROOTXPG4PROG32= $(XPG4PROG:%=$(ROOTXPG4BIN32)/%)
146 ROOTXPG4PROG64= $(XPG4PROG:%=$(ROOTXPG4BIN64)/%)
147 ROOTXPG6PROG= $(XPG6PROG:%=$(ROOTXPG6BIN)/%)
148 ROOTLOCALEPROG= $(PROG:%=$(ROOTLOCALEDEF)/%)
149 ROOTPROG64= $(PROG:%=$(ROOTBIN64)/%)
150 ROOTPROG32= $(PROG:%=$(ROOTBIN32)/%)
151 ROOTCMD64= $(PROG:%=$(ROOTCMDDIR64)/%)
152 ROOTUSRSBINPROG32= $(PROG:%=$(ROOTUSRSBIN32)/%)
153 ROOTUSRSBINPROG64= $(PROG:%=$(ROOTUSRSBIN64)/%)
154 ROOTMAN1FILES= $(MAN1FILES:%=$(ROOTMAN1)/%)
155 $(ROOTMAN1FILES) := FILEMODE= 444
156 ROOTMAN1MFILES= $(MAN1MFILES:%=$(ROOTMAN1M)/%)
157 $(ROOTMAN1MFILES) := FILEMODE= 444
158 ROOTMAN3FILES= $(MAN3FILES:%=$(ROOTMAN3)/%)
159 $(ROOTMAN3FILES) := FILEMODE= 444
161 # Symlink rules for /usr/ccs/bin commands. Note, those commands under
162 # the rule of the linker area, are controlled by a different set of
163 # rules defined in $(SRC)/cmd/sgs/Makefile.var.
165 INS.ccsbinlink= \
166 $(RM) $(ROOTCCSBINPROG); \
167 $(SYMLINK) ../../bin/$(PROG) $(ROOTCCSBINPROG)
169 INS.ccsbinlink64= \
170 $(RM) $(ROOTCCSBINPROG64); \
171 $(SYMLINK) ../../../bin/$(MACH64)/$(PROG) $(ROOTCCSBINPROG64)
173 ROOTETCDEFAULT= $(ROOTETC)/default
174 ROOTETCDEFAULTFILES= $(DEFAULTFILES:%.dfl=$(ROOTETCDEFAULT)/%)
175 $(ROOTETCDEFAULTFILES) := FILEMODE = 0644
177 ROOTETCSECFILES= $(ETCSECFILES:%=$(ROOTETCSECURITY)/%)
178 $(ROOTETCSECFILES) := FILEMODE = 0644
180 ROOTETCTSOLFILES= $(ETCTSOLFILES:%=$(ROOTETCTSOL)/%)
181 $(ROOTETCTSOLFILES) := FILEMODE = 0644
183 ROOTETCSECLIBFILES= $(ETCSECLIBFILES:%=$(ROOTETCSECLIB)/%)
185 ROOTETCZONESFILES= $(ETCZONESFILES:%=$(ROOTETCZONES)/%)
186 $(ROOTETCZONESFILES) := FILEMODE = 0444
188 ROOTLIBZONESFILES= $(LIBZONESFILES:%=$(ROOTLIBZONES)/%)
189 $(ROOTLIBZONESFILES) := FILEMODE = 0555
191 ROOTADMIN_SRC_FILE= $(ADMINFILE:%=$(ROOTADMIN_SRC_DIR)/%)
192 $(ROOTADMIN_SRC_FILE) := FILEMODE = 0444
195 # Directories for smf(5) service manifests and profiles.
197 ROOTSVC= $(ROOT)/lib/svc
198 ROOTETCSVC= $(ROOT)/etc/svc
200 ROOTSVCMANIFEST= $(ROOTSVC)/manifest
201 ROOTSVCPROFILE= $(ROOTETCSVC)/profile
203 ROOTSVCMILESTONE= $(ROOTSVCMANIFEST)/milestone
204 ROOTSVCDEVICE= $(ROOTSVCMANIFEST)/device
205 ROOTSVCSYSTEM= $(ROOTSVCMANIFEST)/system
206 ROOTSVCSYSTEMDEVICE= $(ROOTSVCSYSTEM)/device
207 ROOTSVCSYSTEMFILESYSTEM= $(ROOTSVCSYSTEM)/filesystem
208 ROOTSVCSYSTEMSECURITY= $(ROOTSVCSYSTEM)/security
209 ROOTSVCNETWORK= $(ROOTSVCMANIFEST)/network
210 ROOTSVCNETWORKDNS= $(ROOTSVCNETWORK)/dns
211 ROOTSVCNETWORKISCSI= $(ROOTSVCNETWORK)/iscsi
212 ROOTSVCNETWORKLDAP= $(ROOTSVCNETWORK)/ldap
213 ROOTSVCNETWORKNFS= $(ROOTSVCNETWORK)/nfs
214 ROOTSVCNETWORKNIS= $(ROOTSVCNETWORK)/nis
215 ROOTSVCNETWORKROUTING= $(ROOTSVCNETWORK)/routing
216 ROOTSVCNETWORKRPC= $(ROOTSVCNETWORK)/rpc
217 ROOTSVCNETWORKSMB= $(ROOTSVCNETWORK)/smb
218 ROOTSVCNETWORKSECURITY= $(ROOTSVCNETWORK)/security
219 ROOTSVCNETWORKIPSEC= $(ROOTSVCNETWORK)/ipsec
220 ROOTSVCNETWORKSHARES= $(ROOTSVCNETWORK)/shares
221 ROOTSVCSMB= $(ROOTSVCNETWORK)/smb
222 ROOTSVCPLATFORM= $(ROOTSVCMANIFEST)/platform
223 ROOTSVCPLATFORMSUN4U= $(ROOTSVCPLATFORM)/sun4u
224 ROOTSVCPLATFORMSUN4V= $(ROOTSVCPLATFORM)/sun4v
225 ROOTSVCAPPLICATION= $(ROOTSVCMANIFEST)/application
226 ROOTSVCAPPLICATIONMANAGEMENT= $(ROOTSVCAPPLICATION)/management
227 ROOTSVCAPPLICATIONSECURITY= $(ROOTSVCAPPLICATION)/security
228 ROOTSVCAPPLICATIONPRINT= $(ROOTSVCAPPLICATION)/print
231 # Commands Makefiles delivering a manifest are expected to define MANIFEST.
233 # Like ROOTCMDDIR, any lower-level Makefiles that put their manifests in a
234 # subdirectory of the manifest directories listed above should reset
235 # ROOTMANIFESTDIR and use it in their `install' target. By default we set this
236 # to a bogus value so that it will not conflict with any of the other values
237 # already defined in this Makefile.
239 # The manifest validation of the $SRC/cmd check target is also derived from a
240 # valid MANIFEST setting.
242 ROOTMANIFESTDIR= $(ROOTSVCMANIFEST)/__nonexistent_directory__
243 ROOTMANIFEST= $(MANIFEST:%=$(ROOTMANIFESTDIR)/%)
244 CHKMANIFEST= $(MANIFEST:%.xml=%.xmlchk)
246 # Manifests cannot be checked in parallel, because we are using the global
247 # repository that is in $(SRC)/cmd/svc/seed/global.db. This is a
248 # repository that is built from the manifests in this workspace, whereas
249 # the build machine's repository may be out of sync with these manifests.
250 # Because we are using a private repository, svccfg-native must start up a
251 # private copy of configd-native. We cannot have multiple copies of
252 # configd-native trying to access global.db simultaneously.
254 .NO_PARALLEL: $(CHKMANIFEST)
257 # For installing "starter scripts" of services
260 ROOTSVCMETHOD= $(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
262 ROOTSVCBINDIR= $(ROOTLIBSVCBIN)/__nonexistent_directory__
263 ROOTSVCBIN= $(SVCBIN:%=$(ROOTSVCBINDIR)/%)
267 # For programs that are installed in the root filesystem,
268 # build $(ROOTFS_PROG) rather than $(PROG)
269 $(ROOTFS_PROG) := LDFLAGS += -Wl,-I/lib/ld.so.1
271 $(KRB5BIN)/%: %
272 $(INS.file)
274 $(KRB5SBIN)/%: %
275 $(INS.file)
277 $(KRB5LIB)/%: %
278 $(INS.file)
280 $(ROOTBIN)/%: %
281 $(INS.file)
283 $(ROOTLIB)/%: %
284 $(INS.file)
286 $(ROOTBIN64)/%: %
287 $(INS.file)
289 $(ROOTLIB64)/%: %
290 $(INS.file)
292 $(ROOTBIN32)/%: %
293 $(INS.file)
295 $(ROOTSHLIB)/%: %
296 $(INS.file)
298 $(ROOTPKGBIN)/%: %
299 $(INS.file)
301 $(ROOTCLASS_SCR_DIR)/%: %
302 $(INS.file)
304 $(ROOTADMIN_SRC_DIR)/%: %
305 $(INS.file)
307 $(ROOTSBIN)/%: %
308 $(INS.file)
310 $(ROOTUSRSBIN)/%: %
311 $(INS.file)
313 $(ROOTUSRSBIN32)/%: %
314 $(INS.file)
316 $(ROOTUSRSBIN64)/%: %
317 $(INS.file)
319 $(ROOTETC)/%: %
320 $(INS.file)
322 $(ROOTETCFTPD)/%: %
323 $(INS.file)
325 $(ROOTETCINET)/%: %
326 $(INS.file)
328 $(ROOTETCDEFAULT)/%: %.dfl
329 $(INS.rename)
331 $(ROOTETCTSOL)/%: %
332 $(INS.file)
334 $(ROOTETCSECLIB)/%: %
335 $(INS.file)
337 $(ROOTETCZONES)/%: %
338 $(INS.file)
340 $(ROOTLIBZONES)/%: %
341 $(INS.file)
343 $(ROOTLIBXEN)/%: %
344 $(INS.file)
346 $(ROOTXPG4BIN)/%: %.xpg4
347 $(INS.rename)
349 $(ROOTXPG4BIN32)/%: %.xpg4
350 $(INS.rename)
352 $(ROOTXPG4BIN64)/%: %.xpg4
353 $(INS.rename)
355 $(ROOTXPG6BIN)/%: %.xpg6
356 $(INS.rename)
358 $(ROOTLOCALEDEF)/%: %
359 $(INS.file)
361 $(ROOTCHARMAP)/%: %
362 $(INS.file)
364 $(ROOTI18NEXT)/%: %
365 $(INS.file)
367 $(ROOTI18NEXT64)/%: %
368 $(INS.file)
370 $(ROOTLIBSVCMETHOD)/%: %
371 $(INS.file)
373 $(ROOTLIBSVCBIN)/%: %
374 $(INS.file)
376 $(ROOTSVCMILESTONE)/%: %
377 $(INS.file)
379 $(ROOTSVCDEVICE)/%: %
380 $(INS.file)
382 $(ROOTSVCSYSTEM)/%: %
383 $(INS.file)
385 $(ROOTSVCSYSTEMDEVICE)/%: %
386 $(INS.file)
388 $(ROOTSVCSYSTEMFILESYSTEM)/%: %
389 $(INS.file)
391 $(ROOTSVCSYSTEMSECURITY)/%: %
392 $(INS.file)
394 $(ROOTSVCNETWORK)/%: %
395 $(INS.file)
397 $(ROOTSVCNETWORKLDAP)/%: %
398 $(INS.file)
400 $(ROOTSVCNETWORKNFS)/%: %
401 $(INS.file)
403 $(ROOTSVCNETWORKNIS)/%: %
404 $(INS.file)
406 $(ROOTSVCNETWORKRPC)/%: %
407 $(INS.file)
409 $(ROOTSVCNETWORKSECURITY)/%: %
410 $(INS.file)
412 $(ROOTSVCNETWORKIPSEC)/%: %
413 $(INS.file)
415 $(ROOTSVCNETWORKSHARES)/%: %
416 $(INS.file)
418 $(ROOTSVCNETWORKSMB)/%: %
419 $(INS.file)
421 $(ROOTSVCAPPLICATION)/%: %
422 $(INS.file)
424 $(ROOTSVCAPPLICATIONMANAGEMENT)/%: %
425 $(INS.file)
427 $(ROOTSVCAPPLICATIONSECURITY)/%: %
428 $(INS.file)
430 $(ROOTSVCAPPLICATIONPRINT)/%: %
431 $(INS.file)
433 $(ROOTSVCPLATFORM)/%: %
434 $(INS.file)
436 $(ROOTSVCPLATFORMSUN4U)/%: %
437 $(INS.file)
439 $(ROOTSVCPLATFORMSUN4V)/%: %
440 $(INS.file)
442 # Install rule for gprof, yacc, and lex dependency files
443 $(ROOTSHLIBCCS)/%: ../common/%
444 $(INS.file)
446 $(ROOTCCSBINLINKDIR)/%: %
447 $(INS.ccsbinlink)
449 $(ROOTCCSBINLINKDIR64)/%: %
450 $(INS.ccsbinlink64)
452 $(ROOTVARSMB)/%: %
453 $(INS.file)
455 # build rule for statically linked programs with single source file.
456 %.static: %.c
457 $(LINK.c) -o $@ $< $(LDLIBS)
458 $(POST_PROCESS)
460 %.xpg4: %.c
461 $(LINK.c) -o $@ $< $(LDLIBS)
462 $(POST_PROCESS)
464 %.xpg6: %.c
465 $(LINK.c) -o $@ $< $(LDLIBS)
466 $(POST_PROCESS)
468 # Define the majority text domain in this directory.
469 TEXT_DOMAIN= SUNW_OST_OSCMD
471 CLOBBERFILES += $(XPG4) $(XPG6) $(DCFILE)
473 # This flag is for programs which should not build a 32-bit binary
474 sparc_64ONLY= $(POUND_SIGN)
475 64ONLY= $($(MACH)_64ONLY)