xref: /illumos-gate/usr/src/Makefile.master (revision 0f36b8433e9a3e3d3803c54bad5be5de92aec546)
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# CLOSED_BUILD controls whether we try to build files under
41# usr/closed.  ("" means to build closed code, "#" means don't try to
42# build it.)  Skipping the closed code implies doing an export release
43# build.
44#
45# STRIP_COMMENTS toggles comment section striping. Generally the same setting
46# as INTERNAL_RELEASE_BUILD.
47#
48# __GNUC toggles the building of ON components using gcc and related tools.
49# Normally set to `#', set it to `' to do gcc build.
50#
51# The declaration POUND_SIGN is always '#'. This is needed to get around the
52# make feature that '#' is always a comment delimiter, even when escaped or
53# quoted. We use this macro expansion method to get POUND_SIGN rather than
54# always breaking out a shell because the general case can cause a noticable
55# slowdown in build times when so many Makefiles include Makefile.master.
56#
57# While the majority of users are expected to override the setting below
58# with an env file (via nightly or bldenv), if you aren't building that way
59# (ie, you're using "ws" or some other bootstrapping method) then you need
60# this definition in order to avoid the subshell invocation mentioned above.
61#
62
63PRE_POUND=				pre\#
64POUND_SIGN=				$(PRE_POUND:pre\%=%)
65
66NOT_RELEASE_BUILD=
67INTERNAL_RELEASE_BUILD=			$(POUND_SIGN)
68RELEASE_BUILD=				$(POUND_SIGN)
69$(RELEASE_BUILD)NOT_RELEASE_BUILD=	$(POUND_SIGN)
70$(RELEASE_BUILD)INTERNAL_RELEASE_BUILD=
71PATCH_BUILD=				$(POUND_SIGN)
72
73# If CLOSED_IS_PRESENT is not set, assume the closed tree is present.
74CLOSED_BUILD_1=	$(CLOSED_IS_PRESENT:yes=)
75CLOSED_BUILD=	$(CLOSED_BUILD_1:no=$(POUND_SIGN))
76
77# SPARC_BLD is '#' for an Intel build.
78# INTEL_BLD is '#' for a Sparc build.
79SPARC_BLD_1=    $(MACH:i386=$(POUND_SIGN))
80SPARC_BLD=      $(SPARC_BLD_1:sparc=)
81INTEL_BLD_1=    $(MACH:sparc=$(POUND_SIGN))
82INTEL_BLD=      $(INTEL_BLD_1:i386=)
83
84STRIP_COMMENTS=	$(INTERNAL_RELEASE_BUILD)
85
86# Are we building tonic closedbins? Unless you have used the
87# -O flag to nightly or bldenv, leave the definition of TONICBUILD
88# as $(POUND_SIGN).
89#
90# IF YOU CHANGE CLOSEDROOT, you MUST change install.bin
91# to match the new definition.
92TONICBUILD=     $(POUND_SIGN)
93$(TONICBUILD)CLOSEDROOT= $(ROOT)-closed
94
95
96# The variables below control the compilers used during the build.
97# There are a number of permutations.
98#
99# __GNUC and __SUNC control (and indicate) the primary compiler.  Whichever
100# one is not POUND_SIGN is the primary, with the other as the shadow.  They
101# may also be used to control entirely compiler-specific Makefile assignments.
102# __SUNC and Sun Studio are the default.
103#
104# __GNUC64 indicates that the 64bit build should use the GNU C compiler.
105# There is no Sun C analogue.
106#
107# The following version-specific options are operative regardless of which
108# compiler is primary, and control the versions of the given compilers to be
109# used.  They also allow compiler-version specific Makefile fragments.
110#
111
112__GNUC=			$(POUND_SIGN)
113$(__GNUC)__SUNC=	$(POUND_SIGN)
114__GNUC64=		$(__GNUC)
115
116# CLOSED is the root of the tree that contains source which isn't released
117# as open source
118CLOSED=		$(SRC)/../closed
119
120# BUILD_TOOLS is the root of all tools including compilers.
121# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
122
123BUILD_TOOLS=		/ws/onnv-tools
124ONBLD_TOOLS=		$(BUILD_TOOLS)/onbld
125
126JAVA_ROOT=	/usr/java
127
128SFW_ROOT=	/usr/sfw
129SFWINCDIR=	$(SFW_ROOT)/include
130SFWLIBDIR=	$(SFW_ROOT)/lib
131SFWLIBDIR64=	$(SFW_ROOT)/lib/$(MACH64)
132
133GCC_ROOT=	/opt/gcc/4.4.4
134GCCLIBDIR=	$(GCC_ROOT)/lib
135GCCLIBDIR64=	$(GCC_ROOT)/lib/$(MACH64)
136
137DOCBOOK_XSL_ROOT=	/usr/share/sgml/docbook/xsl-stylesheets
138
139RPCGEN=		/usr/bin/rpcgen
140STABS=		$(ONBLD_TOOLS)/bin/$(MACH)/stabs
141ELFEXTRACT=	$(ONBLD_TOOLS)/bin/$(MACH)/elfextract
142MBH_PATCH=	$(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch
143ECHO=		echo
144INS=		install
145TRUE=		true
146SYMLINK=	/usr/bin/ln -s
147LN=		/usr/bin/ln
148CHMOD=		/usr/bin/chmod
149MV=		/usr/bin/mv -f
150RM=		/usr/bin/rm -f
151CUT=		/usr/bin/cut
152NM=		/usr/ccs/bin/nm
153DIFF=		/usr/bin/diff
154GREP=		/usr/bin/grep
155EGREP=		/usr/bin/egrep
156ELFWRAP=	/usr/bin/elfwrap
157KSH93=		/usr/bin/ksh93
158SED=		/usr/bin/sed
159NAWK=		/usr/bin/nawk
160CP=		/usr/bin/cp -f
161MCS=		/usr/ccs/bin/mcs
162CAT=            /usr/bin/cat
163ELFDUMP=	/usr/ccs/bin/elfdump
164M4=		/usr/ccs/bin/m4
165STRIP=		/usr/ccs/bin/strip
166LEX=		/usr/ccs/bin/lex
167FLEX=		$(SFW_ROOT)/bin/flex
168YACC=		/usr/ccs/bin/yacc
169CPP=		/usr/lib/cpp
170JAVAC=		$(JAVA_ROOT)/bin/javac
171JAVAH=		$(JAVA_ROOT)/bin/javah
172JAVADOC=	$(JAVA_ROOT)/bin/javadoc
173RMIC=		$(JAVA_ROOT)/bin/rmic
174JAR=		$(JAVA_ROOT)/bin/jar
175CTFCONVERT=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
176CTFMERGE=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
177CTFSTABS=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
178CTFSTRIP=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstrip
179NDRGEN=		$(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
180GENOFFSETS=	$(ONBLD_TOOLS)/bin/genoffsets
181CTFCVTPTBL=	$(ONBLD_TOOLS)/bin/ctfcvtptbl
182CTFFINDMOD=	$(ONBLD_TOOLS)/bin/ctffindmod
183XREF=		$(ONBLD_TOOLS)/bin/xref
184FIND=		/usr/bin/find
185PERL=		/usr/bin/perl
186PYTHON_26=	/usr/bin/python2.6
187PYTHON=		$(PYTHON_26)
188SORT=		/usr/bin/sort
189TOUCH=		/usr/bin/touch
190WC=		/usr/bin/wc
191XARGS=		/usr/bin/xargs
192ELFEDIT=	/usr/bin/elfedit
193ELFSIGN=	/usr/bin/elfsign
194DTRACE=		/usr/sbin/dtrace -xnolibs
195UNIQ=		/usr/bin/uniq
196TAR=		/usr/bin/tar
197
198FILEMODE=	644
199DIRMODE=	755
200
201#
202# The version of the patch makeup table optimized for build-time use.  Used
203# during patch builds only.
204$(PATCH_BUILD)PMTMO_FILE=$(SRC)/patch_makeup_table.mo
205
206# Declare that nothing should be built in parallel.
207# Individual Makefiles can use the .PARALLEL target to declare otherwise.
208.NO_PARALLEL:
209
210# For stylistic checks
211#
212# Note that the X and C checks are not used at this time and may need
213# modification when they are actually used.
214#
215CSTYLE=		$(ONBLD_TOOLS)/bin/cstyle
216CSTYLE_TAIL=
217HDRCHK=		$(ONBLD_TOOLS)/bin/hdrchk
218HDRCHK_TAIL=
219JSTYLE=		$(ONBLD_TOOLS)/bin/jstyle
220
221DOT_H_CHECK=	\
222	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
223	$(HDRCHK) $< $(HDRCHK_TAIL)
224
225DOT_X_CHECK=	\
226	@$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
227	$(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
228
229DOT_C_CHECK=	\
230	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
231
232MANIFEST_CHECK=	\
233	@$(ECHO) "checking $<"; \
234	SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
235	SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
236	SVCCFG_CONFIGD_PATH=$(SRC)/cmd/svc/configd/svc.configd-native \
237	$(SRC)/cmd/svc/svccfg/svccfg-native validate $<
238
239#
240# IMPORTANT:: If you change any of INS.file, INS.dir, INS.rename,
241# INS.link or INS.symlink here, then you must also change the
242# corresponding override definitions in $CLOSED/Makefile.tonic.
243# If you do not do this, then the closedbins build for the OpenSolaris
244# community will break. PS, the gatekeepers will be upset too.
245INS.file=	$(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
246INS.dir=	$(INS) -s -d -m $(DIRMODE) $@
247# installs and renames at once
248#
249INS.rename=	$(INS.file); $(MV) $(@D)/$(<F) $@
250
251# install a link
252INSLINKTARGET=	$<
253INS.link=	$(RM) $@; $(LN) $(INSLINKTARGET) $@
254INS.symlink=	$(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
255
256#
257# Python bakes the mtime of the .py file into the compiled .pyc and
258# rebuilds if the baked-in mtime != the mtime of the source file
259# (rather than only if it's less than), thus when installing python
260# files we must make certain to not adjust the mtime of the source
261# (.py) file.
262#
263INS.pyfile=	$(INS.file); $(TOUCH) -r $< $@
264
265# MACH must be set in the shell environment per uname -p on the build host
266# More specific architecture variables should be set in lower makefiles.
267#
268# MACH64 is derived from MACH, and BUILD64 is set to `#' for
269# architectures on which we do not build 64-bit versions.
270# (There are no such architectures at the moment.)
271#
272# Set BUILD64=# in the environment to disable 64-bit amd64
273# builds on i386 machines.
274
275MACH64_1=	$(MACH:sparc=sparcv9)
276MACH64=		$(MACH64_1:i386=amd64)
277
278MACH32_1=	$(MACH:sparc=sparcv7)
279MACH32=		$(MACH32_1:i386=i86)
280
281sparc_BUILD64=
282i386_BUILD64=
283BUILD64=	$($(MACH)_BUILD64)
284
285#
286# C compiler mode. Future compilers may change the default on us,
287# so force extended ANSI mode globally. Lower level makefiles can
288# override this by setting CCMODE.
289#
290CCMODE=			-Xa
291CCMODE64=		-Xa
292
293#
294# C compiler verbose mode. This is so we can enable it globally,
295# but turn it off in the lower level makefiles of things we cannot
296# (or aren't going to) fix.
297#
298CCVERBOSE=		-v
299
300# set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings
301# from the compiler about places the -xarch=v9 may differ from -xarch=v9c.
302V9ABIWARN=
303
304# set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register
305# symbols (used to detect conflicts between objects that use global registers)
306# we disable this now for safety, and because genunix doesn't link with
307# this feature (the v9 default) enabled.
308#
309# REGSYM is separate since the C++ driver syntax is different.
310CCREGSYM=		-Wc,-Qiselect-regsym=0
311CCCREGSYM=		-Qoption cg -Qiselect-regsym=0
312
313# Prevent the removal of static symbols by the SPARC code generator (cg).
314# The x86 code generator (ube) does not remove such symbols and as such
315# using this workaround is not applicable for x86.
316#
317CCSTATICSYM=		-Wc,-Qassembler-ounrefsym=0
318#
319# generate 32-bit addresses in the v9 kernel. Saves memory.
320CCABS32=		-Wc,-xcode=abs32
321#
322# generate v9 code which tolerates callers using the v7 ABI, for the sake of
323# system calls.
324CC32BITCALLERS=		-_gcc=-massume-32bit-callers
325
326# GCC, especially, is increasingly beginning to auto-inline functions and
327# sadly does so separately not under the general -fno-inline-functions
328# Additionally, we wish to prevent optimisations which cause GCC to clone
329# functions -- in particular, these may cause unhelpful symbols to be
330# emitted instead of function names
331CCNOAUTOINLINE= -_gcc=-fno-inline-small-functions \
332	-_gcc=-fno-inline-functions-called-once \
333	-_gcc=-fno-ipa-cp
334
335# One optimization the compiler might perform is to turn this:
336#	#pragma weak foo
337#	extern int foo;
338#	if (&foo)
339#		foo = 5;
340# into
341#	foo = 5;
342# Since we do some of this (foo might be referenced in common kernel code
343# but provided only for some cpu modules or platforms), we disable this
344# optimization.
345#
346sparc_CCUNBOUND	= -Wd,-xsafe=unboundsym
347i386_CCUNBOUND	=
348CCUNBOUND	= $($(MACH)_CCUNBOUND)
349
350#
351# compiler '-xarch' flag. This is here to centralize it and make it
352# overridable for testing.
353sparc_XARCH=	-m32
354sparcv9_XARCH=	-m64
355i386_XARCH=
356amd64_XARCH=	-m64 -Ui386 -U__i386
357
358# assembler '-xarch' flag.  Different from compiler '-xarch' flag.
359sparc_AS_XARCH=		-xarch=v8plus
360sparcv9_AS_XARCH=	-xarch=v9
361i386_AS_XARCH=
362amd64_AS_XARCH=		-xarch=amd64 -P -Ui386 -U__i386
363
364#
365# These flags define what we need to be 'standalone' i.e. -not- part
366# of the rather more cosy userland environment.  This basically means
367# the kernel.
368#
369# XX64	future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
370#
371sparc_STAND_FLAGS=	-_gcc=-ffreestanding
372sparcv9_STAND_FLAGS=	-_gcc=-ffreestanding
373# Disabling MMX also disables 3DNow, disabling SSE also disables all later
374# additions to SSE (SSE2, AVX ,etc.)
375NO_SIMD=		-_gcc=-mno-mmx -_gcc=-mno-sse
376i386_STAND_FLAGS=	-_gcc=-ffreestanding $(NO_SIMD)
377amd64_STAND_FLAGS=	-xmodel=kernel $(NO_SIMD)
378
379SAVEARGS=		-Wu,-save_args
380amd64_STAND_FLAGS	+= $(SAVEARGS)
381
382STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
383STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
384
385#
386# disable the incremental linker
387ILDOFF=			-xildoff
388#
389XDEPEND=		-xdepend
390XFFLAG=			-xF=%all
391XESS=			-xs
392XSTRCONST=		-xstrconst
393
394#
395# turn warnings into errors (C)
396CERRWARN = -errtags=yes -errwarn=%all
397CERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT
398CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
399
400CERRWARN += -_gcc=-Wno-missing-braces
401CERRWARN += -_gcc=-Wno-sign-compare
402CERRWARN += -_gcc=-Wno-unknown-pragmas
403CERRWARN += -_gcc=-Wno-unused-parameter
404CERRWARN += -_gcc=-Wno-missing-field-initializers
405
406# Unfortunately, this option can misfire very easily and unfixably.
407CERRWARN +=	-_gcc=-Wno-array-bounds
408
409# DEBUG v. -nd make for frequent unused variables, empty conditions, etc. in
410# -nd builds
411$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused
412$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-empty-body
413
414#
415# turn warnings into errors (C++)
416CCERRWARN=		-xwe
417
418# C99 mode
419C99_ENABLE=	-xc99=%all
420C99_DISABLE=	-xc99=%none
421C99MODE=	$(C99_DISABLE)
422C99LMODE=	$(C99MODE:-xc99%=-Xc99%)
423
424# In most places, assignments to these macros should be appended with +=
425# (CPPFLAGS.master allows values to be prepended to CPPFLAGS).
426sparc_CFLAGS=	$(sparc_XARCH) $(CCSTATICSYM)
427sparcv9_CFLAGS=	$(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM) \
428		$(CCSTATICSYM)
429i386_CFLAGS=	$(i386_XARCH)
430amd64_CFLAGS=	$(amd64_XARCH)
431
432sparc_ASFLAGS=	$(sparc_AS_XARCH)
433sparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
434i386_ASFLAGS=	$(i386_AS_XARCH)
435amd64_ASFLAGS=	$(amd64_AS_XARCH)
436
437#
438sparc_COPTFLAG=		-xO3
439sparcv9_COPTFLAG=	-xO3
440i386_COPTFLAG=		-O
441amd64_COPTFLAG=		-xO3
442
443COPTFLAG= $($(MACH)_COPTFLAG)
444COPTFLAG64= $($(MACH64)_COPTFLAG)
445
446# When -g is used, the compiler globalizes static objects
447# (gives them a unique prefix). Disable that.
448CNOGLOBAL= -W0,-noglobal
449
450# Direct the Sun Studio compiler to use a static globalization prefix based on the
451# name of the module rather than something unique. Otherwise, objects
452# will not build deterministically, as subsequent compilations of identical
453# source will yeild objects that always look different.
454#
455# In the same spirit, this will also remove the date from the N_OPT stab.
456CGLOBALSTATIC= -W0,-xglobalstatic
457
458# Sometimes we want all symbols and types in debugging information even
459# if they aren't used.
460CALLSYMS=	-W0,-xdbggen=no%usedonly
461
462#
463# Default debug format for Sun Studio 11 is dwarf, so force it to
464# generate stabs.
465#
466DEBUGFORMAT=	-xdebugformat=stabs
467
468#
469# Flags used to build in debug mode for ctf generation.  Bugs in the Devpro
470# compilers currently prevent us from building with cc-emitted DWARF.
471#
472CTF_FLAGS_sparc	= -g -Wc,-Qiselect-T1 $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
473CTF_FLAGS_i386	= -g $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
474
475CTF_FLAGS_sparcv9	= $(CTF_FLAGS_sparc)
476CTF_FLAGS_amd64		= $(CTF_FLAGS_i386)
477
478# Sun Studio produces broken userland code when saving arguments.
479$(__GNUC)CTF_FLAGS_amd64 += $(SAVEARGS)
480
481CTF_FLAGS_32	= $(CTF_FLAGS_$(MACH)) $(DEBUGFORMAT)
482CTF_FLAGS_64	= $(CTF_FLAGS_$(MACH64)) $(DEBUGFORMAT)
483CTF_FLAGS	= $(CTF_FLAGS_32)
484
485#
486# Flags used with genoffsets
487#
488GOFLAGS = -_noecho \
489	$(CALLSYMS) \
490	$(CDWARFSTR)
491
492OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
493	$(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
494
495OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
496	$(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
497
498#
499# tradeoff time for space (smaller is better)
500#
501sparc_SPACEFLAG		= -xspace -W0,-Lt
502sparcv9_SPACEFLAG	= -xspace -W0,-Lt
503i386_SPACEFLAG		= -xspace
504amd64_SPACEFLAG		=
505
506SPACEFLAG		= $($(MACH)_SPACEFLAG)
507SPACEFLAG64		= $($(MACH64)_SPACEFLAG)
508
509#
510# The Sun Studio 11 compiler has changed the behaviour of integer
511# wrap arounds and so a flag is needed to use the legacy behaviour
512# (without this flag panics/hangs could be exposed within the source).
513#
514sparc_IROPTFLAG		= -W2,-xwrap_int
515sparcv9_IROPTFLAG	= -W2,-xwrap_int
516i386_IROPTFLAG		=
517amd64_IROPTFLAG		=
518
519IROPTFLAG		= $($(MACH)_IROPTFLAG)
520IROPTFLAG64		= $($(MACH64)_IROPTFLAG)
521
522sparc_XREGSFLAG		= -xregs=no%appl
523sparcv9_XREGSFLAG	= -xregs=no%appl
524i386_XREGSFLAG		=
525amd64_XREGSFLAG		=
526
527XREGSFLAG		= $($(MACH)_XREGSFLAG)
528XREGSFLAG64		= $($(MACH64)_XREGSFLAG)
529
530# dmake SOURCEDEBUG=yes ... enables source-level debugging information, and
531# avoids stripping it.
532SOURCEDEBUG	= $(POUND_SIGN)
533SRCDBGBLD	= $(SOURCEDEBUG:yes=)
534
535#
536# These variables are intended ONLY for use by developers to safely pass extra
537# flags to the compilers without unintentionally overriding Makefile-set
538# flags.  They should NEVER be set to any value in a Makefile.
539#
540# They come last in the associated FLAGS variable such that they can
541# explicitly override things if necessary, there are gaps in this, but it's
542# the best we can manage.
543#
544CUSERFLAGS		=
545CUSERFLAGS64		= $(CUSERFLAGS)
546CCUSERFLAGS		=
547CCUSERFLAGS64		= $(CCUSERFLAGS)
548
549CSOURCEDEBUGFLAGS	=
550CCSOURCEDEBUGFLAGS	=
551$(SRCDBGBLD)CSOURCEDEBUGFLAGS	= -g -xs
552$(SRCDBGBLD)CCSOURCEDEBUGFLAGS	= -g -xs
553
554CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
555		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \
556		$(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
557		$(CUSERFLAGS)
558CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
559		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \
560		$(CGLOBALSTATIC) $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
561		$(CUSERFLAGS64)
562#
563# Flags that are used to build parts of the code that are subsequently
564# run on the build machine (also known as the NATIVE_BUILD).
565#
566NATIVE_CFLAGS=	$(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
567		$(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \
568		$(IROPTFLAG) $(CGLOBALSTATIC) $(CCNOAUTOINLINE) \
569		$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
570
571DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"	# For messaging.
572DTS_ERRNO=-D_TS_ERRNO
573CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
574	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
575CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
576CPPFLAGS=	$(CPPFLAGS.master)
577AS_CPPFLAGS=	$(CPPFLAGS.master)
578JAVAFLAGS=	-deprecation
579
580#
581# For source message catalogue
582#
583.SUFFIXES: $(SUFFIXES) .i .po
584MSGROOT= $(ROOT)/catalog
585MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
586MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
587DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
588DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
589
590CLOBBERFILES += $(POFILE) $(POFILES)
591COMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
592XGETTEXT= /usr/bin/xgettext
593XGETFLAGS= -c TRANSLATION_NOTE
594GNUXGETTEXT= /usr/gnu/bin/xgettext
595GNUXGETFLAGS= --add-comments=TRANSLATION_NOTE --keyword=_ \
596	--strict --no-location --omit-header
597BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
598	$(RM)	$@ ;\
599	$(SED) "/^domain/d" < $(<F).po > $@ ;\
600	$(RM) $(<F).po $<.i
601
602#
603# This is overwritten by local Makefile when PROG is a list.
604#
605POFILE= $(PROG).po
606
607sparc_CCFLAGS=		-cg92 -compat=4 \
608			-Qoption ccfe -messages=no%anachronism \
609			$(CCERRWARN)
610sparcv9_CCFLAGS=	$(sparcv9_XARCH) -dalign -compat=5 \
611			-Qoption ccfe -messages=no%anachronism \
612			-Qoption ccfe -features=no%conststrings \
613			$(CCCREGSYM) \
614			$(CCERRWARN)
615i386_CCFLAGS=		-compat=4 \
616			-Qoption ccfe -messages=no%anachronism \
617			-Qoption ccfe -features=no%conststrings \
618			$(CCERRWARN)
619amd64_CCFLAGS=		$(amd64_XARCH) -compat=5 \
620			-Qoption ccfe -messages=no%anachronism \
621			-Qoption ccfe -features=no%conststrings \
622			$(CCERRWARN)
623
624sparc_CCOPTFLAG=	-O
625sparcv9_CCOPTFLAG=	-O
626i386_CCOPTFLAG=		-O
627amd64_CCOPTFLAG=	-O
628
629CCOPTFLAG=	$($(MACH)_CCOPTFLAG)
630CCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
631CCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
632		$(CCUSERFLAGS)
633CCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
634		$(CCUSERFLAGS64)
635
636#
637#
638#
639ELFWRAP_FLAGS	=
640ELFWRAP_FLAGS64	=	-64
641
642#
643# Various mapfiles that are used throughout the build, and delivered to
644# /usr/lib/ld.
645#
646MAPFILE.NED_i386 =	$(SRC)/common/mapfiles/common/map.noexdata
647MAPFILE.NED_sparc =
648MAPFILE.NED =		$(MAPFILE.NED_$(MACH))
649MAPFILE.PGA =		$(SRC)/common/mapfiles/common/map.pagealign
650MAPFILE.NES =		$(SRC)/common/mapfiles/common/map.noexstk
651MAPFILE.FLT =		$(SRC)/common/mapfiles/common/map.filter
652MAPFILE.LEX =		$(SRC)/common/mapfiles/common/map.lex.yy
653
654#
655# Generated mapfiles that are compiler specific, and used throughout the
656# build.  These mapfiles are not delivered in /usr/lib/ld.
657#
658MAPFILE.NGB_sparc=	$(SRC)/common/mapfiles/gen/sparc_cc_map.noexeglobs
659$(__GNUC64)MAPFILE.NGB_sparc= \
660			$(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
661MAPFILE.NGB_sparcv9=	$(SRC)/common/mapfiles/gen/sparcv9_cc_map.noexeglobs
662$(__GNUC64)MAPFILE.NGB_sparcv9= \
663			$(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
664MAPFILE.NGB_i386=	$(SRC)/common/mapfiles/gen/i386_cc_map.noexeglobs
665$(__GNUC64)MAPFILE.NGB_i386= \
666			$(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
667MAPFILE.NGB_amd64=	$(SRC)/common/mapfiles/gen/amd64_cc_map.noexeglobs
668$(__GNUC64)MAPFILE.NGB_amd64= \
669			$(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
670MAPFILE.NGB =		$(MAPFILE.NGB_$(MACH))
671
672#
673# A generic interface mapfile name, used by various dynamic objects to define
674# the interfaces and interposers the object must export.
675#
676MAPFILE.INT =		mapfile-intf
677
678#
679# LDLIBS32 can be set in the environment to override the following assignment.
680# LDLIBS64 can be set to override the assignment made in Makefile.master.64.
681# These environment settings make sure that no libraries are searched outside
682# of the local workspace proto area:
683#	LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
684#	LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
685#
686LDLIBS32 =	$(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
687LDLIBS.cmd = 	$(LDLIBS32)
688LDLIBS.lib =	$(LDLIBS32)
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) -R$(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=		$(SFW_ROOT)
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$(SRCDBGBLD)CTFCVTFLAGS 	+= -g
912
913#
914# Override to pass module-specific flags to ctfmerge.  Currently used only by
915# krtld to turn on fuzzy matching, and source-level debugging to inhibit
916# stripping.
917#
918CTFMRGFLAGS=
919$(SRCDBGBLD)CTFMRGFLAGS 	+= -g
920
921
922CTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
923
924ELFSIGN_O=	$(TRUE)
925ELFSIGN_CRYPTO=	$(ELFSIGN_O)
926ELFSIGN_OBJECT=	$(ELFSIGN_O)
927
928# Rules (normally from make.rules) and macros which are used for post
929# processing files. Normally, these do stripping of the comment section
930# automatically.
931#    RELEASE_CM:	Should be editted to reflect the release.
932#    POST_PROCESS_O:	Post-processing for `.o' files.
933#    POST_PROCESS_A:	Post-processing for `.a' files (currently null).
934#    POST_PROCESS_SO:	Post-processing for `.so' files.
935#    POST_PROCESS:	Post-processing for executable files (no suffix).
936# Note that these macros are not completely generalized as they are to be
937# used with the file name to be processed following.
938#
939# It is left as an exercise to Release Engineering to embellish the generation
940# of the release comment string.
941#
942#	If this is a standard development build:
943#		compress the comment section (mcs -c)
944#		add the standard comment (mcs -a $(RELEASE_CM))
945#		add the development specific comment (mcs -a $(DEV_CM))
946#
947#	If this is an installation build:
948#		delete the comment section (mcs -d)
949#		add the standard comment (mcs -a $(RELEASE_CM))
950#		add the development specific comment (mcs -a $(DEV_CM))
951#
952#	If this is an release build:
953#		delete the comment section (mcs -d)
954#		add the standard comment (mcs -a $(RELEASE_CM))
955#
956# The following list of macros are used in the definition of RELEASE_CM
957# which is used to label all binaries in the build:
958#
959# 	RELEASE		Specific release of the build, eg: 5.2
960#	RELEASE_MAJOR	Major version number part of $(RELEASE)
961#	RELEASE_MINOR	Minor version number part of $(RELEASE)
962#	VERSION		Version of the build (alpha, beta, Generic)
963#	PATCHID		If this is a patch this value should contain
964#			the patchid value (eg: "Generic 100832-01"), otherwise
965#			it will be set to $(VERSION)
966#	RELEASE_DATE	Date of the Release Build
967#	PATCH_DATE	Date the patch was created, if this is blank it
968#			will default to the RELEASE_DATE
969#
970RELEASE_MAJOR=	5
971RELEASE_MINOR=	11
972RELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
973VERSION=	SunOS Development
974PATCHID=	$(VERSION)
975RELEASE_DATE=	release date not set
976PATCH_DATE=	$(RELEASE_DATE)
977RELEASE_CM=	"@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
978DEV_CM=		"@($(POUND_SIGN))SunOS Internal Development: non-nightly build"
979
980PROCESS_COMMENT=		   @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
981$(STRIP_COMMENTS)PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
982$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
983
984STRIP_STABS=			   :
985$(RELEASE_BUILD)STRIP_STABS=	   $(STRIP) -x $@
986$(SRCDBGBLD)STRIP_STABS=	   :
987
988POST_PROCESS_O=		$(PROCESS_COMMENT) $@
989POST_PROCESS_A=
990POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
991			$(ELFSIGN_OBJECT)
992POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
993			$(ELFSIGN_OBJECT)
994
995#
996# chk4ubin is a tool that inspects a module for a symbol table
997# ELF section size which can trigger an OBP bug on older platforms.
998# This problem affects only specific sun4u bootable modules.
999#
1000CHK4UBIN=	$(ONBLD_TOOLS)/bin/$(MACH)/chk4ubin
1001CHK4UBINFLAGS=
1002CHK4UBINARY=	$(CHK4UBIN) $(CHK4UBINFLAGS) $@
1003
1004#
1005# PKGARCHIVE specifies the default location where packages should be
1006# placed if built.
1007#
1008$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
1009PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
1010
1011#
1012# The repositories will be created with these publisher settings.  To
1013# update an image to the resulting repositories, this must match the
1014# publisher name provided to "pkg set-publisher."
1015#
1016PKGPUBLISHER_REDIST=	on-nightly
1017PKGPUBLISHER_NONREDIST=	on-extra
1018
1019#	Default build rules which perform comment section post-processing.
1020#
1021.c:
1022	$(LINK.c) -o $@ $< $(LDLIBS)
1023	$(POST_PROCESS)
1024.c.o:
1025	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
1026	$(POST_PROCESS_O)
1027.c.a:
1028	$(COMPILE.c) -o $% $<
1029	$(PROCESS_COMMENT) $%
1030	$(AR) $(ARFLAGS) $@ $%
1031	$(RM) $%
1032.s.o:
1033	$(COMPILE.s) -o $@ $<
1034	$(POST_PROCESS_O)
1035.s.a:
1036	$(COMPILE.s) -o $% $<
1037	$(PROCESS_COMMENT) $%
1038	$(AR) $(ARFLAGS) $@ $%
1039	$(RM) $%
1040.cc:
1041	$(LINK.cc) -o $@ $< $(LDLIBS)
1042	$(POST_PROCESS)
1043.cc.o:
1044	$(COMPILE.cc) $(OUTPUT_OPTION) $<
1045	$(POST_PROCESS_O)
1046.cc.a:
1047	$(COMPILE.cc) -o $% $<
1048	$(AR) $(ARFLAGS) $@ $%
1049	$(PROCESS_COMMENT) $%
1050	$(RM) $%
1051.y:
1052	$(YACC.y) $<
1053	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
1054	$(POST_PROCESS)
1055	$(RM) y.tab.c
1056.y.o:
1057	$(YACC.y) $<
1058	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
1059	$(POST_PROCESS_O)
1060	$(RM) y.tab.c
1061.l:
1062	$(RM) $*.c
1063	$(LEX.l) $< > $*.c
1064	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
1065	$(POST_PROCESS)
1066	$(RM) $*.c
1067.l.o:
1068	$(RM) $*.c
1069	$(LEX.l) $< > $*.c
1070	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
1071	$(POST_PROCESS_O)
1072	$(RM) $*.c
1073
1074.bin.o:
1075	$(COMPILE.b) -o $@ $<
1076	$(POST_PROCESS_O)
1077
1078.java.class:
1079	$(COMPILE.java) $<
1080
1081# Bourne and Korn shell script message catalog build rules.
1082# We extract all gettext strings with sed(1) (being careful to permit
1083# multiple gettext strings on the same line), weed out the dups, and
1084# build the catalogue with awk(1).
1085
1086.sh.po .ksh.po:
1087	$(SED) -n -e ":a" 				\
1088		  -e "h" 					\
1089		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
1090		  -e "x"					\
1091		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
1092		  -e "t a"					\
1093	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1094
1095#
1096# Python and Perl executable and message catalog build rules.
1097#
1098.SUFFIXES: .pl .pm .py .pyc
1099
1100.pl:
1101	$(RM) $@;
1102	$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
1103	$(CHMOD) +x $@
1104
1105.py:
1106	$(RM) $@; $(CAT) $< > $@; $(CHMOD) +x $@
1107
1108.py.pyc:
1109	$(RM) $@
1110	$(PYTHON) -mpy_compile $<
1111	@[ $(<)c = $@ ] || $(MV) $(<)c $@
1112
1113.py.po:
1114	$(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ;
1115
1116.pl.po .pm.po:
1117	$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
1118	$(RM)	$@ ;
1119	$(SED) "/^domain/d" < $(<F).po > $@ ;
1120	$(RM) $(<F).po
1121
1122#
1123# When using xgettext, we want messages to go to the default domain,
1124# rather than the specified one.  This special version of the
1125# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1126# causing xgettext to put all messages into the default domain.
1127#
1128CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1129
1130.c.i:
1131	$(CPPFORPO) $< > $@
1132
1133.h.i:
1134	$(CPPFORPO) $< > $@
1135
1136.y.i:
1137	$(YACC) -d $<
1138	$(CPPFORPO) y.tab.c  > $@
1139	$(RM) y.tab.c
1140
1141.l.i:
1142	$(LEX) $<
1143	$(CPPFORPO) lex.yy.c  > $@
1144	$(RM) lex.yy.c
1145
1146.c.po:
1147	$(CPPFORPO) $< > $<.i
1148	$(BUILD.po)
1149
1150.y.po:
1151	$(YACC) -d $<
1152	$(CPPFORPO) y.tab.c  > $<.i
1153	$(BUILD.po)
1154	$(RM) y.tab.c
1155
1156.l.po:
1157	$(LEX) $<
1158	$(CPPFORPO) lex.yy.c  > $<.i
1159	$(BUILD.po)
1160	$(RM) lex.yy.c
1161
1162#
1163# Rules to perform stylistic checks
1164#
1165.SUFFIXES: .x .xml .check .xmlchk
1166
1167.h.check:
1168	$(DOT_H_CHECK)
1169
1170.x.check:
1171	$(DOT_X_CHECK)
1172
1173.xml.xmlchk:
1174	$(MANIFEST_CHECK)
1175
1176#
1177# Include rules to render automated sccs get rules "safe".
1178#
1179include $(SRC)/Makefile.noget
1180