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