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