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