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