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