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