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