xref: /illumos-gate/usr/src/Makefile.master (revision 993e3faf6a142ae3efdd24388883264c2b56bede)
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# Copyright 2016 Toomas Soome <tsoome@me.com>
30#
31
32#
33# Makefile.master, global definitions for system source
34#
35ROOT=		/proto
36
37#
38# Adjunct root, containing an additional proto area to be used for headers
39# and libraries.
40#
41ADJUNCT_PROTO=
42
43#
44# Adjunct for building things that run on the build machine.
45#
46NATIVE_ADJUNCT=	/usr
47
48#
49# RELEASE_BUILD should be cleared for final release builds.
50# NOT_RELEASE_BUILD is exactly what the name implies.
51#
52# __GNUC toggles the building of ON components using gcc and related tools.
53# Normally set to `#', set it to `' to do gcc build.
54#
55# The declaration POUND_SIGN is always '#'. This is needed to get around the
56# make feature that '#' is always a comment delimiter, even when escaped or
57# quoted. We use this macro expansion method to get POUND_SIGN rather than
58# always breaking out a shell because the general case can cause a noticable
59# slowdown in build times when so many Makefiles include Makefile.master.
60#
61# While the majority of users are expected to override the setting below
62# with an env file (via nightly or bldenv), if you aren't building that way
63# (ie, you're using "ws" or some other bootstrapping method) then you need
64# this definition in order to avoid the subshell invocation mentioned above.
65#
66
67PRE_POUND=				pre\#
68POUND_SIGN=				$(PRE_POUND:pre\%=%)
69
70NOT_RELEASE_BUILD=
71RELEASE_BUILD=				$(POUND_SIGN)
72$(RELEASE_BUILD)NOT_RELEASE_BUILD=	$(POUND_SIGN)
73PATCH_BUILD=				$(POUND_SIGN)
74
75# SPARC_BLD is '#' for an Intel build.
76# INTEL_BLD is '#' for a Sparc build.
77SPARC_BLD_1=    $(MACH:i386=$(POUND_SIGN))
78SPARC_BLD=      $(SPARC_BLD_1:sparc=)
79INTEL_BLD_1=    $(MACH:sparc=$(POUND_SIGN))
80INTEL_BLD=      $(INTEL_BLD_1:i386=)
81
82# The variables below control the compilers used during the build.
83# There are a number of permutations.
84#
85# __GNUC and __SUNC control (and indicate) the primary compiler.  Whichever
86# one is not POUND_SIGN is the primary, with the other as the shadow.  They
87# may also be used to control entirely compiler-specific Makefile assignments.
88# __GNUC and GCC are the default.
89#
90# __GNUC64 indicates that the 64bit build should use the GNU C compiler.
91# There is no Sun C analogue.
92#
93# The following version-specific options are operative regardless of which
94# compiler is primary, and control the versions of the given compilers to be
95# used.  They also allow compiler-version specific Makefile fragments.
96#
97
98__SUNC=			$(POUND_SIGN)
99$(__SUNC)__GNUC=	$(POUND_SIGN)
100__GNUC64=		$(__GNUC)
101
102# Allow build-time "configuration" to enable or disable some things.
103# The default is POUND_SIGN, meaning "not enabled". If the environment
104# passes in an override like ENABLE_SMB_PRINTING= (empty) that will
105# uncomment things in the lower Makefiles to enable the feature.
106ENABLE_IPP_PRINTING=	$(POUND_SIGN)
107ENABLE_SMB_PRINTING=	$(POUND_SIGN)
108
109# CLOSED is the root of the tree that contains source which isn't released
110# as open source
111CLOSED=		$(SRC)/../closed
112
113# BUILD_TOOLS is the root of all tools including compilers.
114# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
115
116BUILD_TOOLS=		/ws/onnv-tools
117ONBLD_TOOLS=		$(BUILD_TOOLS)/onbld
118
119# define runtime JAVA_HOME, primarily for cmd/pools/poold
120JAVA_HOME=	/usr/java
121# define buildtime JAVA_ROOT
122JAVA_ROOT=	/usr/java
123# define to build with JAVA 8
124BLD_JAVA_8=	$(POUND_SIGN)
125
126GCC_ROOT=	/opt/gcc/4.4.4
127GCCLIBDIR=	$(GCC_ROOT)/lib
128GCCLIBDIR64=	$(GCC_ROOT)/lib/$(MACH64)
129
130DOCBOOK_XSL_ROOT=	/usr/share/sgml/docbook/xsl-stylesheets
131
132RPCGEN=		/usr/bin/rpcgen
133STABS=		$(ONBLD_TOOLS)/bin/$(MACH)/stabs
134ELFEXTRACT=	$(ONBLD_TOOLS)/bin/$(MACH)/elfextract
135MBH_PATCH=	$(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch
136BTXLD=		$(ONBLD_TOOLS)/bin/$(MACH)/btxld
137ECHO=		echo
138INS=		install
139TRUE=		true
140SYMLINK=	/usr/bin/ln -s
141LN=		/usr/bin/ln
142CHMOD=		/usr/bin/chmod
143MV=		/usr/bin/mv -f
144RM=		/usr/bin/rm -f
145CUT=		/usr/bin/cut
146NM=		/usr/ccs/bin/nm
147DIFF=		/usr/bin/diff
148GREP=		/usr/bin/grep
149EGREP=		/usr/bin/egrep
150ELFWRAP=	/usr/bin/elfwrap
151KSH93=		/usr/bin/ksh93
152SED=		/usr/bin/sed
153AWK=		/usr/bin/nawk
154CP=		/usr/bin/cp -f
155MCS=		/usr/ccs/bin/mcs
156CAT=            /usr/bin/cat
157ELFDUMP=	/usr/ccs/bin/elfdump
158M4=		/usr/bin/m4
159STRIP=		/usr/ccs/bin/strip
160LEX=		/usr/ccs/bin/lex
161FLEX=		/usr/bin/flex
162YACC=		/usr/ccs/bin/yacc
163CPP=		/usr/lib/cpp
164JAVAC=		$(JAVA_ROOT)/bin/javac
165JAVAH=		$(JAVA_ROOT)/bin/javah
166JAVADOC=	$(JAVA_ROOT)/bin/javadoc
167RMIC=		$(JAVA_ROOT)/bin/rmic
168JAR=		$(JAVA_ROOT)/bin/jar
169CTFCONVERT=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
170CTFMERGE=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
171CTFSTABS=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
172CTFSTRIP=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstrip
173NDRGEN=		$(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
174GENOFFSETS=	$(ONBLD_TOOLS)/bin/genoffsets
175XREF=		$(ONBLD_TOOLS)/bin/xref
176FIND=		/usr/bin/find
177PERL=		/usr/bin/perl
178PERL_VERSION=	5.10.0
179PERL_PKGVERS=	-510
180PERL_ARCH =		i86pc-solaris-64int
181$(SPARC_BLD)PERL_ARCH =	sun4-solaris-64int
182PYTHON_VERSION=	2.7
183PYTHON_PKGVERS=	-27
184PYTHON=		/usr/bin/python$(PYTHON_VERSION)
185SORT=		/usr/bin/sort
186TOUCH=		/usr/bin/touch
187WC=		/usr/bin/wc
188XARGS=		/usr/bin/xargs
189ELFEDIT=	/usr/bin/elfedit
190ELFSIGN=	/usr/bin/elfsign
191DTRACE=		/usr/sbin/dtrace -xnolibs
192UNIQ=		/usr/bin/uniq
193TAR=		/usr/bin/tar
194ASTBINDIR=	/usr/ast/bin
195MSGCC=		$(ASTBINDIR)/msgcc
196MSGFMT=		/usr/bin/msgfmt -s
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@:\#!$(PYTHON):" < $< > $@; $(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=	-m32
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@:\#!$(PYTHON):" < $< > $@; $(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