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