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