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