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 #
23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright (c) 2012 by Delphix. All rights reserved.
25 #
26
27 #
28 # Makefile.master, global definitions for system source
29 #
30 ROOT= /proto
31
32 #
33 # RELEASE_BUILD should be cleared for final release builds.
34 # NOT_RELEASE_BUILD is exactly what the name implies.
35 #
36 # INTERNAL_RELEASE_BUILD is a subset of RELEASE_BUILD. It mostly controls
37 # identification strings. Enabling RELEASE_BUILD automatically enables
38 # INTERNAL_RELEASE_BUILD.
39 #
40 # EXPORT_RELEASE_BUILD controls whether binaries are built in a form that
41 # can be released for export under a binary license. It is orthogonal to
42 # the other *RELEASE_BUILD settings. ("#" means do an export release
43 # build, "" means do a normal build.)
44 #
45 # CLOSED_BUILD controls whether we try to build files under
46 # usr/closed. ("" means to build closed code, "#" means don't try to
47 # build it.) Skipping the closed code implies doing an export release
48 # build.
49 #
50 # STRIP_COMMENTS toggles comment section striping. Generally the same setting
51 # as INTERNAL_RELEASE_BUILD.
52 #
53 # __GNUC toggles the building of ON components using gcc and related tools.
54 # Normally set to `#', set it to `' to do gcc build.
55 #
56 # The declaration POUND_SIGN is always '#'. This is needed to get around the
57 # make feature that '#' is always a comment delimiter, even when escaped or
58 # quoted. We use this macro expansion method to get POUND_SIGN rather than
59 # always breaking out a shell because the general case can cause a noticable
60 # slowdown in build times when so many Makefiles include Makefile.master.
61 #
62 # While the majority of users are expected to override the setting below
63 # with an env file (via nightly or bldenv), if you aren't building that way
64 # (ie, you're using "ws" or some other bootstrapping method) then you need
65 # this definition in order to avoid the subshell invocation mentioned above.
66 #
67
68 PRE_POUND= pre\#
69 POUND_SIGN= $(PRE_POUND:pre\%=%)
70
71 NOT_RELEASE_BUILD=
72 INTERNAL_RELEASE_BUILD= $(POUND_SIGN)
73 RELEASE_BUILD= $(POUND_SIGN)
74 $(RELEASE_BUILD)NOT_RELEASE_BUILD= $(POUND_SIGN)
75 $(RELEASE_BUILD)INTERNAL_RELEASE_BUILD=
76 PATCH_BUILD= $(POUND_SIGN)
77
78 # If CLOSED_IS_PRESENT is not set, assume the closed tree is present.
79 CLOSED_BUILD_1= $(CLOSED_IS_PRESENT:yes=)
80 CLOSED_BUILD= $(CLOSED_BUILD_1:no=$(POUND_SIGN))
81
82 EXPORT_RELEASE_BUILD= $(POUND_SIGN)
83 $(CLOSED_BUILD)EXPORT_RELEASE_BUILD=
84
85 # SPARC_BLD is '#' for an Intel build.
86 # INTEL_BLD is '#' for a Sparc build.
87 SPARC_BLD_1= $(MACH:i386=$(POUND_SIGN))
88 SPARC_BLD= $(SPARC_BLD_1:sparc=)
89 INTEL_BLD_1= $(MACH:sparc=$(POUND_SIGN))
90 INTEL_BLD= $(INTEL_BLD_1:i386=)
91
92 STRIP_COMMENTS= $(INTERNAL_RELEASE_BUILD)
93
94 # Are we building tonic closedbins? Unless you have used the
95 # -O flag to nightly or bldenv, leave the definition of TONICBUILD
96 # as $(POUND_SIGN).
97 #
98 # IF YOU CHANGE CLOSEDROOT, you MUST change install.bin
99 # to match the new definition.
100 TONICBUILD= $(POUND_SIGN)
101 $(TONICBUILD)CLOSEDROOT= $(ROOT)-closed
102
103
104 # The variables below control the compilers used during the build.
105 # There are a number of permutations.
106 #
107 # __GNUC and __SUNC control (and indicate) the primary compiler. Whichever
108 # one is not POUND_SIGN is the primary, with the other as the shadow. They
109 # may also be used to control entirely compiler-specific Makefile assignments.
110 # __SUNC and Sun Studio are the default.
111 #
112 # __GNUC64 indicates that the 64bit build should use the GNU C compiler.
113 # There is no Sun C analogue.
114 #
115 # The following version-specific options are operative regardless of which
116 # compiler is primary, and control the versions of the given compilers to be
117 # used. They also allow compiler-version specific Makefile fragments.
118 #
119
120 __GNUC= $(POUND_SIGN)
121 $(__GNUC)__SUNC= $(POUND_SIGN)
122 __GNUC64= $(__GNUC)
123
124 # CLOSED is the root of the tree that contains source which isn't released
125 # as open source
126 CLOSED= $(SRC)/../closed
127
128 # BUILD_TOOLS is the root of all tools including compilers.
129 # ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
130
131 BUILD_TOOLS= /ws/onnv-tools
132 ONBLD_TOOLS= $(BUILD_TOOLS)/onbld
133
134 JAVA_ROOT= /usr/java
135
136 SFW_ROOT= /usr/sfw
137 SFWINCDIR= $(SFW_ROOT)/include
138 SFWLIBDIR= $(SFW_ROOT)/lib
139 SFWLIBDIR64= $(SFW_ROOT)/lib/$(MACH64)
140
141 GCC_ROOT= /opt/gcc/4.4.4
142 GCCLIBDIR= $(GCC_ROOT)/lib
143 GCCLIBDIR64= $(GCC_ROOT)/lib/$(MACH64)
144
145 DOCBOOK_XSL_ROOT= /usr/share/sgml/docbook/xsl-stylesheets
146
147 RPCGEN= /usr/bin/rpcgen
148 STABS= $(ONBLD_TOOLS)/bin/$(MACH)/stabs
149 ELFEXTRACT= $(ONBLD_TOOLS)/bin/$(MACH)/elfextract
150 MBH_PATCH= $(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch
151 ECHO= echo
152 INS= install
153 TRUE= true
154 SYMLINK= /usr/bin/ln -s
155 LN= /usr/bin/ln
156 CHMOD= /usr/bin/chmod
157 MV= /usr/bin/mv -f
158 RM= /usr/bin/rm -f
159 CUT= /usr/bin/cut
160 NM= /usr/ccs/bin/nm
161 DIFF= /usr/bin/diff
162 GREP= /usr/bin/grep
163 EGREP= /usr/bin/egrep
164 ELFWRAP= /usr/bin/elfwrap
165 KSH93= /usr/bin/ksh93
166 SED= /usr/bin/sed
167 NAWK= /usr/bin/nawk
168 CP= /usr/bin/cp -f
169 MCS= /usr/ccs/bin/mcs
170 CAT= /usr/bin/cat
171 ELFDUMP= /usr/ccs/bin/elfdump
172 M4= /usr/ccs/bin/m4
173 STRIP= /usr/ccs/bin/strip
174 LEX= /usr/ccs/bin/lex
175 FLEX= $(SFW_ROOT)/bin/flex
176 YACC= /usr/ccs/bin/yacc
177 CPP= /usr/lib/cpp
178 JAVAC= $(JAVA_ROOT)/bin/javac
179 JAVAH= $(JAVA_ROOT)/bin/javah
180 JAVADOC= $(JAVA_ROOT)/bin/javadoc
181 RMIC= $(JAVA_ROOT)/bin/rmic
182 JAR= $(JAVA_ROOT)/bin/jar
183 CTFCONVERT= $(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
184 CTFMERGE= $(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
185 CTFSTABS= $(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
186 CTFSTRIP= $(ONBLD_TOOLS)/bin/$(MACH)/ctfstrip
187 NDRGEN= $(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
188 GENOFFSETS= $(ONBLD_TOOLS)/bin/genoffsets
189 CTFCVTPTBL= $(ONBLD_TOOLS)/bin/ctfcvtptbl
190 CTFFINDMOD= $(ONBLD_TOOLS)/bin/ctffindmod
191 XREF= $(ONBLD_TOOLS)/bin/xref
192 FIND= /usr/bin/find
193 PERL= /usr/bin/perl
194 PYTHON_26= /usr/bin/python2.6
195 PYTHON= $(PYTHON_26)
196 SORT= /usr/bin/sort
197 TOUCH= /usr/bin/touch
198 WC= /usr/bin/wc
199 XARGS= /usr/bin/xargs
200 ELFEDIT= /usr/bin/elfedit
201 ELFSIGN= /usr/bin/elfsign
202 DTRACE= /usr/sbin/dtrace -xnolibs
203 UNIQ= /usr/bin/uniq
204 TAR= /usr/bin/tar
205
206 FILEMODE= 644
207 DIRMODE= 755
208
209 #
210 # The version of the patch makeup table optimized for build-time use. Used
211 # during patch builds only.
212 $(PATCH_BUILD)PMTMO_FILE=$(SRC)/patch_makeup_table.mo
213
214 # Declare that nothing should be built in parallel.
215 # Individual Makefiles can use the .PARALLEL target to declare otherwise.
216 .NO_PARALLEL:
217
218 # For stylistic checks
219 #
220 # Note that the X and C checks are not used at this time and may need
221 # modification when they are actually used.
222 #
223 CSTYLE= $(ONBLD_TOOLS)/bin/cstyle
224 CSTYLE_TAIL=
225 HDRCHK= $(ONBLD_TOOLS)/bin/hdrchk
226 HDRCHK_TAIL=
227 JSTYLE= $(ONBLD_TOOLS)/bin/jstyle
228
229 DOT_H_CHECK= \
230 @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
231 $(HDRCHK) $< $(HDRCHK_TAIL)
232
233 DOT_X_CHECK= \
234 @$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
235 $(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
236
237 DOT_C_CHECK= \
238 @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
239
240 MANIFEST_CHECK= \
241 @$(ECHO) "checking $<"; \
242 SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
243 SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
244 SVCCFG_CONFIGD_PATH=$(SRC)/cmd/svc/configd/svc.configd-native \
245 $(SRC)/cmd/svc/svccfg/svccfg-native validate $<
246
247 #
248 # IMPORTANT:: If you change any of INS.file, INS.dir, INS.rename,
249 # INS.link or INS.symlink here, then you must also change the
250 # corresponding override definitions in $CLOSED/Makefile.tonic.
251 # If you do not do this, then the closedbins build for the OpenSolaris
252 # community will break. PS, the gatekeepers will be upset too.
253 INS.file= $(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
254 INS.dir= $(INS) -s -d -m $(DIRMODE) $@
255 # installs and renames at once
256 #
257 INS.rename= $(INS.file); $(MV) $(@D)/$(<F) $@
258
259 # install a link
260 INSLINKTARGET= $<
261 INS.link= $(RM) $@; $(LN) $(INSLINKTARGET) $@
262 INS.symlink= $(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
263
264 #
265 # Python bakes the mtime of the .py file into the compiled .pyc and
266 # rebuilds if the baked-in mtime != the mtime of the source file
267 # (rather than only if it's less than), thus when installing python
268 # files we must make certain to not adjust the mtime of the source
269 # (.py) file.
270 #
271 INS.pyfile= $(INS.file); $(TOUCH) -r $< $@
272
273 # MACH must be set in the shell environment per uname -p on the build host
274 # More specific architecture variables should be set in lower makefiles.
275 #
276 # MACH64 is derived from MACH, and BUILD64 is set to `#' for
277 # architectures on which we do not build 64-bit versions.
278 # (There are no such architectures at the moment.)
279 #
280 # Set BUILD64=# in the environment to disable 64-bit amd64
281 # builds on i386 machines.
282
283 MACH64_1= $(MACH:sparc=sparcv9)
284 MACH64= $(MACH64_1:i386=amd64)
285
286 MACH32_1= $(MACH:sparc=sparcv7)
287 MACH32= $(MACH32_1:i386=i86)
288
289 sparc_BUILD64=
290 i386_BUILD64=
291 BUILD64= $($(MACH)_BUILD64)
292
293 #
294 # C compiler mode. Future compilers may change the default on us,
295 # so force extended ANSI mode globally. Lower level makefiles can
296 # override this by setting CCMODE.
297 #
298 CCMODE= -Xa
299 CCMODE64= -Xa
300
301 #
302 # C compiler verbose mode. This is so we can enable it globally,
303 # but turn it off in the lower level makefiles of things we cannot
304 # (or aren't going to) fix.
305 #
306 CCVERBOSE= -v
307
308 # set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings
309 # from the compiler about places the -xarch=v9 may differ from -xarch=v9c.
310 V9ABIWARN=
311
312 # set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register
313 # symbols (used to detect conflicts between objects that use global registers)
314 # we disable this now for safety, and because genunix doesn't link with
315 # this feature (the v9 default) enabled.
316 #
317 # REGSYM is separate since the C++ driver syntax is different.
318 CCREGSYM= -Wc,-Qiselect-regsym=0
319 CCCREGSYM= -Qoption cg -Qiselect-regsym=0
320
321 # Prevent the removal of static symbols by the SPARC code generator (cg).
322 # The x86 code generator (ube) does not remove such symbols and as such
323 # using this workaround is not applicable for x86.
324 #
325 CCSTATICSYM= -Wc,-Qassembler-ounrefsym=0
326 #
327 # generate 32-bit addresses in the v9 kernel. Saves memory.
328 CCABS32= -Wc,-xcode=abs32
329 #
330 # generate v9 code which tolerates callers using the v7 ABI, for the sake of
331 # system calls.
332 CC32BITCALLERS= -_gcc=-massume-32bit-callers
333
334 # GCC, especially, is increasingly beginning to auto-inline functions and
335 # sadly does so separately not under the general -fno-inline-functions
336 # Additionally, we wish to prevent optimisations which cause GCC to clone
337 # functions -- in particular, these may cause unhelpful symbols to be
338 # emitted instead of function names
339 CCNOAUTOINLINE= -_gcc=-fno-inline-small-functions \
340 -_gcc=-fno-inline-functions-called-once \
341 -_gcc=-fno-ipa-cp
342
343 # One optimization the compiler might perform is to turn this:
344 # #pragma weak foo
345 # extern int foo;
346 # if (&foo)
347 # foo = 5;
348 # into
349 # foo = 5;
350 # Since we do some of this (foo might be referenced in common kernel code
351 # but provided only for some cpu modules or platforms), we disable this
352 # optimization.
353 #
354 sparc_CCUNBOUND = -Wd,-xsafe=unboundsym
355 i386_CCUNBOUND =
356 CCUNBOUND = $($(MACH)_CCUNBOUND)
357
358 #
359 # compiler '-xarch' flag. This is here to centralize it and make it
360 # overridable for testing.
361 sparc_XARCH= -m32
362 sparcv9_XARCH= -m64
363 i386_XARCH=
364 amd64_XARCH= -m64 -Ui386 -U__i386
365
366 # assembler '-xarch' flag. Different from compiler '-xarch' flag.
367 sparc_AS_XARCH= -xarch=v8plus
368 sparcv9_AS_XARCH= -xarch=v9
369 i386_AS_XARCH=
370 amd64_AS_XARCH= -xarch=amd64 -P -Ui386 -U__i386
371
372 #
373 # These flags define what we need to be 'standalone' i.e. -not- part
374 # of the rather more cosy userland environment. This basically means
375 # the kernel.
376 #
377 # XX64 future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
378 #
379 sparc_STAND_FLAGS= -_gcc=-ffreestanding
380 sparcv9_STAND_FLAGS= -_gcc=-ffreestanding
381 # Disabling MMX also disables 3DNow, disabling SSE also disables all later
382 # additions to SSE (SSE2, AVX ,etc.)
383 NO_SIMD= -_gcc=-mno-mmx -_gcc=-mno-sse
384 i386_STAND_FLAGS= -_gcc=-ffreestanding $(NO_SIMD)
385 amd64_STAND_FLAGS= -xmodel=kernel $(NO_SIMD)
386
387 SAVEARGS= -Wu,-save_args
388 amd64_STAND_FLAGS += $(SAVEARGS)
389
390 STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
391 STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
392
393 #
394 # disable the incremental linker
395 ILDOFF= -xildoff
396 #
397 XDEPEND= -xdepend
398 XFFLAG= -xF=%all
399 XESS= -xs
400 XSTRCONST= -xstrconst
401
402 #
403 # turn warnings into errors (C)
404 CERRWARN = -errtags=yes -errwarn=%all
405 CERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT
406 CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
407
408 CERRWARN += -_gcc=-Wno-missing-braces
409 CERRWARN += -_gcc=-Wno-sign-compare
410 CERRWARN += -_gcc=-Wno-unknown-pragmas
411 CERRWARN += -_gcc=-Wno-unused-parameter
412 CERRWARN += -_gcc=-Wno-missing-field-initializers
413
414 # Unfortunately, this option can misfire very easily and unfixably.
415 CERRWARN += -_gcc=-Wno-array-bounds
416
417 # DEBUG v. -nd make for frequent unused variables, empty conditions, etc. in
418 # -nd builds
419 $(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused
420 $(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-empty-body
421
422 #
423 # turn warnings into errors (C++)
424 CCERRWARN= -xwe
425
426 # C99 mode
427 C99_ENABLE= -xc99=%all
428 C99_DISABLE= -xc99=%none
429 C99MODE= $(C99_DISABLE)
430 C99LMODE= $(C99MODE:-xc99%=-Xc99%)
431
432 # In most places, assignments to these macros should be appended with +=
433 # (CPPFLAGS.master allows values to be prepended to CPPFLAGS).
434 sparc_CFLAGS= $(sparc_XARCH) $(CCSTATICSYM)
435 sparcv9_CFLAGS= $(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM) \
436 $(CCSTATICSYM)
437 i386_CFLAGS= $(i386_XARCH)
438 amd64_CFLAGS= $(amd64_XARCH)
439
440 sparc_ASFLAGS= $(sparc_AS_XARCH)
441 sparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
442 i386_ASFLAGS= $(i386_AS_XARCH)
443 amd64_ASFLAGS= $(amd64_AS_XARCH)
444
445 #
446 sparc_COPTFLAG= -xO3
447 sparcv9_COPTFLAG= -xO3
448 i386_COPTFLAG= -O
449 amd64_COPTFLAG= -xO3
450
451 COPTFLAG= $($(MACH)_COPTFLAG)
452 COPTFLAG64= $($(MACH64)_COPTFLAG)
453
454 # When -g is used, the compiler globalizes static objects
455 # (gives them a unique prefix). Disable that.
456 CNOGLOBAL= -W0,-noglobal
457
458 # Direct the Sun Studio compiler to use a static globalization prefix based on the
459 # name of the module rather than something unique. Otherwise, objects
460 # will not build deterministically, as subsequent compilations of identical
461 # source will yeild objects that always look different.
462 #
463 # In the same spirit, this will also remove the date from the N_OPT stab.
464 CGLOBALSTATIC= -W0,-xglobalstatic
465
466 # Sometimes we want all symbols and types in debugging information even
467 # if they aren't used.
468 CALLSYMS= -W0,-xdbggen=no%usedonly
469
470 #
471 # Default debug format for Sun Studio 11 is dwarf, so force it to
472 # generate stabs.
473 #
474 DEBUGFORMAT= -xdebugformat=stabs
475
476 #
477 # Flags used to build in debug mode for ctf generation. Bugs in the Devpro
478 # compilers currently prevent us from building with cc-emitted DWARF.
479 #
480 CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
481 CTF_FLAGS_i386 = -g $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
482
483 CTF_FLAGS_sparcv9 = $(CTF_FLAGS_sparc)
484 CTF_FLAGS_amd64 = $(CTF_FLAGS_i386)
485
486 # Sun Studio produces broken userland code when saving arguments.
487 $(__GNUC)CTF_FLAGS_amd64 += $(SAVEARGS)
488
489 CTF_FLAGS_32 = $(CTF_FLAGS_$(MACH)) $(DEBUGFORMAT)
490 CTF_FLAGS_64 = $(CTF_FLAGS_$(MACH64)) $(DEBUGFORMAT)
491 CTF_FLAGS = $(CTF_FLAGS_32)
492
493 #
494 # Flags used with genoffsets
495 #
496 GOFLAGS = -_noecho \
497 $(CALLSYMS) \
498 $(CDWARFSTR)
499
500 OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
501 $(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
502
503 OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
504 $(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
505
506 #
507 # tradeoff time for space (smaller is better)
508 #
509 sparc_SPACEFLAG = -xspace -W0,-Lt
510 sparcv9_SPACEFLAG = -xspace -W0,-Lt
511 i386_SPACEFLAG = -xspace
512 amd64_SPACEFLAG =
513
514 SPACEFLAG = $($(MACH)_SPACEFLAG)
515 SPACEFLAG64 = $($(MACH64)_SPACEFLAG)
516
517 #
518 # The Sun Studio 11 compiler has changed the behaviour of integer
519 # wrap arounds and so a flag is needed to use the legacy behaviour
520 # (without this flag panics/hangs could be exposed within the source).
521 #
522 sparc_IROPTFLAG = -W2,-xwrap_int
523 sparcv9_IROPTFLAG = -W2,-xwrap_int
524 i386_IROPTFLAG =
525 amd64_IROPTFLAG =
526
527 IROPTFLAG = $($(MACH)_IROPTFLAG)
528 IROPTFLAG64 = $($(MACH64)_IROPTFLAG)
529
530 sparc_XREGSFLAG = -xregs=no%appl
531 sparcv9_XREGSFLAG = -xregs=no%appl
532 i386_XREGSFLAG =
533 amd64_XREGSFLAG =
534
535 XREGSFLAG = $($(MACH)_XREGSFLAG)
536 XREGSFLAG64 = $($(MACH64)_XREGSFLAG)
537
538 # dmake SOURCEDEBUG=yes ... enables source-level debugging information, and
539 # avoids stripping it.
540 SOURCEDEBUG = $(POUND_SIGN)
541 SRCDBGBLD = $(SOURCEDEBUG:yes=)
542
543 #
544 # These variables are intended ONLY for use by developers to safely pass extra
545 # flags to the compilers without unintentionally overriding Makefile-set
546 # flags. They should NEVER be set to any value in a Makefile.
547 #
548 # They come last in the associated FLAGS variable such that they can
549 # explicitly override things if necessary, there are gaps in this, but it's
550 # the best we can manage.
551 #
552 CUSERFLAGS =
553 CUSERFLAGS64 = $(CUSERFLAGS)
554 CCUSERFLAGS =
555 CCUSERFLAGS64 = $(CCUSERFLAGS)
556
557 CSOURCEDEBUGFLAGS =
558 CCSOURCEDEBUGFLAGS =
559 $(SRCDBGBLD)CSOURCEDEBUGFLAGS = -g -xs
560 $(SRCDBGBLD)CCSOURCEDEBUGFLAGS = -g -xs
561
562 CFLAGS= $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
563 $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \
564 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
565 $(CUSERFLAGS)
566 CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
567 $(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \
568 $(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
569 $(CUSERFLAGS64)
570 #
571 # Flags that are used to build parts of the code that are subsequently
572 # run on the build machine (also known as the NATIVE_BUILD).
573 #
574 NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
575 $(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \
576 $(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \
577 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
578
579 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" # For messaging.
580 DTS_ERRNO=-D_TS_ERRNO
581 CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
582 $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
583 CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
584 CPPFLAGS= $(CPPFLAGS.master)
585 AS_CPPFLAGS= $(CPPFLAGS.master)
586 JAVAFLAGS= -deprecation
587
588 #
589 # For source message catalogue
590 #
591 .SUFFIXES: $(SUFFIXES) .i .po
592 MSGROOT= $(ROOT)/catalog
593 MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
594 MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
595 DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
596 DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
597
598 CLOBBERFILES += $(POFILE) $(POFILES)
599 COMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
600 XGETTEXT= /usr/bin/xgettext
601 XGETFLAGS= -c TRANSLATION_NOTE
602 GNUXGETTEXT= /usr/gnu/bin/xgettext
603 GNUXGETFLAGS= --add-comments=TRANSLATION_NOTE --keyword=_ \
604 --strict --no-location --omit-header
605 BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
606 $(RM) $@ ;\
607 $(SED) "/^domain/d" < $(<F).po > $@ ;\
608 $(RM) $(<F).po $<.i
609
610 #
611 # This is overwritten by local Makefile when PROG is a list.
612 #
613 POFILE= $(PROG).po
614
615 sparc_CCFLAGS= -cg92 -compat=4 \
616 -Qoption ccfe -messages=no%anachronism \
617 $(CCERRWARN)
618 sparcv9_CCFLAGS= $(sparcv9_XARCH) -dalign -compat=5 \
619 -Qoption ccfe -messages=no%anachronism \
620 -Qoption ccfe -features=no%conststrings \
621 $(CCCREGSYM) \
622 $(CCERRWARN)
623 i386_CCFLAGS= -compat=4 \
624 -Qoption ccfe -messages=no%anachronism \
625 -Qoption ccfe -features=no%conststrings \
626 $(CCERRWARN)
627 amd64_CCFLAGS= $(amd64_XARCH) -compat=5 \
628 -Qoption ccfe -messages=no%anachronism \
629 -Qoption ccfe -features=no%conststrings \
630 $(CCERRWARN)
631
632 sparc_CCOPTFLAG= -O
633 sparcv9_CCOPTFLAG= -O
634 i386_CCOPTFLAG= -O
635 amd64_CCOPTFLAG= -O
636
637 CCOPTFLAG= $($(MACH)_CCOPTFLAG)
638 CCOPTFLAG64= $($(MACH64)_CCOPTFLAG)
639 CCFLAGS= $(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
640 $(CCUSERFLAGS)
641 CCFLAGS64= $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
642 $(CCUSERFLAGS64)
643
644 #
645 #
646 #
647 ELFWRAP_FLAGS =
648 ELFWRAP_FLAGS64 = -64
649
650 #
651 # Various mapfiles that are used throughout the build, and delivered to
652 # /usr/lib/ld.
653 #
654 MAPFILE.NED_i386 = $(SRC)/common/mapfiles/common/map.noexdata
655 MAPFILE.NED_sparc =
656 MAPFILE.NED = $(MAPFILE.NED_$(MACH))
657 MAPFILE.PGA = $(SRC)/common/mapfiles/common/map.pagealign
658 MAPFILE.NES = $(SRC)/common/mapfiles/common/map.noexstk
659 MAPFILE.FLT = $(SRC)/common/mapfiles/common/map.filter
660 MAPFILE.LEX = $(SRC)/common/mapfiles/common/map.lex.yy
661
662 #
663 # Generated mapfiles that are compiler specific, and used throughout the
664 # build. These mapfiles are not delivered in /usr/lib/ld.
665 #
666 MAPFILE.NGB_sparc= $(SRC)/common/mapfiles/gen/sparc_cc_map.noexeglobs
667 $(__GNUC64)MAPFILE.NGB_sparc= \
668 $(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
669 MAPFILE.NGB_sparcv9= $(SRC)/common/mapfiles/gen/sparcv9_cc_map.noexeglobs
670 $(__GNUC64)MAPFILE.NGB_sparcv9= \
671 $(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
672 MAPFILE.NGB_i386= $(SRC)/common/mapfiles/gen/i386_cc_map.noexeglobs
673 $(__GNUC64)MAPFILE.NGB_i386= \
674 $(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
675 MAPFILE.NGB_amd64= $(SRC)/common/mapfiles/gen/amd64_cc_map.noexeglobs
676 $(__GNUC64)MAPFILE.NGB_amd64= \
677 $(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
678 MAPFILE.NGB = $(MAPFILE.NGB_$(MACH))
679
680 #
681 # A generic interface mapfile name, used by various dynamic objects to define
682 # the interfaces and interposers the object must export.
683 #
684 MAPFILE.INT = mapfile-intf
685
686 #
687 # LDLIBS32 can be set in the environment to override the following assignment.
688 # LDLIBS64 can be set to override the assignment made in Makefile.master.64.
689 # These environment settings make sure that no libraries are searched outside
690 # of the local workspace proto area:
691 # LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
692 # LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
693 #
694 LDLIBS32 = $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
695 LDLIBS.cmd = $(LDLIBS32)
696 LDLIBS.lib = $(LDLIBS32)
697 #
698 # Define compilation macros.
699 #
700 COMPILE.c= $(CC) $(CFLAGS) $(CPPFLAGS) -c
701 COMPILE64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) -c
702 COMPILE.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) -c
703 COMPILE64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
704 COMPILE.s= $(AS) $(ASFLAGS) $(AS_CPPFLAGS)
705 COMPILE64.s= $(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
706 COMPILE.d= $(DTRACE) -G -32
707 COMPILE64.d= $(DTRACE) -G -64
708 COMPILE.b= $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
709 COMPILE64.b= $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
710
711 CLASSPATH= .
712 COMPILE.java= $(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
713
714 #
715 # Link time macros
716 #
717 CCNEEDED = -lC
718 CCEXTNEEDED = -lCrun -lCstd
719 $(__GNUC)CCNEEDED = -L$(GCCLIBDIR) -R$(GCCLIBDIR) -lstdc++ -lgcc_s
720 $(__GNUC)CCEXTNEEDED = $(CCNEEDED)
721
722 LINK.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
723 LINK64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
724 NORUNPATH= -norunpath -nolib
725 LINK.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
726 $(LDFLAGS) $(CCNEEDED)
727 LINK64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
728 $(LDFLAGS) $(CCNEEDED)
729
730 #
731 # lint macros
732 #
733 # Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once
734 # ON is built with a version of lint that has the fix for 4484186.
735 #
736 ALWAYS_LINT_DEFS = -errtags=yes -s
737 ALWAYS_LINT_DEFS += -erroff=E_PTRDIFF_OVERFLOW
738 ALWAYS_LINT_DEFS += -erroff=E_ASSIGN_NARROW_CONV
739 ALWAYS_LINT_DEFS += -U__PRAGMA_REDEFINE_EXTNAME
740 ALWAYS_LINT_DEFS += $(C99LMODE)
741 ALWAYS_LINT_DEFS += -errsecurity=$(SECLEVEL)
742 ALWAYS_LINT_DEFS += -erroff=E_SEC_CREAT_WITHOUT_EXCL
743 ALWAYS_LINT_DEFS += -erroff=E_SEC_FORBIDDEN_WARN_CREAT
744 # XX64 -- really only needed for amd64 lint
745 ALWAYS_LINT_DEFS += -erroff=E_ASSIGN_INT_TO_SMALL_INT
746 ALWAYS_LINT_DEFS += -erroff=E_CAST_INT_CONST_TO_SMALL_INT
747 ALWAYS_LINT_DEFS += -erroff=E_CAST_INT_TO_SMALL_INT
748 ALWAYS_LINT_DEFS += -erroff=E_CAST_TO_PTR_FROM_INT
749 ALWAYS_LINT_DEFS += -erroff=E_COMP_INT_WITH_LARGE_INT
750 ALWAYS_LINT_DEFS += -erroff=E_INTEGRAL_CONST_EXP_EXPECTED
751 ALWAYS_LINT_DEFS += -erroff=E_PASS_INT_TO_SMALL_INT
752 ALWAYS_LINT_DEFS += -erroff=E_PTR_CONV_LOSES_BITS
753
754 # This forces lint to pick up note.h and sys/note.h from Devpro rather than
755 # from the proto area. The note.h that ON delivers would disable NOTE().
756 ONLY_LINT_DEFS = -I$(SPRO_VROOT)/prod/include/lint
757
758 SECLEVEL= core
759 LINT.c= $(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS) $(CPPFLAGS) \
760 $(ALWAYS_LINT_DEFS)
761 LINT64.c= $(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS64) $(CPPFLAGS) \
762 $(ALWAYS_LINT_DEFS)
763 LINT.s= $(LINT.c)
764
765 # For some future builds, NATIVE_MACH and MACH might be different.
766 # Therefore, NATIVE_MACH needs to be redefined in the
767 # environment as `uname -p` to override this macro.
768 #
769 # For now at least, we cross-compile amd64 on i386 machines.
770 NATIVE_MACH= $(MACH:amd64=i386)
771
772 # Define native compilation macros
773 #
774
775 # Base directory where compilers are loaded.
776 # Defined here so it can be overridden by developer.
777 #
778 SPRO_ROOT= $(BUILD_TOOLS)/SUNWspro
779 SPRO_VROOT= $(SPRO_ROOT)/SS12
780 GNU_ROOT= $(SFW_ROOT)
781
782 # Till SS12u1 formally becomes the NV CBE, LINT is hard
783 # coded to be picked up from the $SPRO_ROOT/sunstudio12.1/
784 # location. Impacted variables are sparc_LINT, sparcv9_LINT,
785 # i386_LINT, amd64_LINT.
786 # Reset them when SS12u1 is rolled out.
787 #
788
789 # Specify platform compiler versions for languages
790 # that we use (currently only c and c++).
791 #
792 sparc_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
793 $(__GNUC)sparc_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
794 sparc_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
795 $(__GNUC)sparc_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
796 sparc_CPP= /usr/ccs/lib/cpp
797 sparc_AS= /usr/ccs/bin/as -xregsym=no
798 sparc_LD= /usr/ccs/bin/ld
799 sparc_LINT= $(SPRO_ROOT)/sunstudio12.1/bin/lint
800
801 sparcv9_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
802 $(__GNUC64)sparcv9_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
803 sparcv9_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
804 $(__GNUC64)sparcv9_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
805 sparcv9_CPP= /usr/ccs/lib/cpp
806 sparcv9_AS= /usr/ccs/bin/as -xregsym=no
807 sparcv9_LD= /usr/ccs/bin/ld
808 sparcv9_LINT= $(SPRO_ROOT)/sunstudio12.1/bin/lint
809
810 i386_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
811 $(__GNUC)i386_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
812 i386_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
813 $(__GNUC)i386_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
814 i386_CPP= /usr/ccs/lib/cpp
815 i386_AS= /usr/ccs/bin/as
816 $(__GNUC)i386_AS= $(ONBLD_TOOLS)/bin/$(MACH)/aw
817 i386_LD= /usr/ccs/bin/ld
818 i386_LINT= $(SPRO_ROOT)/sunstudio12.1/bin/lint
819
820 amd64_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
821 $(__GNUC64)amd64_CC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
822 amd64_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
823 $(__GNUC64)amd64_CCC= $(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
824 amd64_CPP= /usr/ccs/lib/cpp
825 amd64_AS= $(ONBLD_TOOLS)/bin/$(MACH)/aw
826 amd64_LD= /usr/ccs/bin/ld
827 amd64_LINT= $(SPRO_ROOT)/sunstudio12.1/bin/lint
828
829 NATIVECC= $($(NATIVE_MACH)_CC)
830 NATIVECCC= $($(NATIVE_MACH)_CCC)
831 NATIVECPP= $($(NATIVE_MACH)_CPP)
832 NATIVEAS= $($(NATIVE_MACH)_AS)
833 NATIVELD= $($(NATIVE_MACH)_LD)
834 NATIVELINT= $($(NATIVE_MACH)_LINT)
835
836 #
837 # Makefile.master.64 overrides these settings
838 #
839 CC= $(NATIVECC)
840 CCC= $(NATIVECCC)
841 CPP= $(NATIVECPP)
842 AS= $(NATIVEAS)
843 LD= $(NATIVELD)
844 LINT= $(NATIVELINT)
845
846 # The real compilers used for this build
847 CW_CC_CMD= $(CC) -_compiler
848 CW_CCC_CMD= $(CCC) -_compiler
849 REAL_CC= $(CW_CC_CMD:sh)
850 REAL_CCC= $(CW_CCC_CMD:sh)
851
852 # Pass -Y flag to cpp (method of which is release-dependent)
853 CCYFLAG= -Y I,
854
855 BDIRECT= -Bdirect
856 BDYNAMIC= -Bdynamic
857 BLOCAL= -Blocal
858 BNODIRECT= -Bnodirect
859 BREDUCE= -Breduce
860 BSTATIC= -Bstatic
861
862 ZDEFS= -zdefs
863 ZDIRECT= -zdirect
864 ZIGNORE= -zignore
865 ZINITFIRST= -zinitfirst
866 ZINTERPOSE= -zinterpose
867 ZLAZYLOAD= -zlazyload
868 ZLOADFLTR= -zloadfltr
869 ZMULDEFS= -zmuldefs
870 ZNODEFAULTLIB= -znodefaultlib
871 ZNODEFS= -znodefs
872 ZNODELETE= -znodelete
873 ZNODLOPEN= -znodlopen
874 ZNODUMP= -znodump
875 ZNOLAZYLOAD= -znolazyload
876 ZNOLDYNSYM= -znoldynsym
877 ZNORELOC= -znoreloc
878 ZNOVERSION= -znoversion
879 ZRECORD= -zrecord
880 ZREDLOCSYM= -zredlocsym
881 ZTEXT= -ztext
882 ZVERBOSE= -zverbose
883
884 GSHARED= -G
885 CCMT= -mt
886
887 # Handle different PIC models on different ISAs
888 # (May be overridden by lower-level Makefiles)
889
890 sparc_C_PICFLAGS = -K pic
891 sparcv9_C_PICFLAGS = -K pic
892 i386_C_PICFLAGS = -K pic
893 amd64_C_PICFLAGS = -K pic
894 C_PICFLAGS = $($(MACH)_C_PICFLAGS)
895 C_PICFLAGS64 = $($(MACH64)_C_PICFLAGS)
896
897 sparc_C_BIGPICFLAGS = -K PIC
898 sparcv9_C_BIGPICFLAGS = -K PIC
899 i386_C_BIGPICFLAGS = -K PIC
900 amd64_C_BIGPICFLAGS = -K PIC
901 C_BIGPICFLAGS = $($(MACH)_C_BIGPICFLAGS)
902 C_BIGPICFLAGS64 = $($(MACH64)_C_BIGPICFLAGS)
903
904 # CC requires there to be no space between '-K' and 'pic' or 'PIC'.
905 sparc_CC_PICFLAGS = -Kpic
906 sparcv9_CC_PICFLAGS = -KPIC
907 i386_CC_PICFLAGS = -Kpic
908 amd64_CC_PICFLAGS = -Kpic
909 CC_PICFLAGS = $($(MACH)_CC_PICFLAGS)
910 CC_PICFLAGS64 = $($(MACH64)_CC_PICFLAGS)
911
912 AS_PICFLAGS= $(C_PICFLAGS)
913 AS_BIGPICFLAGS= $(C_BIGPICFLAGS)
914
915 #
916 # Default label for CTF sections
917 #
918 CTFCVTFLAGS= -i -L VERSION
919 $(SRCDBGBLD)CTFCVTFLAGS += -g
920
921 #
922 # Override to pass module-specific flags to ctfmerge. Currently used only by
923 # krtld to turn on fuzzy matching, and source-level debugging to inhibit
924 # stripping.
925 #
926 CTFMRGFLAGS=
927 $(SRCDBGBLD)CTFMRGFLAGS += -g
928
929
930 CTFCONVERT_O = $(CTFCONVERT) $(CTFCVTFLAGS) $@
931
932 ELFSIGN_O= $(TRUE)
933 ELFSIGN_CRYPTO= $(ELFSIGN_O)
934 ELFSIGN_OBJECT= $(ELFSIGN_O)
935 $(EXPORT_RELEASE_BUILD)ELFSIGN_O = $(ELFSIGN)
936 $(EXPORT_RELEASE_BUILD)ELFSIGN_CFNAME = SUNWosnetCF
937 $(EXPORT_RELEASE_BUILD)ELFSIGN_KEY = \
938 $(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CFNAME)
939 $(EXPORT_RELEASE_BUILD)ELFSIGN_CERT= \
940 $(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CFNAME)
941 $(EXPORT_RELEASE_BUILD)ELFSIGN_SENAME = SUNWosnetSE
942 $(EXPORT_RELEASE_BUILD)ELFSIGN_SEKEY = \
943 $(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_SENAME)
944 $(EXPORT_RELEASE_BUILD)ELFSIGN_SECERT= \
945 $(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_SENAME)
946 $(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO= $(ELFSIGN_O) sign \
947 $(ELFSIGN_FORMAT_OPTION) \
948 -k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@
949 $(EXPORT_RELEASE_BUILD)ELFSIGN_OBJECT= $(ELFSIGN_O) sign \
950 $(ELFSIGN_FORMAT_OPTION) \
951 -k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@
952
953 # Rules (normally from make.rules) and macros which are used for post
954 # processing files. Normally, these do stripping of the comment section
955 # automatically.
956 # RELEASE_CM: Should be editted to reflect the release.
957 # POST_PROCESS_O: Post-processing for `.o' files.
958 # POST_PROCESS_A: Post-processing for `.a' files (currently null).
959 # POST_PROCESS_SO: Post-processing for `.so' files.
960 # POST_PROCESS: Post-processing for executable files (no suffix).
961 # Note that these macros are not completely generalized as they are to be
962 # used with the file name to be processed following.
963 #
964 # It is left as an exercise to Release Engineering to embellish the generation
965 # of the release comment string.
966 #
967 # If this is a standard development build:
968 # compress the comment section (mcs -c)
969 # add the standard comment (mcs -a $(RELEASE_CM))
970 # add the development specific comment (mcs -a $(DEV_CM))
971 #
972 # If this is an installation build:
973 # delete the comment section (mcs -d)
974 # add the standard comment (mcs -a $(RELEASE_CM))
975 # add the development specific comment (mcs -a $(DEV_CM))
976 #
977 # If this is an release build:
978 # delete the comment section (mcs -d)
979 # add the standard comment (mcs -a $(RELEASE_CM))
980 #
981 # The following list of macros are used in the definition of RELEASE_CM
982 # which is used to label all binaries in the build:
983 #
984 # RELEASE Specific release of the build, eg: 5.2
985 # RELEASE_MAJOR Major version number part of $(RELEASE)
986 # RELEASE_MINOR Minor version number part of $(RELEASE)
987 # VERSION Version of the build (alpha, beta, Generic)
988 # PATCHID If this is a patch this value should contain
989 # the patchid value (eg: "Generic 100832-01"), otherwise
990 # it will be set to $(VERSION)
991 # RELEASE_DATE Date of the Release Build
992 # PATCH_DATE Date the patch was created, if this is blank it
993 # will default to the RELEASE_DATE
994 #
995 RELEASE_MAJOR= 5
996 RELEASE_MINOR= 11
997 RELEASE= $(RELEASE_MAJOR).$(RELEASE_MINOR)
998 VERSION= SunOS Development
999 PATCHID= $(VERSION)
1000 RELEASE_DATE= release date not set
1001 PATCH_DATE= $(RELEASE_DATE)
1002 RELEASE_CM= "@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
1003 DEV_CM= "@($(POUND_SIGN))SunOS Internal Development: non-nightly build"
1004
1005 PROCESS_COMMENT= @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
1006 $(STRIP_COMMENTS)PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
1007 $(RELEASE_BUILD)PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM)
1008
1009 STRIP_STABS= :
1010 $(RELEASE_BUILD)STRIP_STABS= $(STRIP) -x $@
1011 $(SRCDBGBLD)STRIP_STABS= :
1012
1013 POST_PROCESS_O= $(PROCESS_COMMENT) $@
1014 POST_PROCESS_A=
1015 POST_PROCESS_SO= $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
1016 $(ELFSIGN_OBJECT)
1017 POST_PROCESS= $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
1018 $(ELFSIGN_OBJECT)
1019
1020 #
1021 # chk4ubin is a tool that inspects a module for a symbol table
1022 # ELF section size which can trigger an OBP bug on older platforms.
1023 # This problem affects only specific sun4u bootable modules.
1024 #
1025 CHK4UBIN= $(ONBLD_TOOLS)/bin/$(MACH)/chk4ubin
1026 CHK4UBINFLAGS=
1027 CHK4UBINARY= $(CHK4UBIN) $(CHK4UBINFLAGS) $@
1028
1029 #
1030 # PKGARCHIVE specifies the default location where packages should be
1031 # placed if built.
1032 #
1033 $(RELEASE_BUILD)PKGARCHIVESUFFIX= -nd
1034 PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
1035
1036 #
1037 # The repositories will be created with these publisher settings. To
1038 # update an image to the resulting repositories, this must match the
1039 # publisher name provided to "pkg set-publisher."
1040 #
1041 PKGPUBLISHER_REDIST= on-nightly
1042 PKGPUBLISHER_NONREDIST= on-extra
1043
1044 # Default build rules which perform comment section post-processing.
1045 #
1046 .c:
1047 $(LINK.c) -o $@ $< $(LDLIBS)
1048 $(POST_PROCESS)
1049 .c.o:
1050 $(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
1051 $(POST_PROCESS_O)
1052 .c.a:
1053 $(COMPILE.c) -o $% $<
1054 $(PROCESS_COMMENT) $%
1055 $(AR) $(ARFLAGS) $@ $%
1056 $(RM) $%
1057 .s.o:
1058 $(COMPILE.s) -o $@ $<
1059 $(POST_PROCESS_O)
1060 .s.a:
1061 $(COMPILE.s) -o $% $<
1062 $(PROCESS_COMMENT) $%
1063 $(AR) $(ARFLAGS) $@ $%
1064 $(RM) $%
1065 .cc:
1066 $(LINK.cc) -o $@ $< $(LDLIBS)
1067 $(POST_PROCESS)
1068 .cc.o:
1069 $(COMPILE.cc) $(OUTPUT_OPTION) $<
1070 $(POST_PROCESS_O)
1071 .cc.a:
1072 $(COMPILE.cc) -o $% $<
1073 $(AR) $(ARFLAGS) $@ $%
1074 $(PROCESS_COMMENT) $%
1075 $(RM) $%
1076 .y:
1077 $(YACC.y) $<
1078 $(LINK.c) -o $@ y.tab.c $(LDLIBS)
1079 $(POST_PROCESS)
1080 $(RM) y.tab.c
1081 .y.o:
1082 $(YACC.y) $<
1083 $(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
1084 $(POST_PROCESS_O)
1085 $(RM) y.tab.c
1086 .l:
1087 $(RM) $*.c
1088 $(LEX.l) $< > $*.c
1089 $(LINK.c) -o $@ $*.c -ll $(LDLIBS)
1090 $(POST_PROCESS)
1091 $(RM) $*.c
1092 .l.o:
1093 $(RM) $*.c
1094 $(LEX.l) $< > $*.c
1095 $(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
1096 $(POST_PROCESS_O)
1097 $(RM) $*.c
1098
1099 .bin.o:
1100 $(COMPILE.b) -o $@ $<
1101 $(POST_PROCESS_O)
1102
1103 .java.class:
1104 $(COMPILE.java) $<
1105
1106 # Bourne and Korn shell script message catalog build rules.
1107 # We extract all gettext strings with sed(1) (being careful to permit
1108 # multiple gettext strings on the same line), weed out the dups, and
1109 # build the catalogue with awk(1).
1110
1111 .sh.po .ksh.po:
1112 $(SED) -n -e ":a" \
1113 -e "h" \
1114 -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p" \
1115 -e "x" \
1116 -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/" \
1117 -e "t a" \
1118 $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1119
1120 #
1121 # Python and Perl executable and message catalog build rules.
1122 #
1123 .SUFFIXES: .pl .pm .py .pyc
1124
1125 .pl:
1126 $(RM) $@;
1127 $(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
1128 $(CHMOD) +x $@
1129
1130 .py:
1131 $(RM) $@; $(CAT) $< > $@; $(CHMOD) +x $@
1132
1133 .py.pyc:
1134 $(RM) $@
1135 $(PYTHON) -mpy_compile $<
1136 @[ $(<)c = $@ ] || $(MV) $(<)c $@
1137
1138 .py.po:
1139 $(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ;
1140
1141 .pl.po .pm.po:
1142 $(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
1143 $(RM) $@ ;
1144 $(SED) "/^domain/d" < $(<F).po > $@ ;
1145 $(RM) $(<F).po
1146
1147 #
1148 # When using xgettext, we want messages to go to the default domain,
1149 # rather than the specified one. This special version of the
1150 # COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1151 # causing xgettext to put all messages into the default domain.
1152 #
1153 CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1154
1155 .c.i:
1156 $(CPPFORPO) $< > $@
1157
1158 .h.i:
1159 $(CPPFORPO) $< > $@
1160
1161 .y.i:
1162 $(YACC) -d $<
1163 $(CPPFORPO) y.tab.c > $@
1164 $(RM) y.tab.c
1165
1166 .l.i:
1167 $(LEX) $<
1168 $(CPPFORPO) lex.yy.c > $@
1169 $(RM) lex.yy.c
1170
1171 .c.po:
1172 $(CPPFORPO) $< > $<.i
1173 $(BUILD.po)
1174
1175 .y.po:
1176 $(YACC) -d $<
1177 $(CPPFORPO) y.tab.c > $<.i
1178 $(BUILD.po)
1179 $(RM) y.tab.c
1180
1181 .l.po:
1182 $(LEX) $<
1183 $(CPPFORPO) lex.yy.c > $<.i
1184 $(BUILD.po)
1185 $(RM) lex.yy.c
1186
1187 #
1188 # Rules to perform stylistic checks
1189 #
1190 .SUFFIXES: .x .xml .check .xmlchk
1191
1192 .h.check:
1193 $(DOT_H_CHECK)
1194
1195 .x.check:
1196 $(DOT_X_CHECK)
1197
1198 .xml.xmlchk:
1199 $(MANIFEST_CHECK)
1200
1201 #
1202 # Rules to process ONC+ Source partial files
1203 #
1204 %_onc_plus: %
1205 @$(ECHO) "extracting code from $< ... "
1206 sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $< > $@
1207
1208 #
1209 # Include rules to render automated sccs get rules "safe".
1210 #
1211 include $(SRC)/Makefile.noget