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