Merge branch 'cleanups'
[unleashed.git] / usr / src / cmd / Makefile.cmd
blobc9b8e547bf712c8301f8e5d81426924f32a8675a
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
41 KRB5DIR= $(ROOT)/usr
42 KRB5BIN= $(KRB5DIR)/bin
43 KRB5SBIN= $(KRB5DIR)/sbin
44 KRB5LIB= $(KRB5DIR)/lib/krb5
45 KRB5RUNPATH= /usr/lib/krb5
46 GSSRUNPATH= /usr/lib/gss
49 ROOTBIN= $(ROOT)/usr/bin
50 ROOTLIB= $(ROOT)/usr/lib
51 ROOTLIBSVCBIN= $(ROOT)/lib/svc/bin
52 ROOTLIBSVCMETHOD= $(ROOT)/lib/svc/method
53 ROOTLIBZONES= $(ROOT)/lib/zones
55 ROOTSHLIB= $(ROOT)/usr/share/lib
57 ROOTSHLIBCCS= $(ROOTSHLIB)/ccs
58 ROOTSBIN= $(ROOT)/sbin
59 ROOTUSRSBIN= $(ROOT)/usr/sbin
60 ROOTETC= $(ROOT)/etc
62 ROOTETCSECURITY= $(ROOTETC)/security
63 ROOTETCSECLIB= $(ROOTETCSECURITY)/lib
64 ROOTETCZONES= $(ROOTETC)/zones
66 ROOTETCFTPD= $(ROOT)/etc/ftpd
67 ROOTETCINET= $(ROOT)/etc/inet
68 ROOTBIN32= $(ROOTBIN)/$(MACH32)
69 ROOTBIN64= $(ROOTBIN)/$(MACH64)
70 ROOTCMDDIR64= $(ROOTCMDDIR)/$(MACH64)
71 ROOTLIB64= $(ROOTLIB)/$(MACH64)
72 ROOTUSRSBIN32= $(ROOTUSRSBIN)/$(MACH32)
73 ROOTUSRSBIN64= $(ROOTUSRSBIN)/$(MACH64)
74 ROOTVARSMB= $(ROOT)/var/smb
78 # Like ROOTLIBDIR in $(SRC)/Makefile.lib, any lower-level Makefiles that
79 # put their binaries in a non-standard location should reset this and use
80 # $(ROOTCMD) in their `install' target. By default we set this to a bogus
81 # value so that it will not conflict with any of the other values already
82 # defined in this Makefile.
84 ROOTCMDDIR= $(ROOT)/__nonexistent_directory__
86 ISAEXEC= $(ROOT)/usr/lib/isaexec
87 PLATEXEC= $(ROOT)/usr/lib/platexec
89 LDLIBS = $(LDLIBS.cmd)
91 LDFLAGS.cmd = \
92 $(BDIRECT) $(ENVLDFLAGS1) $(ENVLDFLAGS2) $(ENVLDFLAGS3) \
93 $(MAPFILE.PGA:%=-Wl,-M%)
95 LDFLAGS = $(LDFLAGS.cmd)
98 KRB5PROG= $(PROG:%=$(KRB5BIN)/%)
99 KRB5SBINPROG= $(PROG:%=$(KRB5SBIN)/%)
100 KRB5LIBPROG= $(PROG:%=$(KRB5LIB)/%)
102 ROOTPROG= $(PROG:%=$(ROOTBIN)/%)
103 ROOTCMD= $(PROG:%=$(ROOTCMDDIR)/%)
104 ROOTSHFILES= $(SHFILES:%=$(ROOTBIN)/%)
105 ROOTLIBPROG= $(PROG:%=$(ROOTLIB)/%)
106 ROOTLIBSHFILES= $(SHFILES:%=$(ROOTLIB)/%)
107 ROOTSHLIBPROG= $(PROG:%=$(ROOTSHLIB)/%)
108 ROOTSBINPROG= $(PROG:%=$(ROOTSBIN)/%)
109 ROOTUSRSBINPROG=$(PROG:%=$(ROOTUSRSBIN)/%)
110 ROOTUSRSBINSCRIPT=$(SCRIPT:%=$(ROOTUSRSBIN)/%)
111 ROOTLOCALEPROG= $(PROG:%=$(ROOTLOCALEDEF)/%)
112 ROOTPROG64= $(PROG:%=$(ROOTBIN64)/%)
113 ROOTPROG32= $(PROG:%=$(ROOTBIN32)/%)
114 ROOTCMD64= $(PROG:%=$(ROOTCMDDIR64)/%)
115 ROOTUSRSBINPROG32= $(PROG:%=$(ROOTUSRSBIN32)/%)
116 ROOTUSRSBINPROG64= $(PROG:%=$(ROOTUSRSBIN64)/%)
118 ROOTETCDEFAULT= $(ROOTETC)/default
119 ROOTETCDEFAULTFILES= $(DEFAULTFILES:%.dfl=$(ROOTETCDEFAULT)/%)
120 $(ROOTETCDEFAULTFILES) := FILEMODE = 0644
122 ROOTETCSECFILES= $(ETCSECFILES:%=$(ROOTETCSECURITY)/%)
123 $(ROOTETCSECFILES) := FILEMODE = 0644
125 ROOTETCSECLIBFILES= $(ETCSECLIBFILES:%=$(ROOTETCSECLIB)/%)
127 ROOTETCZONESFILES= $(ETCZONESFILES:%=$(ROOTETCZONES)/%)
128 $(ROOTETCZONESFILES) := FILEMODE = 0444
130 ROOTLIBZONESFILES= $(LIBZONESFILES:%=$(ROOTLIBZONES)/%)
131 $(ROOTLIBZONESFILES) := FILEMODE = 0555
134 # Directories for smf(5) service manifests and profiles.
136 ROOTSVC= $(ROOT)/lib/svc
137 ROOTETCSVC= $(ROOT)/etc/svc
139 ROOTSVCMANIFEST= $(ROOTSVC)/manifest
140 ROOTSVCPROFILE= $(ROOTETCSVC)/profile
142 ROOTSVCMILESTONE= $(ROOTSVCMANIFEST)/milestone
143 ROOTSVCDEVICE= $(ROOTSVCMANIFEST)/device
144 ROOTSVCSYSTEM= $(ROOTSVCMANIFEST)/system
145 ROOTSVCSYSTEMDEVICE= $(ROOTSVCSYSTEM)/device
146 ROOTSVCSYSTEMFILESYSTEM= $(ROOTSVCSYSTEM)/filesystem
147 ROOTSVCSYSTEMSECURITY= $(ROOTSVCSYSTEM)/security
148 ROOTSVCNETWORK= $(ROOTSVCMANIFEST)/network
149 ROOTSVCNETWORKDNS= $(ROOTSVCNETWORK)/dns
150 ROOTSVCNETWORKISCSI= $(ROOTSVCNETWORK)/iscsi
151 ROOTSVCNETWORKLDAP= $(ROOTSVCNETWORK)/ldap
152 ROOTSVCNETWORKNFS= $(ROOTSVCNETWORK)/nfs
153 ROOTSVCNETWORKNIS= $(ROOTSVCNETWORK)/nis
154 ROOTSVCNETWORKROUTING= $(ROOTSVCNETWORK)/routing
155 ROOTSVCNETWORKRPC= $(ROOTSVCNETWORK)/rpc
156 ROOTSVCNETWORKSMB= $(ROOTSVCNETWORK)/smb
157 ROOTSVCNETWORKSECURITY= $(ROOTSVCNETWORK)/security
158 ROOTSVCNETWORKIPSEC= $(ROOTSVCNETWORK)/ipsec
159 ROOTSVCNETWORKSHARES= $(ROOTSVCNETWORK)/shares
160 ROOTSVCSMB= $(ROOTSVCNETWORK)/smb
161 ROOTSVCPLATFORM= $(ROOTSVCMANIFEST)/platform
162 ROOTSVCPLATFORMSUN4U= $(ROOTSVCPLATFORM)/sun4u
163 ROOTSVCPLATFORMSUN4V= $(ROOTSVCPLATFORM)/sun4v
164 ROOTSVCAPPLICATION= $(ROOTSVCMANIFEST)/application
165 ROOTSVCAPPLICATIONMANAGEMENT= $(ROOTSVCAPPLICATION)/management
166 ROOTSVCAPPLICATIONSECURITY= $(ROOTSVCAPPLICATION)/security
167 ROOTSVCAPPLICATIONPRINT= $(ROOTSVCAPPLICATION)/print
170 # Commands Makefiles delivering a manifest are expected to define MANIFEST.
172 # Like ROOTCMDDIR, any lower-level Makefiles that put their manifests in a
173 # subdirectory of the manifest directories listed above should reset
174 # ROOTMANIFESTDIR and use it in their `install' target. By default we set this
175 # to a bogus value so that it will not conflict with any of the other values
176 # already defined in this Makefile.
178 # The manifest validation of the $SRC/cmd check target is also derived from a
179 # valid MANIFEST setting.
181 ROOTMANIFESTDIR= $(ROOTSVCMANIFEST)/__nonexistent_directory__
182 ROOTMANIFEST= $(MANIFEST:%=$(ROOTMANIFESTDIR)/%)
183 CHKMANIFEST= $(MANIFEST:%.xml=%.xmlchk)
185 # Manifests cannot be checked in parallel, because we are using the global
186 # repository that is in $(SRC)/cmd/svc/seed/global.db. This is a
187 # repository that is built from the manifests in this workspace, whereas
188 # the build machine's repository may be out of sync with these manifests.
189 # Because we are using a private repository, svccfg-native must start up a
190 # private copy of configd-native. We cannot have multiple copies of
191 # configd-native trying to access global.db simultaneously.
193 .NO_PARALLEL: $(CHKMANIFEST)
196 # For installing "starter scripts" of services
199 ROOTSVCMETHOD= $(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
201 ROOTSVCBINDIR= $(ROOTLIBSVCBIN)/__nonexistent_directory__
202 ROOTSVCBIN= $(SVCBIN:%=$(ROOTSVCBINDIR)/%)
206 # For programs that are installed in the root filesystem,
207 # build $(ROOTFS_PROG) rather than $(PROG)
208 $(ROOTFS_PROG) := LDFLAGS += -Wl,-I/lib/ld.so.1
210 $(KRB5BIN)/%: %
211 $(INS.file)
213 $(KRB5SBIN)/%: %
214 $(INS.file)
216 $(KRB5LIB)/%: %
217 $(INS.file)
219 $(ROOTBIN)/%: %
220 $(INS.file)
222 $(ROOTLIB)/%: %
223 $(INS.file)
225 $(ROOTBIN64)/%: %
226 $(INS.file)
228 $(ROOTLIB64)/%: %
229 $(INS.file)
231 $(ROOTBIN32)/%: %
232 $(INS.file)
234 $(ROOTSHLIB)/%: %
235 $(INS.file)
237 $(ROOTSBIN)/%: %
238 $(INS.file)
240 $(ROOTUSRSBIN)/%: %
241 $(INS.file)
243 $(ROOTUSRSBIN32)/%: %
244 $(INS.file)
246 $(ROOTUSRSBIN64)/%: %
247 $(INS.file)
249 $(ROOTETC)/%: %
250 $(INS.file)
252 $(ROOTETCFTPD)/%: %
253 $(INS.file)
255 $(ROOTETCINET)/%: %
256 $(INS.file)
258 $(ROOTETCDEFAULT)/%: %.dfl
259 $(INS.rename)
261 $(ROOTETCSECLIB)/%: %
262 $(INS.file)
264 $(ROOTETCZONES)/%: %
265 $(INS.file)
267 $(ROOTLIBZONES)/%: %
268 $(INS.file)
270 $(ROOTLOCALEDEF)/%: %
271 $(INS.file)
273 $(ROOTCHARMAP)/%: %
274 $(INS.file)
276 $(ROOTI18NEXT)/%: %
277 $(INS.file)
279 $(ROOTI18NEXT64)/%: %
280 $(INS.file)
282 $(ROOTLIBSVCMETHOD)/%: %
283 $(INS.file)
285 $(ROOTLIBSVCBIN)/%: %
286 $(INS.file)
288 $(ROOTSVCMILESTONE)/%: %
289 $(INS.file)
291 $(ROOTSVCDEVICE)/%: %
292 $(INS.file)
294 $(ROOTSVCSYSTEM)/%: %
295 $(INS.file)
297 $(ROOTSVCSYSTEMDEVICE)/%: %
298 $(INS.file)
300 $(ROOTSVCSYSTEMFILESYSTEM)/%: %
301 $(INS.file)
303 $(ROOTSVCSYSTEMSECURITY)/%: %
304 $(INS.file)
306 $(ROOTSVCNETWORK)/%: %
307 $(INS.file)
309 $(ROOTSVCNETWORKLDAP)/%: %
310 $(INS.file)
312 $(ROOTSVCNETWORKNFS)/%: %
313 $(INS.file)
315 $(ROOTSVCNETWORKNIS)/%: %
316 $(INS.file)
318 $(ROOTSVCNETWORKRPC)/%: %
319 $(INS.file)
321 $(ROOTSVCNETWORKSECURITY)/%: %
322 $(INS.file)
324 $(ROOTSVCNETWORKIPSEC)/%: %
325 $(INS.file)
327 $(ROOTSVCNETWORKSHARES)/%: %
328 $(INS.file)
330 $(ROOTSVCNETWORKSMB)/%: %
331 $(INS.file)
333 $(ROOTSVCAPPLICATION)/%: %
334 $(INS.file)
336 $(ROOTSVCAPPLICATIONMANAGEMENT)/%: %
337 $(INS.file)
339 $(ROOTSVCAPPLICATIONSECURITY)/%: %
340 $(INS.file)
342 $(ROOTSVCAPPLICATIONPRINT)/%: %
343 $(INS.file)
345 $(ROOTSVCPLATFORM)/%: %
346 $(INS.file)
348 $(ROOTSVCPLATFORMSUN4U)/%: %
349 $(INS.file)
351 $(ROOTSVCPLATFORMSUN4V)/%: %
352 $(INS.file)
354 # Install rule for gprof, yacc, and lex dependency files
355 $(ROOTSHLIBCCS)/%: ../common/%
356 $(INS.file)
358 $(ROOTVARSMB)/%: %
359 $(INS.file)
361 # build rule for statically linked programs with single source file.
362 %.static: %.c
363 $(LINK.c) -o $@ $< $(LDLIBS)
364 $(POST_PROCESS)
366 # Define the majority text domain in this directory.
367 TEXT_DOMAIN= SUNW_OST_OSCMD
369 CLOBBERFILES += $(DCFILE)
371 # This flag is for programs which should not build a 32-bit binary
372 sparc_64ONLY= $(POUND_SIGN)
373 64ONLY= $($(MACH)_64ONLY)