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