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