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