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