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