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