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