xref: /titanic_41/usr/src/Makefile.master (revision 09bbc1382f9244fdbb4dfab9126fa50826c93228)
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#
28
29#
30# Makefile.master, global definitions for system source
31#
32ROOT=		/proto
33
34#
35# Adjunct root, containing an additional proto area to be used for headers
36# and libraries.
37#
38ADJUNCT_PROTO=
39
40#
41# Adjunct for building things that run on the build machine.
42#
43NATIVE_ADJUNCT=	/usr
44
45#
46# RELEASE_BUILD should be cleared for final release builds.
47# NOT_RELEASE_BUILD is exactly what the name implies.
48#
49# __GNUC toggles the building of ON components using gcc and related tools.
50# Normally set to `#', set it to `' to do gcc build.
51#
52# The declaration POUND_SIGN is always '#'. This is needed to get around the
53# make feature that '#' is always a comment delimiter, even when escaped or
54# quoted. We use this macro expansion method to get POUND_SIGN rather than
55# always breaking out a shell because the general case can cause a noticable
56# slowdown in build times when so many Makefiles include Makefile.master.
57#
58# While the majority of users are expected to override the setting below
59# with an env file (via nightly or bldenv), if you aren't building that way
60# (ie, you're using "ws" or some other bootstrapping method) then you need
61# this definition in order to avoid the subshell invocation mentioned above.
62#
63
64PRE_POUND=				pre\#
65POUND_SIGN=				$(PRE_POUND:pre\%=%)
66
67NOT_RELEASE_BUILD=
68RELEASE_BUILD=				$(POUND_SIGN)
69$(RELEASE_BUILD)NOT_RELEASE_BUILD=	$(POUND_SIGN)
70PATCH_BUILD=				$(POUND_SIGN)
71
72# SPARC_BLD is '#' for an Intel build.
73# INTEL_BLD is '#' for a Sparc build.
74SPARC_BLD_1=    $(MACH:i386=$(POUND_SIGN))
75SPARC_BLD=      $(SPARC_BLD_1:sparc=)
76INTEL_BLD_1=    $(MACH:sparc=$(POUND_SIGN))
77INTEL_BLD=      $(INTEL_BLD_1:i386=)
78
79# The variables below control the compilers used during the build.
80# There are a number of permutations.
81#
82# __GNUC and __SUNC control (and indicate) the primary compiler.  Whichever
83# one is not POUND_SIGN is the primary, with the other as the shadow.  They
84# may also be used to control entirely compiler-specific Makefile assignments.
85# __GNUC and GCC are the default.
86#
87# __GNUC64 indicates that the 64bit build should use the GNU C compiler.
88# There is no Sun C analogue.
89#
90# The following version-specific options are operative regardless of which
91# compiler is primary, and control the versions of the given compilers to be
92# used.  They also allow compiler-version specific Makefile fragments.
93#
94
95__SUNC=			$(POUND_SIGN)
96$(__SUNC)__GNUC=	$(POUND_SIGN)
97__GNUC64=		$(__GNUC)
98
99# Allow build-time "configuration" to enable or disable some things.
100# The default is POUND_SIGN, meaning "not enabled". If the environment
101# passes in an override like ENABLE_SMB_PRINTING= (empty) that will
102# uncomment things in the lower Makefiles to enable the feature.
103ENABLE_IPP_PRINTING=	$(POUND_SIGN)
104ENABLE_SMB_PRINTING=	$(POUND_SIGN)
105
106# CLOSED is the root of the tree that contains source which isn't released
107# as open source
108CLOSED=		$(SRC)/../closed
109
110# BUILD_TOOLS is the root of all tools including compilers.
111# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
112
113BUILD_TOOLS=		/ws/onnv-tools
114ONBLD_TOOLS=		$(BUILD_TOOLS)/onbld
115
116# Build is broken with jdk 1.6, use 1.7 (simon)
117JAVA_ROOT=	/usr/jdk/instances/openjdk1.7.0/
118
119GCC_ROOT=	/opt/gcc/4.4.4
120GCCLIBDIR=	$(GCC_ROOT)/lib
121GCCLIBDIR64=	$(GCC_ROOT)/lib/$(MACH64)
122
123DOCBOOK_XSL_ROOT=	/usr/share/sgml/docbook/xsl-stylesheets
124
125RPCGEN=		/usr/bin/rpcgen
126STABS=		$(ONBLD_TOOLS)/bin/$(MACH)/stabs
127ELFEXTRACT=	$(ONBLD_TOOLS)/bin/$(MACH)/elfextract
128MBH_PATCH=	$(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch
129ECHO=		echo
130INS=		install
131TRUE=		true
132SYMLINK=	/usr/bin/ln -s
133LN=		/usr/bin/ln
134CHMOD=		/usr/bin/chmod
135MV=		/usr/bin/mv -f
136RM=		/usr/bin/rm -f
137CUT=		/usr/bin/cut
138NM=		/usr/ccs/bin/nm
139DIFF=		/usr/bin/diff
140GREP=		/usr/bin/grep
141EGREP=		/usr/gnu/bin/egrep
142ELFWRAP=	/usr/bin/elfwrap
143KSH93=		/usr/bin/ksh93
144SED=		/usr/bin/sed
145NAWK=		/usr/bin/nawk
146CP=		/usr/bin/cp -f
147MCS=		/usr/ccs/bin/mcs
148CAT=            /usr/bin/cat
149ELFDUMP=	/usr/ccs/bin/elfdump
150M4=		/usr/ccs/bin/m4
151STRIP=		/usr/ccs/bin/strip
152LEX=		/usr/ccs/bin/lex
153FLEX=		/usr/bin/flex
154YACC=		/usr/ccs/bin/yacc
155CPP=		/usr/lib/cpp
156JAVAC=		$(JAVA_ROOT)/bin/javac
157JAVAH=		$(JAVA_ROOT)/bin/javah
158JAVADOC=	$(JAVA_ROOT)/bin/javadoc
159RMIC=		$(JAVA_ROOT)/bin/rmic
160JAR=		$(JAVA_ROOT)/bin/jar
161CTFCONVERT=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
162CTFMERGE=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
163CTFSTABS=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
164CTFSTRIP=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstrip
165NDRGEN=		$(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
166GENOFFSETS=	$(ONBLD_TOOLS)/bin/genoffsets
167XREF=		$(ONBLD_TOOLS)/bin/xref
168FIND=		/usr/bin/find
169PERL=		/usr/bin/perl
170PERL_VERSION=	5.10.0
171PERL_PKGVERS=	-510
172PERL_ARCH =		i86pc-solaris-64int
173$(SPARC_BLD)PERL_ARCH =	sun4-solaris-64int
174PYTHON_26=	/usr/bin/python2.6
175PYTHON=		$(PYTHON_26)
176SORT=		/usr/bin/sort
177TOUCH=		/usr/bin/touch
178WC=		/usr/bin/wc
179XARGS=		/usr/bin/xargs
180ELFEDIT=	/usr/bin/elfedit
181ELFSIGN=	/usr/bin/elfsign
182DTRACE=		/usr/sbin/dtrace -xnolibs
183UNIQ=		/usr/bin/uniq
184TAR=		/usr/bin/tar
185ASTBINDIR=	/usr/ast/bin
186MSGCC=		$(ASTBINDIR)/msgcc
187
188FILEMODE=	644
189DIRMODE=	755
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=	-source 1.6 -target 1.6 -Xlint:deprecation,-options
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 and LDLIBS64 can be set in the environment to override the following
661# assignments.
662#
663# These environment settings make sure that no libraries are searched outside
664# of the local workspace proto area:
665#	LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
666#	LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
667#
668LDLIBS32 =	$(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
669LDLIBS32 +=	$(ADJUNCT_PROTO:%=-L%/usr/lib -L%/lib)
670LDLIBS.cmd = 	$(LDLIBS32)
671LDLIBS.lib =	$(LDLIBS32)
672
673LDLIBS64 =	$(ENVLDLIBS1:%=%/$(MACH64)) \
674		$(ENVLDLIBS2:%=%/$(MACH64)) \
675		$(ENVLDLIBS3:%=%/$(MACH64))
676LDLIBS64 +=     $(ADJUNCT_PROTO:%=-L%/usr/lib/$(MACH64) -L%/lib/$(MACH64))
677
678#
679# Define compilation macros.
680#
681COMPILE.c=	$(CC) $(CFLAGS) $(CPPFLAGS) -c
682COMPILE64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) -c
683COMPILE.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
684COMPILE64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
685COMPILE.s=	$(AS) $(ASFLAGS) $(AS_CPPFLAGS)
686COMPILE64.s=	$(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
687COMPILE.d=	$(DTRACE) -G -32
688COMPILE64.d=	$(DTRACE) -G -64
689COMPILE.b=	$(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
690COMPILE64.b=	$(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
691
692CLASSPATH=	.
693COMPILE.java=	$(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
694
695#
696# Link time macros
697#
698CCNEEDED		= -lC
699CCEXTNEEDED		= -lCrun -lCstd
700$(__GNUC)CCNEEDED	= -L$(GCCLIBDIR) -lstdc++ -lgcc_s
701$(__GNUC)CCEXTNEEDED	= $(CCNEEDED)
702
703LINK.c=		$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
704LINK64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
705NORUNPATH=	-norunpath -nolib
706LINK.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
707		$(LDFLAGS) $(CCNEEDED)
708LINK64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
709		$(LDFLAGS) $(CCNEEDED)
710
711#
712# lint macros
713#
714# Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once
715# ON is built with a version of lint that has the fix for 4484186.
716#
717ALWAYS_LINT_DEFS =	-errtags=yes -s
718ALWAYS_LINT_DEFS +=	-erroff=E_PTRDIFF_OVERFLOW
719ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_NARROW_CONV
720ALWAYS_LINT_DEFS +=	-U__PRAGMA_REDEFINE_EXTNAME
721ALWAYS_LINT_DEFS +=	$(C99LMODE)
722ALWAYS_LINT_DEFS +=	-errsecurity=$(SECLEVEL)
723ALWAYS_LINT_DEFS +=	-erroff=E_SEC_CREAT_WITHOUT_EXCL
724ALWAYS_LINT_DEFS +=	-erroff=E_SEC_FORBIDDEN_WARN_CREAT
725# XX64 -- really only needed for amd64 lint
726ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_INT_TO_SMALL_INT
727ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_CONST_TO_SMALL_INT
728ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_TO_SMALL_INT
729ALWAYS_LINT_DEFS +=	-erroff=E_CAST_TO_PTR_FROM_INT
730ALWAYS_LINT_DEFS +=	-erroff=E_COMP_INT_WITH_LARGE_INT
731ALWAYS_LINT_DEFS +=	-erroff=E_INTEGRAL_CONST_EXP_EXPECTED
732ALWAYS_LINT_DEFS +=	-erroff=E_PASS_INT_TO_SMALL_INT
733ALWAYS_LINT_DEFS +=	-erroff=E_PTR_CONV_LOSES_BITS
734
735# This forces lint to pick up note.h and sys/note.h from Devpro rather than
736# from the proto area.  The note.h that ON delivers would disable NOTE().
737ONLY_LINT_DEFS =	-I$(SPRO_VROOT)/prod/include/lint
738
739SECLEVEL=	core
740LINT.c=		$(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS) $(CPPFLAGS) \
741		$(ALWAYS_LINT_DEFS)
742LINT64.c=	$(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS64) $(CPPFLAGS) \
743		$(ALWAYS_LINT_DEFS)
744LINT.s=		$(LINT.c)
745
746# For some future builds, NATIVE_MACH and MACH might be different.
747# Therefore, NATIVE_MACH needs to be redefined in the
748# environment as `uname -p` to override this macro.
749#
750# For now at least, we cross-compile amd64 on i386 machines.
751NATIVE_MACH=	$(MACH:amd64=i386)
752
753# Define native compilation macros
754#
755
756# Base directory where compilers are loaded.
757# Defined here so it can be overridden by developer.
758#
759SPRO_ROOT=		$(BUILD_TOOLS)/SUNWspro
760SPRO_VROOT=		$(SPRO_ROOT)/SS12
761GNU_ROOT=		/usr
762
763# Till SS12u1 formally becomes the NV CBE, LINT is hard
764# coded to be picked up from the $SPRO_ROOT/sunstudio12.1/
765# location. Impacted variables are sparc_LINT, sparcv9_LINT,
766# i386_LINT, amd64_LINT.
767# Reset them when SS12u1 is rolled out.
768#
769
770# Specify platform compiler versions for languages
771# that we use (currently only c and c++).
772#
773sparc_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
774$(__GNUC)sparc_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
775sparc_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
776$(__GNUC)sparc_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
777sparc_CPP=		/usr/ccs/lib/cpp
778sparc_AS=		/usr/ccs/bin/as -xregsym=no
779sparc_LD=		/usr/ccs/bin/ld
780sparc_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
781
782sparcv9_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
783$(__GNUC64)sparcv9_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
784sparcv9_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
785$(__GNUC64)sparcv9_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
786sparcv9_CPP=		/usr/ccs/lib/cpp
787sparcv9_AS=		/usr/ccs/bin/as -xregsym=no
788sparcv9_LD=		/usr/ccs/bin/ld
789sparcv9_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
790
791i386_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
792$(__GNUC)i386_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
793i386_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
794$(__GNUC)i386_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
795i386_CPP=		/usr/ccs/lib/cpp
796i386_AS=		/usr/ccs/bin/as
797$(__GNUC)i386_AS=	$(ONBLD_TOOLS)/bin/$(MACH)/aw
798i386_LD=		/usr/ccs/bin/ld
799i386_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
800
801amd64_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
802$(__GNUC64)amd64_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
803amd64_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
804$(__GNUC64)amd64_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
805amd64_CPP=		/usr/ccs/lib/cpp
806amd64_AS=		$(ONBLD_TOOLS)/bin/$(MACH)/aw
807amd64_LD=		/usr/ccs/bin/ld
808amd64_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
809
810NATIVECC=		$($(NATIVE_MACH)_CC)
811NATIVECCC=		$($(NATIVE_MACH)_CCC)
812NATIVECPP=		$($(NATIVE_MACH)_CPP)
813NATIVEAS=		$($(NATIVE_MACH)_AS)
814NATIVELD=		$($(NATIVE_MACH)_LD)
815NATIVELINT=		$($(NATIVE_MACH)_LINT)
816
817#
818# Makefile.master.64 overrides these settings
819#
820CC=			$(NATIVECC)
821CCC=			$(NATIVECCC)
822CPP=			$(NATIVECPP)
823AS=			$(NATIVEAS)
824LD=			$(NATIVELD)
825LINT=			$(NATIVELINT)
826
827# The real compilers used for this build
828CW_CC_CMD=		$(CC) -_compiler
829CW_CCC_CMD=		$(CCC) -_compiler
830REAL_CC=		$(CW_CC_CMD:sh)
831REAL_CCC=		$(CW_CCC_CMD:sh)
832
833# Pass -Y flag to cpp (method of which is release-dependent)
834CCYFLAG=		-Y I,
835
836BDIRECT=	-Bdirect
837BDYNAMIC=	-Bdynamic
838BLOCAL=		-Blocal
839BNODIRECT=	-Bnodirect
840BREDUCE=	-Breduce
841BSTATIC=	-Bstatic
842
843ZDEFS=		-zdefs
844ZDIRECT=	-zdirect
845ZIGNORE=	-zignore
846ZINITFIRST=	-zinitfirst
847ZINTERPOSE=	-zinterpose
848ZLAZYLOAD=	-zlazyload
849ZLOADFLTR=	-zloadfltr
850ZMULDEFS=	-zmuldefs
851ZNODEFAULTLIB=	-znodefaultlib
852ZNODEFS=	-znodefs
853ZNODELETE=	-znodelete
854ZNODLOPEN=	-znodlopen
855ZNODUMP=	-znodump
856ZNOLAZYLOAD=	-znolazyload
857ZNOLDYNSYM=	-znoldynsym
858ZNORELOC=	-znoreloc
859ZNOVERSION=	-znoversion
860ZRECORD=	-zrecord
861ZREDLOCSYM=	-zredlocsym
862ZTEXT=		-ztext
863ZVERBOSE=	-zverbose
864
865GSHARED=	-G
866CCMT=		-mt
867
868# Handle different PIC models on different ISAs
869# (May be overridden by lower-level Makefiles)
870
871sparc_C_PICFLAGS =	-K pic
872sparcv9_C_PICFLAGS =	-K pic
873i386_C_PICFLAGS =	-K pic
874amd64_C_PICFLAGS =	-K pic
875C_PICFLAGS =		$($(MACH)_C_PICFLAGS)
876C_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
877
878sparc_C_BIGPICFLAGS =	-K PIC
879sparcv9_C_BIGPICFLAGS =	-K PIC
880i386_C_BIGPICFLAGS =	-K PIC
881amd64_C_BIGPICFLAGS =	-K PIC
882C_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
883C_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
884
885# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
886sparc_CC_PICFLAGS =	-Kpic
887sparcv9_CC_PICFLAGS =	-KPIC
888i386_CC_PICFLAGS = 	-Kpic
889amd64_CC_PICFLAGS = 	-Kpic
890CC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
891CC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
892
893AS_PICFLAGS=		$(C_PICFLAGS)
894AS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
895
896#
897# Default label for CTF sections
898#
899CTFCVTFLAGS=		-i -L VERSION
900
901#
902# Override to pass module-specific flags to ctfmerge.  Currently used only by
903# krtld to turn on fuzzy matching, and source-level debugging to inhibit
904# stripping.
905#
906CTFMRGFLAGS=
907
908CTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
909
910ELFSIGN_O=	$(TRUE)
911ELFSIGN_CRYPTO=	$(ELFSIGN_O)
912ELFSIGN_OBJECT=	$(ELFSIGN_O)
913
914# Rules (normally from make.rules) and macros which are used for post
915# processing files. Normally, these do stripping of the comment section
916# automatically.
917#    RELEASE_CM:	Should be editted to reflect the release.
918#    POST_PROCESS_O:	Post-processing for `.o' files.
919#    POST_PROCESS_A:	Post-processing for `.a' files (currently null).
920#    POST_PROCESS_SO:	Post-processing for `.so' files.
921#    POST_PROCESS:	Post-processing for executable files (no suffix).
922# Note that these macros are not completely generalized as they are to be
923# used with the file name to be processed following.
924#
925# It is left as an exercise to Release Engineering to embellish the generation
926# of the release comment string.
927#
928#	If this is a standard development build:
929#		compress the comment section (mcs -c)
930#		add the standard comment (mcs -a $(RELEASE_CM))
931#		add the development specific comment (mcs -a $(DEV_CM))
932#
933#	If this is an installation build:
934#		delete the comment section (mcs -d)
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 release build:
939#		delete the comment section (mcs -d)
940#		add the standard comment (mcs -a $(RELEASE_CM))
941#
942# The following list of macros are used in the definition of RELEASE_CM
943# which is used to label all binaries in the build:
944#
945# 	RELEASE		Specific release of the build, eg: 5.2
946#	RELEASE_MAJOR	Major version number part of $(RELEASE)
947#	RELEASE_MINOR	Minor version number part of $(RELEASE)
948#	VERSION		Version of the build (alpha, beta, Generic)
949#	PATCHID		If this is a patch this value should contain
950#			the patchid value (eg: "Generic 100832-01"), otherwise
951#			it will be set to $(VERSION)
952#	RELEASE_DATE	Date of the Release Build
953#	PATCH_DATE	Date the patch was created, if this is blank it
954#			will default to the RELEASE_DATE
955#
956RELEASE_MAJOR=	5
957RELEASE_MINOR=	11
958RELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
959VERSION=	SunOS Development
960PATCHID=	$(VERSION)
961RELEASE_DATE=	release date not set
962PATCH_DATE=	$(RELEASE_DATE)
963RELEASE_CM=	"@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
964DEV_CM=		"@($(POUND_SIGN))SunOS Internal Development: non-nightly build"
965
966PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
967$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
968
969STRIP_STABS=			   $(STRIP) -x $@
970$(SRCDBGBLD)STRIP_STABS=	   :
971
972POST_PROCESS_O=
973POST_PROCESS_A=
974POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
975			$(ELFSIGN_OBJECT)
976POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
977			$(ELFSIGN_OBJECT)
978
979#
980# chk4ubin is a tool that inspects a module for a symbol table
981# ELF section size which can trigger an OBP bug on older platforms.
982# This problem affects only specific sun4u bootable modules.
983#
984CHK4UBIN=	$(ONBLD_TOOLS)/bin/$(MACH)/chk4ubin
985CHK4UBINFLAGS=
986CHK4UBINARY=	$(CHK4UBIN) $(CHK4UBINFLAGS) $@
987
988#
989# PKGARCHIVE specifies the default location where packages should be
990# placed if built.
991#
992$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
993PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
994
995#
996# The repositories will be created with these publisher settings.  To
997# update an image to the resulting repositories, this must match the
998# publisher name provided to "pkg set-publisher."
999#
1000PKGPUBLISHER_REDIST=	on-nightly
1001PKGPUBLISHER_NONREDIST=	on-extra
1002
1003#	Default build rules which perform comment section post-processing.
1004#
1005.c:
1006	$(LINK.c) -o $@ $< $(LDLIBS)
1007	$(POST_PROCESS)
1008.c.o:
1009	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
1010	$(POST_PROCESS_O)
1011.c.a:
1012	$(COMPILE.c) -o $% $<
1013	$(PROCESS_COMMENT) $%
1014	$(AR) $(ARFLAGS) $@ $%
1015	$(RM) $%
1016.s.o:
1017	$(COMPILE.s) -o $@ $<
1018	$(POST_PROCESS_O)
1019.s.a:
1020	$(COMPILE.s) -o $% $<
1021	$(PROCESS_COMMENT) $%
1022	$(AR) $(ARFLAGS) $@ $%
1023	$(RM) $%
1024.cc:
1025	$(LINK.cc) -o $@ $< $(LDLIBS)
1026	$(POST_PROCESS)
1027.cc.o:
1028	$(COMPILE.cc) $(OUTPUT_OPTION) $<
1029	$(POST_PROCESS_O)
1030.cc.a:
1031	$(COMPILE.cc) -o $% $<
1032	$(AR) $(ARFLAGS) $@ $%
1033	$(PROCESS_COMMENT) $%
1034	$(RM) $%
1035.y:
1036	$(YACC.y) $<
1037	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
1038	$(POST_PROCESS)
1039	$(RM) y.tab.c
1040.y.o:
1041	$(YACC.y) $<
1042	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
1043	$(POST_PROCESS_O)
1044	$(RM) y.tab.c
1045.l:
1046	$(RM) $*.c
1047	$(LEX.l) $< > $*.c
1048	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
1049	$(POST_PROCESS)
1050	$(RM) $*.c
1051.l.o:
1052	$(RM) $*.c
1053	$(LEX.l) $< > $*.c
1054	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
1055	$(POST_PROCESS_O)
1056	$(RM) $*.c
1057
1058.bin.o:
1059	$(COMPILE.b) -o $@ $<
1060	$(POST_PROCESS_O)
1061
1062.java.class:
1063	$(COMPILE.java) $<
1064
1065# Bourne and Korn shell script message catalog build rules.
1066# We extract all gettext strings with sed(1) (being careful to permit
1067# multiple gettext strings on the same line), weed out the dups, and
1068# build the catalogue with awk(1).
1069
1070.sh.po .ksh.po:
1071	$(SED) -n -e ":a" 				\
1072		  -e "h" 					\
1073		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
1074		  -e "x"					\
1075		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
1076		  -e "t a"					\
1077	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1078
1079#
1080# Python and Perl executable and message catalog build rules.
1081#
1082.SUFFIXES: .pl .pm .py .pyc
1083
1084.pl:
1085	$(RM) $@;
1086	$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
1087	$(CHMOD) +x $@
1088
1089.py:
1090	$(RM) $@; $(CAT) $< > $@; $(CHMOD) +x $@
1091
1092.py.pyc:
1093	$(RM) $@
1094	$(PYTHON) -mpy_compile $<
1095	@[ $(<)c = $@ ] || $(MV) $(<)c $@
1096
1097.py.po:
1098	$(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ;
1099
1100.pl.po .pm.po:
1101	$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
1102	$(RM)	$@ ;
1103	$(SED) "/^domain/d" < $(<F).po > $@ ;
1104	$(RM) $(<F).po
1105
1106#
1107# When using xgettext, we want messages to go to the default domain,
1108# rather than the specified one.  This special version of the
1109# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1110# causing xgettext to put all messages into the default domain.
1111#
1112CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1113
1114.c.i:
1115	$(CPPFORPO) $< > $@
1116
1117.h.i:
1118	$(CPPFORPO) $< > $@
1119
1120.y.i:
1121	$(YACC) -d $<
1122	$(CPPFORPO) y.tab.c  > $@
1123	$(RM) y.tab.c
1124
1125.l.i:
1126	$(LEX) $<
1127	$(CPPFORPO) lex.yy.c  > $@
1128	$(RM) lex.yy.c
1129
1130.c.po:
1131	$(CPPFORPO) $< > $<.i
1132	$(BUILD.po)
1133
1134.y.po:
1135	$(YACC) -d $<
1136	$(CPPFORPO) y.tab.c  > $<.i
1137	$(BUILD.po)
1138	$(RM) y.tab.c
1139
1140.l.po:
1141	$(LEX) $<
1142	$(CPPFORPO) lex.yy.c  > $<.i
1143	$(BUILD.po)
1144	$(RM) lex.yy.c
1145
1146#
1147# Rules to perform stylistic checks
1148#
1149.SUFFIXES: .x .xml .check .xmlchk
1150
1151.h.check:
1152	$(DOT_H_CHECK)
1153
1154.x.check:
1155	$(DOT_X_CHECK)
1156
1157.xml.xmlchk:
1158	$(MANIFEST_CHECK)
1159
1160#
1161# Include rules to render automated sccs get rules "safe".
1162#
1163include $(SRC)/Makefile.noget
1164