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