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