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