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