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