xref: /onnv-gate/usr/src/Makefile.master (revision 12692:4341b447c069)
10Sstevel@tonic-gate#
20Sstevel@tonic-gate# CDDL HEADER START
30Sstevel@tonic-gate#
40Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5580Swesolows# Common Development and Distribution License (the "License").
6580Swesolows# You may not use this file except in compliance with the License.
70Sstevel@tonic-gate#
80Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate# See the License for the specific language governing permissions
110Sstevel@tonic-gate# and limitations under the License.
120Sstevel@tonic-gate#
130Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate#
190Sstevel@tonic-gate# CDDL HEADER END
200Sstevel@tonic-gate#
21580Swesolows
220Sstevel@tonic-gate#
2312210SJames.McPherson@Sun.COM# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
240Sstevel@tonic-gate#
25580Swesolows#
260Sstevel@tonic-gate# Makefile.master, global definitions for system source
270Sstevel@tonic-gate#
280Sstevel@tonic-gateROOT=		/proto
290Sstevel@tonic-gate
300Sstevel@tonic-gate#
3110207SJames.McPherson@Sun.COM# RELEASE_BUILD should be cleared for final release builds.
3210207SJames.McPherson@Sun.COM# NOT_RELEASE_BUILD is exactly what the name implies.
330Sstevel@tonic-gate#
340Sstevel@tonic-gate# INTERNAL_RELEASE_BUILD is a subset of RELEASE_BUILD. It mostly controls
350Sstevel@tonic-gate# identification strings. Enabling RELEASE_BUILD automatically enables
360Sstevel@tonic-gate# INTERNAL_RELEASE_BUILD.
370Sstevel@tonic-gate#
380Sstevel@tonic-gate# EXPORT_RELEASE_BUILD controls whether binaries are built in a form that
390Sstevel@tonic-gate# can be released for export under a binary license.  It is orthogonal to
401167Skupfer# the other *RELEASE_BUILD settings.  ("#" means do an export release
411167Skupfer# build, "" means do a normal build.)
421167Skupfer#
431167Skupfer# CLOSED_BUILD controls whether we try to build files under
441167Skupfer# usr/closed.  ("" means to build closed code, "#" means don't try to
451167Skupfer# build it.)  Skipping the closed code implies doing an export release
461167Skupfer# build.
470Sstevel@tonic-gate#
480Sstevel@tonic-gate# STRIP_COMMENTS toggles comment section striping. Generally the same setting
490Sstevel@tonic-gate# as INTERNAL_RELEASE_BUILD.
500Sstevel@tonic-gate#
510Sstevel@tonic-gate# __GNUC toggles the building of ON components using gcc and related tools.
520Sstevel@tonic-gate# Normally set to `#', set it to `' to do gcc build.
530Sstevel@tonic-gate#
540Sstevel@tonic-gate# The declaration POUND_SIGN is always '#'. This is needed to get around the
550Sstevel@tonic-gate# make feature that '#' is always a comment delimiter, even when escaped or
5610738SJames.McPherson@Sun.COM# quoted. We use this macro expansion method to get POUND_SIGN rather than
5710738SJames.McPherson@Sun.COM# always breaking out a shell because the general case can cause a noticable
5810738SJames.McPherson@Sun.COM# slowdown in build times when so many Makefiles include Makefile.master.
590Sstevel@tonic-gate#
6010738SJames.McPherson@Sun.COM# While the majority of users are expected to override the setting below
6110738SJames.McPherson@Sun.COM# with an env file (via nightly or bldenv), if you aren't building that way
6210738SJames.McPherson@Sun.COM# (ie, you're using "ws" or some other bootstrapping method) then you need
6310738SJames.McPherson@Sun.COM# this definition in order to avoid the subshell invocation mentioned above.
6410738SJames.McPherson@Sun.COM#
6510738SJames.McPherson@Sun.COM
6610738SJames.McPherson@Sun.COMPRE_POUND=				pre\#
6710738SJames.McPherson@Sun.COMPOUND_SIGN=				$(PRE_POUND:pre\%=%)
680Sstevel@tonic-gate
690Sstevel@tonic-gateNOT_RELEASE_BUILD=
700Sstevel@tonic-gateINTERNAL_RELEASE_BUILD=			$(POUND_SIGN)
710Sstevel@tonic-gateRELEASE_BUILD=				$(POUND_SIGN)
720Sstevel@tonic-gate$(RELEASE_BUILD)NOT_RELEASE_BUILD=	$(POUND_SIGN)
730Sstevel@tonic-gate$(RELEASE_BUILD)INTERNAL_RELEASE_BUILD=
740Sstevel@tonic-gatePATCH_BUILD=				$(POUND_SIGN)
750Sstevel@tonic-gate
761167Skupfer# If CLOSED_IS_PRESENT is not set, assume the closed tree is present.
771167SkupferCLOSED_BUILD_1=	$(CLOSED_IS_PRESENT:yes=)
781167SkupferCLOSED_BUILD=	$(CLOSED_BUILD_1:no=$(POUND_SIGN))
791167Skupfer
801167SkupferEXPORT_RELEASE_BUILD=			$(POUND_SIGN)
811167Skupfer$(CLOSED_BUILD)EXPORT_RELEASE_BUILD=
821167Skupfer
830Sstevel@tonic-gate# SPARC_BLD is '#' for an Intel build.
840Sstevel@tonic-gate# INTEL_BLD is '#' for a Sparc build.
850Sstevel@tonic-gateSPARC_BLD_1=    $(MACH:i386=$(POUND_SIGN))
860Sstevel@tonic-gateSPARC_BLD=      $(SPARC_BLD_1:sparc=)
870Sstevel@tonic-gateINTEL_BLD_1=    $(MACH:sparc=$(POUND_SIGN))
880Sstevel@tonic-gateINTEL_BLD=      $(INTEL_BLD_1:i386=)
890Sstevel@tonic-gate
900Sstevel@tonic-gateSTRIP_COMMENTS=	$(INTERNAL_RELEASE_BUILD)
910Sstevel@tonic-gate
9212210SJames.McPherson@Sun.COM# Are we building tonic closedbins? Unless you have used the
9312210SJames.McPherson@Sun.COM# -O flag to nightly or bldenv, leave the definition of TONICBUILD
9412210SJames.McPherson@Sun.COM# as $(POUND_SIGN).
9512210SJames.McPherson@Sun.COM#
9612210SJames.McPherson@Sun.COM# IF YOU CHANGE CLOSEDROOT, you MUST change install.bin
9712210SJames.McPherson@Sun.COM# to match the new definition.
9812210SJames.McPherson@Sun.COMTONICBUILD=     $(POUND_SIGN)
9912210SJames.McPherson@Sun.COM$(TONICBUILD)CLOSEDROOT= $(ROOT)-closed
10012210SJames.McPherson@Sun.COM
10112210SJames.McPherson@Sun.COM
1020Sstevel@tonic-gate# set __GNUC= in the environment to build 32-bit with the gcc compiler.
1032886Spetede# The default is to use the Sun Studio compiler for all processor types.
1040Sstevel@tonic-gate__GNUC=		$(POUND_SIGN)
1050Sstevel@tonic-gate
106499Spetede# set __GNUC64= in the environment to build 64-bit with the gcc compiler.
1072886Spetede# Inherit the __GNUC value by default, and if that is set to $(POUND_SIGN)
1082886Spetede# then this means use the Sun Studio compiler.
109499Spetede__GNUC64=	$(__GNUC)
1100Sstevel@tonic-gate
1112886Spetede# set __SSNEXT= in the enviroment to build with the 'next' release of
1122886Spetede# the Sun Studio compiler. This will cause command line options specific
1132886Spetede# to the 'next' version of the Sun Studio compiler to be used.
1142886Spetede__SSNEXT=	$(POUND_SIGN)
1152886Spetede
1161167Skupfer# CLOSED is the root of the tree that contains source which isn't released
1171167Skupfer# as open source
1181167SkupferCLOSED=		$(SRC)/../closed
1191167Skupfer
1200Sstevel@tonic-gate# BUILD_TOOLS is the root of all tools including compilers.
1210Sstevel@tonic-gate# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
1220Sstevel@tonic-gate
1230Sstevel@tonic-gateBUILD_TOOLS=		/ws/onnv-tools
1240Sstevel@tonic-gateONBLD_TOOLS=		$(BUILD_TOOLS)/onbld
1250Sstevel@tonic-gate
1260Sstevel@tonic-gateJAVA_ROOT=	/usr/java
1270Sstevel@tonic-gate
1280Sstevel@tonic-gateSFW_ROOT=	/usr/sfw
12939SdinakSFWINCDIR=	$(SFW_ROOT)/include
1300Sstevel@tonic-gateSFWLIBDIR=	$(SFW_ROOT)/lib
1310Sstevel@tonic-gateSFWLIBDIR64=	$(SFW_ROOT)/lib/$(MACH64)
1320Sstevel@tonic-gate
1330Sstevel@tonic-gateRPCGEN=		/usr/bin/rpcgen
1340Sstevel@tonic-gateSTABS=		$(ONBLD_TOOLS)/bin/$(MACH)/stabs
1353446SmrjELFEXTRACT=	$(ONBLD_TOOLS)/bin/$(MACH)/elfextract
1363446SmrjMBH_PATCH=	$(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch
1370Sstevel@tonic-gateECHO=		echo
1380Sstevel@tonic-gateINS=		install
1390Sstevel@tonic-gateTRUE=		true
1400Sstevel@tonic-gateSYMLINK=	/usr/bin/ln -s
1410Sstevel@tonic-gateLN=		/usr/bin/ln
1420Sstevel@tonic-gateCHMOD=		/usr/bin/chmod
1430Sstevel@tonic-gateMV=		/usr/bin/mv -f
1440Sstevel@tonic-gateRM=		/usr/bin/rm -f
1453448Sdh155122CUT=		/usr/bin/cut
1463448Sdh155122NM=		/usr/ccs/bin/nm
1473448Sdh155122DIFF=		/usr/bin/diff
1480Sstevel@tonic-gateGREP=		/usr/bin/grep
1491792SwesolowsEGREP=		/usr/bin/egrep
15010696SDavid.Hollister@Sun.COMELFWRAP=	/usr/bin/elfwrap
1516510SmjnelsonKSH93=		/usr/bin/ksh93
1520Sstevel@tonic-gateSED=		/usr/bin/sed
1530Sstevel@tonic-gateNAWK=		/usr/bin/nawk
1540Sstevel@tonic-gateCP=		/usr/bin/cp -f
1550Sstevel@tonic-gateMCS=		/usr/ccs/bin/mcs
1560Sstevel@tonic-gateCAT=            /usr/bin/cat
1574271SrieELFDUMP=	/usr/ccs/bin/elfdump
1580Sstevel@tonic-gateM4=		/usr/ccs/bin/m4
1590Sstevel@tonic-gateSTRIP=		/usr/ccs/bin/strip
1600Sstevel@tonic-gateLEX=		/usr/ccs/bin/lex
1615184Sek110237FLEX=		$(SFW_ROOT)/bin/flex
1620Sstevel@tonic-gateYACC=		/usr/ccs/bin/yacc
1630Sstevel@tonic-gateCPP=		/usr/lib/cpp
1640Sstevel@tonic-gateJAVAC=		$(JAVA_ROOT)/bin/javac
1650Sstevel@tonic-gateJAVAH=		$(JAVA_ROOT)/bin/javah
1660Sstevel@tonic-gateJAVADOC=	$(JAVA_ROOT)/bin/javadoc
1670Sstevel@tonic-gateRMIC=		$(JAVA_ROOT)/bin/rmic
1680Sstevel@tonic-gateJAR=		$(JAVA_ROOT)/bin/jar
1690Sstevel@tonic-gateCTFCONVERT=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
1700Sstevel@tonic-gateCTFMERGE=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
1710Sstevel@tonic-gateCTFSTABS=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
1725311SamwNDRGEN=		$(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
1730Sstevel@tonic-gateGENOFFSETS=	$(ONBLD_TOOLS)/bin/genoffsets
1740Sstevel@tonic-gateCTFCVTPTBL=	$(ONBLD_TOOLS)/bin/ctfcvtptbl
1750Sstevel@tonic-gateCTFFINDMOD=	$(ONBLD_TOOLS)/bin/ctffindmod
1760Sstevel@tonic-gateXREF=		$(ONBLD_TOOLS)/bin/xref
1770Sstevel@tonic-gateFIND=		/usr/bin/find
1780Sstevel@tonic-gatePERL=		/usr/bin/perl
17912216Srichlowe@richlowe.netPYTHON_24=	/usr/bin/python2.4
18012216Srichlowe@richlowe.netPYTHON_26=	/usr/bin/python2.6
18112216Srichlowe@richlowe.netPYTHON=		$(PYTHON_24)
1820Sstevel@tonic-gateSORT=		/usr/bin/sort
1830Sstevel@tonic-gateTOUCH=		/usr/bin/touch
1840Sstevel@tonic-gateWC=		/usr/bin/wc
1850Sstevel@tonic-gateXARGS=		/usr/bin/xargs
1865543SdarrenmELFEDIT=	/usr/bin/elfedit
1870Sstevel@tonic-gateELFSIGN=	/usr/bin/elfsign
1880Sstevel@tonic-gateDTRACE=		/usr/sbin/dtrace
1897144SjmcpUNIQ=		/usr/bin/uniq
1900Sstevel@tonic-gate
1910Sstevel@tonic-gateFILEMODE=	644
1920Sstevel@tonic-gateDIRMODE=	755
1930Sstevel@tonic-gate
1940Sstevel@tonic-gate#
1950Sstevel@tonic-gate# The version of the patch makeup table optimized for build-time use.  Used
1960Sstevel@tonic-gate# during patch builds only.
1970Sstevel@tonic-gate$(PATCH_BUILD)PMTMO_FILE=$(SRC)/patch_makeup_table.mo
1980Sstevel@tonic-gate
1990Sstevel@tonic-gate# Declare that nothing should be built in parallel.
2000Sstevel@tonic-gate# Individual Makefiles can use the .PARALLEL target to declare otherwise.
2010Sstevel@tonic-gate.NO_PARALLEL:
2020Sstevel@tonic-gate
2030Sstevel@tonic-gate# For stylistic checks
2040Sstevel@tonic-gate#
2050Sstevel@tonic-gate# Note that the X and C checks are not used at this time and may need
2060Sstevel@tonic-gate# modification when they are actually used.
2070Sstevel@tonic-gate#
2087078SmjnelsonCSTYLE=		$(ONBLD_TOOLS)/bin/cstyle
2090Sstevel@tonic-gateCSTYLE_TAIL=
2107078SmjnelsonHDRCHK=		$(ONBLD_TOOLS)/bin/hdrchk
2110Sstevel@tonic-gateHDRCHK_TAIL=
2127078SmjnelsonJSTYLE=		$(ONBLD_TOOLS)/bin/jstyle
2130Sstevel@tonic-gate
2140Sstevel@tonic-gateDOT_H_CHECK=	\
2150Sstevel@tonic-gate	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
2160Sstevel@tonic-gate	$(HDRCHK) $< $(HDRCHK_TAIL)
2170Sstevel@tonic-gate
2180Sstevel@tonic-gateDOT_X_CHECK=	\
2190Sstevel@tonic-gate	@$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
2200Sstevel@tonic-gate	$(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
2210Sstevel@tonic-gate
2220Sstevel@tonic-gateDOT_C_CHECK=	\
2230Sstevel@tonic-gate	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
2240Sstevel@tonic-gate
2250Sstevel@tonic-gateMANIFEST_CHECK=	\
2260Sstevel@tonic-gate	@$(ECHO) "checking $<"; \
2270Sstevel@tonic-gate	SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
2287887SLiane.Praza@Sun.COM	SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
2297887SLiane.Praza@Sun.COM	SVCCFG_CONFIGD_PATH=$(SRC)/cmd/svc/configd/svc.configd-native \
2300Sstevel@tonic-gate	$(SRC)/cmd/svc/svccfg/svccfg-native validate $<
2310Sstevel@tonic-gate
23212210SJames.McPherson@Sun.COM#
23312210SJames.McPherson@Sun.COM# IMPORTANT:: If you change any of INS.file, INS.dir, INS.rename,
23412210SJames.McPherson@Sun.COM# INS.link or INS.symlink here, then you must also change the
23512210SJames.McPherson@Sun.COM# corresponding override definitions in $CLOSED/Makefile.tonic.
23612210SJames.McPherson@Sun.COM# If you do not do this, then the closedbins build for the OpenSolaris
23712210SJames.McPherson@Sun.COM# community will break. PS, the gatekeepers will be upset too.
2380Sstevel@tonic-gateINS.file=	$(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
2390Sstevel@tonic-gateINS.dir=	$(INS) -s -d -m $(DIRMODE) $@
2400Sstevel@tonic-gate# installs and renames at once
2410Sstevel@tonic-gate#
2420Sstevel@tonic-gateINS.rename=	$(INS.file); $(MV) $(@D)/$(<F) $@
2430Sstevel@tonic-gate
2440Sstevel@tonic-gate# install a link
2450Sstevel@tonic-gateINSLINKTARGET=	$<
2460Sstevel@tonic-gateINS.link=	$(RM) $@; $(LN) $(INSLINKTARGET) $@
24712210SJames.McPherson@Sun.COMINS.symlink=	$(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
24812210SJames.McPherson@Sun.COM
2497078Smjnelson#
2507078Smjnelson# Python bakes the mtime of the .py file into the compiled .pyc and
2517078Smjnelson# rebuilds if the baked-in mtime != the mtime of the source file
2527078Smjnelson# (rather than only if it's less than), thus when installing python
2537078Smjnelson# files we must make certain to not adjust the mtime of the source
2547078Smjnelson# (.py) file.
2557078Smjnelson#
2567078SmjnelsonINS.pyfile=	$(INS.file); $(TOUCH) -r $< $@
2570Sstevel@tonic-gate
2580Sstevel@tonic-gate# MACH must be set in the shell environment per uname -p on the build host
2590Sstevel@tonic-gate# More specific architecture variables should be set in lower makefiles.
2600Sstevel@tonic-gate#
2610Sstevel@tonic-gate# MACH64 is derived from MACH, and BUILD64 is set to `#' for
2620Sstevel@tonic-gate# architectures on which we do not build 64-bit versions.
2630Sstevel@tonic-gate# (There are no such architectures at the moment.)
2640Sstevel@tonic-gate#
2650Sstevel@tonic-gate# Set BUILD64=# in the environment to disable 64-bit amd64
2660Sstevel@tonic-gate# builds on i386 machines.
2670Sstevel@tonic-gate
2680Sstevel@tonic-gateMACH64_1=	$(MACH:sparc=sparcv9)
2690Sstevel@tonic-gateMACH64=		$(MACH64_1:i386=amd64)
2700Sstevel@tonic-gate
2710Sstevel@tonic-gateMACH32_1=	$(MACH:sparc=sparcv7)
2720Sstevel@tonic-gateMACH32=		$(MACH32_1:i386=i86)
2730Sstevel@tonic-gate
2740Sstevel@tonic-gatesparc_BUILD64=
2750Sstevel@tonic-gatei386_BUILD64=
2760Sstevel@tonic-gateBUILD64=	$($(MACH)_BUILD64)
2770Sstevel@tonic-gate
2780Sstevel@tonic-gate#
2790Sstevel@tonic-gate# C compiler mode. Future compilers may change the default on us,
2800Sstevel@tonic-gate# so force extended ANSI mode globally. Lower level makefiles can
2810Sstevel@tonic-gate# override this by setting CCMODE.
2820Sstevel@tonic-gate#
2830Sstevel@tonic-gateCCMODE=			-Xa
2840Sstevel@tonic-gateCCMODE64=		-Xa
2850Sstevel@tonic-gate
2860Sstevel@tonic-gate#
2870Sstevel@tonic-gate# C compiler verbose mode. This is so we can enable it globally,
2880Sstevel@tonic-gate# but turn it off in the lower level makefiles of things we cannot
2890Sstevel@tonic-gate# (or aren't going to) fix.
2900Sstevel@tonic-gate#
2910Sstevel@tonic-gateCCVERBOSE=		-v
2920Sstevel@tonic-gate
2930Sstevel@tonic-gate# set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings
2940Sstevel@tonic-gate# from the compiler about places the -xarch=v9 may differ from -xarch=v9c.
2950Sstevel@tonic-gateV9ABIWARN=
2960Sstevel@tonic-gate
2970Sstevel@tonic-gate# set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register
2980Sstevel@tonic-gate# symbols (used to detect conflicts between objects that use global registers)
2990Sstevel@tonic-gate# we disable this now for safety, and because genunix doesn't link with
3000Sstevel@tonic-gate# this feature (the v9 default) enabled.
3010Sstevel@tonic-gate#
3020Sstevel@tonic-gate# REGSYM is separate since the C++ driver syntax is different.
3030Sstevel@tonic-gateCCREGSYM=		-Wc,-Qiselect-regsym=0
3040Sstevel@tonic-gateCCCREGSYM=		-Qoption cg -Qiselect-regsym=0
3050Sstevel@tonic-gate
3062745Spetede# Prevent the removal of static symbols by the SPARC code generator (cg).
3072745Spetede# The x86 code generator (ube) does not remove such symbols and as such
3082745Spetede# using this workaround is not applicable for x86.
3092745Spetede#
3102605SpetedeCCSTATICSYM=		-Wc,-Qassembler-ounrefsym=0
3110Sstevel@tonic-gate#
3120Sstevel@tonic-gate# generate 32-bit addresses in the v9 kernel. Saves memory.
3130Sstevel@tonic-gateCCABS32=		-Wc,-xcode=abs32
3140Sstevel@tonic-gate
3150Sstevel@tonic-gate# One optimization the compiler might perform is to turn this:
3160Sstevel@tonic-gate#	#pragma weak foo
3170Sstevel@tonic-gate#	extern int foo;
3180Sstevel@tonic-gate#	if (&foo)
3190Sstevel@tonic-gate#		foo = 5;
3200Sstevel@tonic-gate# into
3210Sstevel@tonic-gate#	foo = 5;
3220Sstevel@tonic-gate# Since we do some of this (foo might be referenced in common kernel code
3230Sstevel@tonic-gate# but provided only for some cpu modules or platforms), we disable this
3240Sstevel@tonic-gate# optimization.
3250Sstevel@tonic-gate#
3260Sstevel@tonic-gatesparc_CCUNBOUND	= -Wd,-xsafe=unboundsym
3270Sstevel@tonic-gatei386_CCUNBOUND	=
3280Sstevel@tonic-gateCCUNBOUND	= $($(MACH)_CCUNBOUND)
3290Sstevel@tonic-gate
3300Sstevel@tonic-gate#
3310Sstevel@tonic-gate# compiler '-xarch' flag. This is here to centralize it and make it
3320Sstevel@tonic-gate# overridable for testing.
3337684SNick.Todd@Sun.COMsparc_XARCH=	-m32
3347684SNick.Todd@Sun.COMsparcv9_XARCH=	-m64
3350Sstevel@tonic-gatei386_XARCH=
3367684SNick.Todd@Sun.COMamd64_XARCH=	-m64 -Ui386 -U__i386
3370Sstevel@tonic-gate
3380Sstevel@tonic-gate# assembler '-xarch' flag.  Different from compiler '-xarch' flag.
3392037Scraigmsparc_AS_XARCH=		-xarch=v8plus
3400Sstevel@tonic-gatesparcv9_AS_XARCH=	-xarch=v9
3410Sstevel@tonic-gatei386_AS_XARCH=
3420Sstevel@tonic-gateamd64_AS_XARCH=		-xarch=amd64 -P -Ui386 -U__i386
3430Sstevel@tonic-gate
3440Sstevel@tonic-gate#
3450Sstevel@tonic-gate# These flags define what we need to be 'standalone' i.e. -not- part
3460Sstevel@tonic-gate# of the rather more cosy userland environment.  This basically means
3470Sstevel@tonic-gate# the kernel.
3480Sstevel@tonic-gate#
3490Sstevel@tonic-gate# XX64	future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
3500Sstevel@tonic-gate#
351580Swesolowssparc_STAND_FLAGS=	-_gcc=-ffreestanding
352580Swesolowssparcv9_STAND_FLAGS=	-_gcc=-ffreestanding
3530Sstevel@tonic-gatei386_STAND_FLAGS=	-_gcc=-ffreestanding
3547684SNick.Todd@Sun.COMamd64_STAND_FLAGS=	-xmodel=kernel
3550Sstevel@tonic-gate
3560Sstevel@tonic-gateSAVEARGS=		-Wu,-save_args
3570Sstevel@tonic-gateamd64_STAND_FLAGS	+= $(SAVEARGS)
3580Sstevel@tonic-gate
3590Sstevel@tonic-gateSTAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
3600Sstevel@tonic-gateSTAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
3610Sstevel@tonic-gate
3620Sstevel@tonic-gate#
3630Sstevel@tonic-gate# disable the incremental linker
3640Sstevel@tonic-gateILDOFF=			-xildoff
3650Sstevel@tonic-gate#
3660Sstevel@tonic-gateXDEPEND=		-xdepend
3675827SrieXFFLAG=			-xF=%all
3680Sstevel@tonic-gateXESS=			-xs
3690Sstevel@tonic-gateXSTRCONST=		-xstrconst
3700Sstevel@tonic-gate
3710Sstevel@tonic-gate#
3720Sstevel@tonic-gate# turn warnings into errors (C)
3730Sstevel@tonic-gateCERRWARN = -errtags=yes -errwarn=%all
3740Sstevel@tonic-gateCERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT
3750Sstevel@tonic-gateCERRWARN += -erroff=E_STATEMENT_NOT_REACHED
3760Sstevel@tonic-gate
3770Sstevel@tonic-gate#
3780Sstevel@tonic-gate# turn warnings into errors (C++)
3790Sstevel@tonic-gateCCERRWARN=		-xwe
3800Sstevel@tonic-gate
3810Sstevel@tonic-gate# C99 mode
3820Sstevel@tonic-gateC99_ENABLE=	-xc99=%all
3830Sstevel@tonic-gateC99_DISABLE=	-xc99=%none
3840Sstevel@tonic-gateC99MODE=	$(C99_DISABLE)
38565Smike_sC99LMODE=	$(C99MODE:-xc99%=-Xc99%)
3860Sstevel@tonic-gate
3870Sstevel@tonic-gate# In most places, assignments to these macros should be appended with +=
3880Sstevel@tonic-gate# (CPPFLAGS.master allows values to be prepended to CPPFLAGS).
3892745Spetedesparc_CFLAGS=	$(sparc_XARCH) $(CCSTATICSYM)
3902605Spetedesparcv9_CFLAGS=	$(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM) \
3912605Spetede		$(CCSTATICSYM)
3920Sstevel@tonic-gatei386_CFLAGS=	$(i386_XARCH)
3930Sstevel@tonic-gateamd64_CFLAGS=	$(amd64_XARCH)
3940Sstevel@tonic-gate
3950Sstevel@tonic-gatesparc_ASFLAGS=	$(sparc_AS_XARCH)
3960Sstevel@tonic-gatesparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
3970Sstevel@tonic-gatei386_ASFLAGS=	$(i386_AS_XARCH)
3980Sstevel@tonic-gateamd64_ASFLAGS=	$(amd64_AS_XARCH)
3990Sstevel@tonic-gate
4000Sstevel@tonic-gate#
4010Sstevel@tonic-gatesparc_COPTFLAG=		-xO3
4020Sstevel@tonic-gatesparcv9_COPTFLAG=	-xO3
4030Sstevel@tonic-gatei386_COPTFLAG=		-O
404282Ssherrymamd64_COPTFLAG=		-xO3
4050Sstevel@tonic-gate
4060Sstevel@tonic-gateCOPTFLAG= $($(MACH)_COPTFLAG)
4070Sstevel@tonic-gateCOPTFLAG64= $($(MACH64)_COPTFLAG)
4080Sstevel@tonic-gate
4090Sstevel@tonic-gate# When -g is used, the compiler globalizes static objects
4100Sstevel@tonic-gate# (gives them a unique prefix). Disable that.
4110Sstevel@tonic-gateCNOGLOBAL= -W0,-noglobal
4120Sstevel@tonic-gate
4132538Sesaxe# Direct the Sun Studio compiler to use a static globalization prefix based on the
4142538Sesaxe# name of the module rather than something unique. Otherwise, objects
4152538Sesaxe# will not build deterministically, as subsequent compilations of identical
4162538Sesaxe# source will yeild objects that always look different.
4172538Sesaxe#
4182538Sesaxe# In the same spirit, this will also remove the date from the N_OPT stab.
4192538SesaxeCGLOBALSTATIC= -W0,-xglobalstatic
4202538Sesaxe
421580Swesolows# Normally, gcc uses indirect DWARF strings to save space.  However,
422580Swesolows# this causes relocations that ctfconvert cannot handle.  Disable this.
423580SwesolowsCDWARFSTR=	-_gcc=-fno-dwarf2-indirect-strings
424580Swesolows
425580Swesolows# Sometimes we want all symbols and types in debugging information even
426580Swesolows# if they aren't used.
427580SwesolowsCALLSYMS=	-W0,-xdbggen=no%usedonly
428580Swesolows
4290Sstevel@tonic-gate#
4302605Spetede# Default debug format for Sun Studio 11 is dwarf, so force it to
4312605Spetede# generate stabs.
4322605Spetede#
4332605SpetedeDEBUGFORMAT=	-xdebugformat=stabs
4342605Spetede
4352605Spetede#
4360Sstevel@tonic-gate# Flags used to build in debug mode for ctf generation.  Bugs in the Devpro
4370Sstevel@tonic-gate# compilers currently prevent us from building with cc-emitted DWARF.
4380Sstevel@tonic-gate#
439580SwesolowsCTF_FLAGS_sparc	= -g -Wc,-Qiselect-T1 $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
440580SwesolowsCTF_FLAGS_i386	= -g $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
4412605SpetedeCTF_FLAGS	= $(CTF_FLAGS_$(MACH)) $(DEBUGFORMAT)
4420Sstevel@tonic-gate
4430Sstevel@tonic-gate#
4440Sstevel@tonic-gate# Flags used with genoffsets
4450Sstevel@tonic-gate#
446224SwesolowsGOFLAGS = -_noecho \
447580Swesolows	$(CALLSYMS) \
448580Swesolows	$(CDWARFSTR)
4490Sstevel@tonic-gate
4500Sstevel@tonic-gateOFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
4510Sstevel@tonic-gate	$(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
4520Sstevel@tonic-gate
4530Sstevel@tonic-gateOFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
4540Sstevel@tonic-gate	$(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
4550Sstevel@tonic-gate
4560Sstevel@tonic-gate#
4570Sstevel@tonic-gate# tradeoff time for space (smaller is better)
4580Sstevel@tonic-gate#
4592605Spetedesparc_SPACEFLAG		= -xspace -W0,-Lt
4602605Spetedesparcv9_SPACEFLAG	= -xspace -W0,-Lt
4610Sstevel@tonic-gatei386_SPACEFLAG		= -xspace
4620Sstevel@tonic-gateamd64_SPACEFLAG		=
4630Sstevel@tonic-gate
4640Sstevel@tonic-gateSPACEFLAG		= $($(MACH)_SPACEFLAG)
4650Sstevel@tonic-gateSPACEFLAG64		= $($(MACH64)_SPACEFLAG)
4660Sstevel@tonic-gate
4672605Spetede#
4682605Spetede# The Sun Studio 11 compiler has changed the behaviour of integer
4692605Spetede# wrap arounds and so a flag is needed to use the legacy behaviour
4702605Spetede# (without this flag panics/hangs could be exposed within the source).
4712605Spetede#
4722605Spetedesparc_IROPTFLAG		= -W2,-xwrap_int
4732605Spetedesparcv9_IROPTFLAG	= -W2,-xwrap_int
4742605Spetedei386_IROPTFLAG		=
4752605Spetedeamd64_IROPTFLAG		=
4762605Spetede
4772605SpetedeIROPTFLAG		= $($(MACH)_IROPTFLAG)
4782605SpetedeIROPTFLAG64		= $($(MACH64)_IROPTFLAG)
4792605Spetede
4800Sstevel@tonic-gatesparc_XREGSFLAG		= -xregs=no%appl
4810Sstevel@tonic-gatesparcv9_XREGSFLAG	= -xregs=no%appl
4820Sstevel@tonic-gatei386_XREGSFLAG		=
4830Sstevel@tonic-gateamd64_XREGSFLAG		=
4840Sstevel@tonic-gate
4850Sstevel@tonic-gateXREGSFLAG		= $($(MACH)_XREGSFLAG)
4860Sstevel@tonic-gateXREGSFLAG64		= $($(MACH64)_XREGSFLAG)
4870Sstevel@tonic-gate
4880Sstevel@tonic-gateCFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
4892605Spetede		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \
4902538Sesaxe		$(CGLOBALSTATIC)
4910Sstevel@tonic-gateCFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
4922605Spetede		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \
4932538Sesaxe		$(CGLOBALSTATIC)
4942605Spetede#
4952605Spetede# Flags that are used to build parts of the code that are subsequently
4962605Spetede# run on the build machine (also known as the NATIVE_BUILD).
4972605Spetede#
4980Sstevel@tonic-gateNATIVE_CFLAGS=	$(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
4992538Sesaxe		$(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \
5002605Spetede		$(IROPTFLAG) $(CGLOBALSTATIC)
5010Sstevel@tonic-gate
5020Sstevel@tonic-gateDTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"	# For messaging.
5030Sstevel@tonic-gateDTS_ERRNO=-D_TS_ERRNO
5040Sstevel@tonic-gateCPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
5050Sstevel@tonic-gate	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
5060Sstevel@tonic-gateCPPFLAGS=	$(CPPFLAGS.master)
5070Sstevel@tonic-gateAS_CPPFLAGS=	$(CPPFLAGS.master)
5080Sstevel@tonic-gateJAVAFLAGS=	-deprecation
5090Sstevel@tonic-gate
5100Sstevel@tonic-gate#
5110Sstevel@tonic-gate# For source message catalogue
5120Sstevel@tonic-gate#
5130Sstevel@tonic-gate.SUFFIXES: $(SUFFIXES) .i .po
5140Sstevel@tonic-gateMSGROOT= $(ROOT)/catalog
5150Sstevel@tonic-gateMSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
5160Sstevel@tonic-gateMSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
5170Sstevel@tonic-gateDCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
5180Sstevel@tonic-gateDCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
5190Sstevel@tonic-gate
5200Sstevel@tonic-gateCLOBBERFILES += $(POFILE) $(POFILES)
5210Sstevel@tonic-gateCOMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
5220Sstevel@tonic-gateXGETTEXT= /usr/bin/xgettext
5230Sstevel@tonic-gateXGETFLAGS= -c TRANSLATION_NOTE
5249396SMatthew.Ahrens@Sun.COMGNUXGETTEXT= /usr/gnu/bin/xgettext
5259396SMatthew.Ahrens@Sun.COMGNUXGETFLAGS= --add-comments=TRANSLATION_NOTE --keyword=_ \
5269396SMatthew.Ahrens@Sun.COM	--strict --no-location --omit-header
5270Sstevel@tonic-gateBUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
5280Sstevel@tonic-gate	$(RM)	$@ ;\
5296350Scarlsonj	$(SED) "/^domain/d" < $(<F).po > $@ ;\
5300Sstevel@tonic-gate	$(RM) $(<F).po $<.i
5316350Scarlsonj
5320Sstevel@tonic-gate#
5330Sstevel@tonic-gate# This is overwritten by local Makefile when PROG is a list.
5340Sstevel@tonic-gate#
5350Sstevel@tonic-gatePOFILE= $(PROG).po
5360Sstevel@tonic-gate
5370Sstevel@tonic-gatesparc_CCFLAGS=		-cg92 -compat=4 \
5380Sstevel@tonic-gate			-Qoption ccfe -messages=no%anachronism \
5390Sstevel@tonic-gate			$(CCERRWARN)
5400Sstevel@tonic-gatesparcv9_CCFLAGS=	$(sparcv9_XARCH) -dalign -compat=5 \
5410Sstevel@tonic-gate			-Qoption ccfe -messages=no%anachronism \
5420Sstevel@tonic-gate			-Qoption ccfe -features=no%conststrings \
5430Sstevel@tonic-gate			$(CCCREGSYM) \
5440Sstevel@tonic-gate			$(CCERRWARN)
5450Sstevel@tonic-gatei386_CCFLAGS=		-compat=4 \
5460Sstevel@tonic-gate			-Qoption ccfe -messages=no%anachronism \
5470Sstevel@tonic-gate			-Qoption ccfe -features=no%conststrings \
5480Sstevel@tonic-gate			$(CCERRWARN)
5490Sstevel@tonic-gateamd64_CCFLAGS=		$(amd64_XARCH) -compat=5 \
5500Sstevel@tonic-gate			-Qoption ccfe -messages=no%anachronism \
5510Sstevel@tonic-gate			-Qoption ccfe -features=no%conststrings \
5520Sstevel@tonic-gate			$(CCERRWARN)
5530Sstevel@tonic-gate
5540Sstevel@tonic-gatesparc_CCOPTFLAG=	-O
5550Sstevel@tonic-gatesparcv9_CCOPTFLAG=	-O
5560Sstevel@tonic-gatei386_CCOPTFLAG=		-O
5570Sstevel@tonic-gateamd64_CCOPTFLAG=	-O
5580Sstevel@tonic-gate
5590Sstevel@tonic-gateCCOPTFLAG=	$($(MACH)_CCOPTFLAG)
5600Sstevel@tonic-gateCCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
5610Sstevel@tonic-gateCCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS)
5620Sstevel@tonic-gateCCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS)
5634271Srie
5640Sstevel@tonic-gate#
56510696SDavid.Hollister@Sun.COM#
56610696SDavid.Hollister@Sun.COM#
56710696SDavid.Hollister@Sun.COMELFWRAP_FLAGS	=
56810696SDavid.Hollister@Sun.COMELFWRAP_FLAGS64	=	-64
56910696SDavid.Hollister@Sun.COM
57010696SDavid.Hollister@Sun.COM#
5714271Srie# Various mapfiles that are used throughout the build, and delivered to
5724271Srie# /usr/lib/ld.
5734271Srie#
574*12692SAli.Bahrami@Oracle.COMMAPFILE.NED_i386 =	$(SRC)/common/mapfiles/common/map.noexdata
5754271SrieMAPFILE.NED_sparc =
5764271SrieMAPFILE.NED =		$(MAPFILE.NED_$(MACH))
577*12692SAli.Bahrami@Oracle.COMMAPFILE.PGA =		$(SRC)/common/mapfiles/common/map.pagealign
5784271SrieMAPFILE.NES =		$(SRC)/common/mapfiles/common/map.noexstk
5794271SrieMAPFILE.FLT =		$(SRC)/common/mapfiles/common/map.filter
5804947SrieMAPFILE.LEX =		$(SRC)/common/mapfiles/common/map.lex.yy
5814271Srie
5824271Srie#
5834271Srie# Generated mapfiles that are compiler specific, and used throughout the
5844271Srie# build.  These mapfiles are not delivered in /usr/lib/ld.
5850Sstevel@tonic-gate#
5864271SrieMAPFILE.NGB_sparc=	$(SRC)/common/mapfiles/gen/sparc_cc_map.noexeglobs
5874271Srie$(__GNUC64)MAPFILE.NGB_sparc= \
5884271Srie			$(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
5894271SrieMAPFILE.NGB_sparcv9=	$(SRC)/common/mapfiles/gen/sparcv9_cc_map.noexeglobs
5904271Srie$(__GNUC64)MAPFILE.NGB_sparcv9= \
5914271Srie			$(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
5924271SrieMAPFILE.NGB_i386=	$(SRC)/common/mapfiles/gen/i386_cc_map.noexeglobs
5934271Srie$(__GNUC64)MAPFILE.NGB_i386= \
5944271Srie			$(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
5954271SrieMAPFILE.NGB_amd64=	$(SRC)/common/mapfiles/gen/amd64_cc_map.noexeglobs
5964271Srie$(__GNUC64)MAPFILE.NGB_amd64= \
5974271Srie			$(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
5984271SrieMAPFILE.NGB =		$(MAPFILE.NGB_$(MACH))
5994271Srie
6000Sstevel@tonic-gate#
6014271Srie# A generic interface mapfile name, used by various dynamic objects to define
6024271Srie# the interfaces and interposers the object must export.
6034271Srie#
6044271SrieMAPFILE.INT =		mapfile-intf
6054271Srie
6060Sstevel@tonic-gate#
6070Sstevel@tonic-gate# LDLIBS32 can be set in the environment to override the following assignment.
6080Sstevel@tonic-gate# LDLIBS64 can be set to override the assignment made in Makefile.master.64.
6090Sstevel@tonic-gate# These environment settings make sure that no libraries are searched outside
6100Sstevel@tonic-gate# of the local workspace proto area:
6110Sstevel@tonic-gate#	LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
6120Sstevel@tonic-gate#	LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
6130Sstevel@tonic-gate#
6140Sstevel@tonic-gateLDLIBS32 =	$(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
6150Sstevel@tonic-gateLDLIBS.cmd = 	$(LDLIBS32)
6160Sstevel@tonic-gateLDLIBS.lib =	$(LDLIBS32)
6170Sstevel@tonic-gate#
6180Sstevel@tonic-gate# Define compilation macros.
6190Sstevel@tonic-gate#
6200Sstevel@tonic-gateCOMPILE.c=	$(CC) $(CFLAGS) $(CPPFLAGS) -c
6210Sstevel@tonic-gateCOMPILE64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) -c
6220Sstevel@tonic-gateCOMPILE.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
6230Sstevel@tonic-gateCOMPILE64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
6240Sstevel@tonic-gateCOMPILE.s=	$(AS) $(ASFLAGS) $(AS_CPPFLAGS)
6250Sstevel@tonic-gateCOMPILE64.s=	$(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
6260Sstevel@tonic-gateCOMPILE.d=	$(DTRACE) -G -32
6270Sstevel@tonic-gateCOMPILE64.d=	$(DTRACE) -G -64
62810696SDavid.Hollister@Sun.COMCOMPILE.b=	$(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
62910696SDavid.Hollister@Sun.COMCOMPILE64.b=	$(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
6300Sstevel@tonic-gate
6310Sstevel@tonic-gateCLASSPATH=	.
6320Sstevel@tonic-gateCOMPILE.java=	$(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
6330Sstevel@tonic-gate
6340Sstevel@tonic-gate#
6350Sstevel@tonic-gate# Link time macros
6360Sstevel@tonic-gate#
6370Sstevel@tonic-gateCCNEEDED		= -lC
638411Swesolows$(__GNUC)CCNEEDED	= -L$(SFWLIBDIR) -R$(SFWLIBDIR) -lstdc++ -lgcc_s
6390Sstevel@tonic-gate
6400Sstevel@tonic-gateLINK.c=		$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
6410Sstevel@tonic-gateLINK64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
6420Sstevel@tonic-gateNORUNPATH=	-norunpath -nolib
6430Sstevel@tonic-gateLINK.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
6440Sstevel@tonic-gate		$(LDFLAGS) $(CCNEEDED)
6450Sstevel@tonic-gateLINK64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
6460Sstevel@tonic-gate		$(LDFLAGS) $(CCNEEDED)
6470Sstevel@tonic-gate
6480Sstevel@tonic-gate#
6490Sstevel@tonic-gate# lint macros
6500Sstevel@tonic-gate#
6510Sstevel@tonic-gate# Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once
6520Sstevel@tonic-gate# ON is built with a version of lint that has the fix for 4484186.
6530Sstevel@tonic-gate#
6540Sstevel@tonic-gateALWAYS_LINT_DEFS =	-errtags=yes -s
6550Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_PTRDIFF_OVERFLOW
6560Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_NARROW_CONV
6570Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-U__PRAGMA_REDEFINE_EXTNAME
6580Sstevel@tonic-gateALWAYS_LINT_DEFS +=	$(C99LMODE)
6590Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-errsecurity=$(SECLEVEL)
6600Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_SEC_CREAT_WITHOUT_EXCL
6610Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_SEC_FORBIDDEN_WARN_CREAT
6620Sstevel@tonic-gate# XX64 -- really only needed for amd64 lint
6630Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_INT_TO_SMALL_INT
6640Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_CONST_TO_SMALL_INT
6650Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_TO_SMALL_INT
6660Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_CAST_TO_PTR_FROM_INT
6670Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_COMP_INT_WITH_LARGE_INT
6680Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_INTEGRAL_CONST_EXP_EXPECTED
6690Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_PASS_INT_TO_SMALL_INT
6700Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_PTR_CONV_LOSES_BITS
6710Sstevel@tonic-gate
6728731Sjames.d.carlson@sun.com# This forces lint to pick up note.h and sys/note.h from Devpro rather than
6738731Sjames.d.carlson@sun.com# from the proto area.  The note.h that ON delivers would disable NOTE().
6748731Sjames.d.carlson@sun.comONLY_LINT_DEFS =	-I$(SPRO_VROOT)/prod/include/lint
6758731Sjames.d.carlson@sun.com
6760Sstevel@tonic-gateSECLEVEL=	core
6778731Sjames.d.carlson@sun.comLINT.c=		$(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS) $(CPPFLAGS) \
6788731Sjames.d.carlson@sun.com		$(ALWAYS_LINT_DEFS)
6798731Sjames.d.carlson@sun.comLINT64.c=	$(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS64) $(CPPFLAGS) \
6808731Sjames.d.carlson@sun.com		$(ALWAYS_LINT_DEFS)
6810Sstevel@tonic-gateLINT.s=		$(LINT.c)
6820Sstevel@tonic-gate
6830Sstevel@tonic-gate# For some future builds, NATIVE_MACH and MACH might be different.
6840Sstevel@tonic-gate# Therefore, NATIVE_MACH needs to be redefined in the
6850Sstevel@tonic-gate# environment as `uname -p` to override this macro.
6860Sstevel@tonic-gate#
6870Sstevel@tonic-gate# For now at least, we cross-compile amd64 on i386 machines.
6880Sstevel@tonic-gateNATIVE_MACH=	$(MACH:amd64=i386)
6890Sstevel@tonic-gate
6900Sstevel@tonic-gate# Define native compilation macros
6910Sstevel@tonic-gate#
6920Sstevel@tonic-gate
6930Sstevel@tonic-gate# Base directory where compilers are loaded.
6940Sstevel@tonic-gate# Defined here so it can be overridden by developer.
6950Sstevel@tonic-gate#
6960Sstevel@tonic-gateSPRO_ROOT=		$(BUILD_TOOLS)/SUNWspro
6977684SNick.Todd@Sun.COMSPRO_VROOT=		$(SPRO_ROOT)/SS12
6980Sstevel@tonic-gateGNU_ROOT=		$(SFW_ROOT)
6990Sstevel@tonic-gate
70011921SSurya.Prakki@Sun.COM# Till SS12u1 formally becomes the NV CBE, LINT is hard
70111921SSurya.Prakki@Sun.COM# coded to be picked up from the $SPRO_ROOT/sunstudio12.1/
70211921SSurya.Prakki@Sun.COM# location. Impacted variables are sparc_LINT, sparcv9_LINT,
70311921SSurya.Prakki@Sun.COM# i386_LINT, amd64_LINT.
70411921SSurya.Prakki@Sun.COM# Reset them when SS12u1 is rolled out.
70511921SSurya.Prakki@Sun.COM#
70611921SSurya.Prakki@Sun.COM
7070Sstevel@tonic-gate# Specify platform compiler versions for languages
7080Sstevel@tonic-gate# that we use (currently only c and c++).
7090Sstevel@tonic-gate#
710224Swesolowssparc_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
711224Swesolows$(__GNUC)sparc_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
712224Swesolowssparc_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
713224Swesolows$(__GNUC)sparc_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
7140Sstevel@tonic-gatesparc_CPP=		/usr/ccs/lib/cpp
7150Sstevel@tonic-gatesparc_AS=		/usr/ccs/bin/as -xregsym=no
7160Sstevel@tonic-gatesparc_LD=		/usr/ccs/bin/ld
71711921SSurya.Prakki@Sun.COMsparc_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
7180Sstevel@tonic-gate
719224Swesolowssparcv9_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
720224Swesolows$(__GNUC64)sparcv9_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
721224Swesolowssparcv9_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
722224Swesolows$(__GNUC64)sparcv9_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
7230Sstevel@tonic-gatesparcv9_CPP=		/usr/ccs/lib/cpp
7240Sstevel@tonic-gatesparcv9_AS=		/usr/ccs/bin/as -xregsym=no
7250Sstevel@tonic-gatesparcv9_LD=		/usr/ccs/bin/ld
72611921SSurya.Prakki@Sun.COMsparcv9_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
7270Sstevel@tonic-gate
7280Sstevel@tonic-gate# We compile 32-bit objects with cc by default
7290Sstevel@tonic-gatei386_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
7300Sstevel@tonic-gate$(__GNUC)i386_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
7310Sstevel@tonic-gatei386_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
7320Sstevel@tonic-gate$(__GNUC)i386_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
7330Sstevel@tonic-gatei386_CPP=		/usr/ccs/lib/cpp
7340Sstevel@tonic-gatei386_AS=		/usr/ccs/bin/as
7350Sstevel@tonic-gate$(__GNUC)i386_AS=	$(ONBLD_TOOLS)/bin/$(MACH)/aw
7360Sstevel@tonic-gatei386_LD=		/usr/ccs/bin/ld
73711921SSurya.Prakki@Sun.COMi386_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
7380Sstevel@tonic-gate
7390Sstevel@tonic-gate# We compile 64-bit objects with gcc
7400Sstevel@tonic-gateamd64_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
7410Sstevel@tonic-gate$(__GNUC64)amd64_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
7420Sstevel@tonic-gateamd64_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
7430Sstevel@tonic-gate$(__GNUC64)amd64_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
7440Sstevel@tonic-gateamd64_CPP=		/usr/ccs/lib/cpp
7450Sstevel@tonic-gateamd64_AS=		$(ONBLD_TOOLS)/bin/$(MACH)/aw
7460Sstevel@tonic-gateamd64_LD=		/usr/ccs/bin/ld
74711921SSurya.Prakki@Sun.COMamd64_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
7480Sstevel@tonic-gate
7490Sstevel@tonic-gateNATIVECC=		$($(NATIVE_MACH)_CC)
7500Sstevel@tonic-gateNATIVECCC=		$($(NATIVE_MACH)_CCC)
7510Sstevel@tonic-gateNATIVECPP=		$($(NATIVE_MACH)_CPP)
7520Sstevel@tonic-gateNATIVEAS=		$($(NATIVE_MACH)_AS)
7530Sstevel@tonic-gateNATIVELD=		$($(NATIVE_MACH)_LD)
7540Sstevel@tonic-gateNATIVELINT=		$($(NATIVE_MACH)_LINT)
7550Sstevel@tonic-gate
7560Sstevel@tonic-gate#
7570Sstevel@tonic-gate# Makefile.master.64 overrides these settings
7580Sstevel@tonic-gate#
7590Sstevel@tonic-gateCC=			$(NATIVECC)
7600Sstevel@tonic-gateCCC=			$(NATIVECCC)
7610Sstevel@tonic-gateCPP=			$(NATIVECPP)
7620Sstevel@tonic-gateAS=			$(NATIVEAS)
7630Sstevel@tonic-gateLD=			$(NATIVELD)
7640Sstevel@tonic-gateLINT=			$(NATIVELINT)
7650Sstevel@tonic-gate
766580Swesolows# The real compilers used for this build
767580SwesolowsCW_CC_CMD=		$(CC) -_compiler
768580SwesolowsCW_CCC_CMD=		$(CCC) -_compiler
769580SwesolowsREAL_CC=		$(CW_CC_CMD:sh)
770580SwesolowsREAL_CCC=		$(CW_CCC_CMD:sh)
771580Swesolows
7720Sstevel@tonic-gate# Pass -Y flag to cpp (method of which is release-dependent)
7730Sstevel@tonic-gateCCYFLAG=		-Y I,
7740Sstevel@tonic-gate
7750Sstevel@tonic-gateBDIRECT=	-Bdirect
7760Sstevel@tonic-gateBDYNAMIC=	-Bdynamic
7770Sstevel@tonic-gateBLOCAL=		-Blocal
7784271SrieBNODIRECT=	-Bnodirect
7790Sstevel@tonic-gateBREDUCE=	-Breduce
7800Sstevel@tonic-gateBSTATIC=	-Bstatic
7810Sstevel@tonic-gate
7820Sstevel@tonic-gateZDEFS=		-zdefs
7834271SrieZDIRECT=	-zdirect
7840Sstevel@tonic-gateZIGNORE=	-zignore
7850Sstevel@tonic-gateZINITFIRST=	-zinitfirst
7860Sstevel@tonic-gateZINTERPOSE=	-zinterpose
7870Sstevel@tonic-gateZLAZYLOAD=	-zlazyload
7880Sstevel@tonic-gateZLOADFLTR=	-zloadfltr
7890Sstevel@tonic-gateZMULDEFS=	-zmuldefs
7900Sstevel@tonic-gateZNODEFAULTLIB=	-znodefaultlib
7910Sstevel@tonic-gateZNODEFS=	-znodefs
7920Sstevel@tonic-gateZNODELETE=	-znodelete
7930Sstevel@tonic-gateZNODLOPEN=	-znodlopen
7940Sstevel@tonic-gateZNODUMP=	-znodump
7950Sstevel@tonic-gateZNOLAZYLOAD=	-znolazyload
7969569SRod.Evans@Sun.COMZNOLDYNSYM=	-znoldynsym
797580SwesolowsZNORELOC=	-znoreloc
7980Sstevel@tonic-gateZNOVERSION=	-znoversion
7995827SrieZRECORD=	-zrecord
8000Sstevel@tonic-gateZREDLOCSYM=	-zredlocsym
8010Sstevel@tonic-gateZTEXT=		-ztext
8024271SrieZVERBOSE=	-zverbose
8030Sstevel@tonic-gate
8040Sstevel@tonic-gateGSHARED=	-G
8050Sstevel@tonic-gateCCMT=		-mt
8060Sstevel@tonic-gate
8070Sstevel@tonic-gate# Handle different PIC models on different ISAs
8080Sstevel@tonic-gate# (May be overridden by lower-level Makefiles)
8090Sstevel@tonic-gate
8100Sstevel@tonic-gatesparc_C_PICFLAGS =	-K pic
8110Sstevel@tonic-gatesparcv9_C_PICFLAGS =	-K pic
8120Sstevel@tonic-gatei386_C_PICFLAGS =	-K pic
8130Sstevel@tonic-gateamd64_C_PICFLAGS =	-K pic
8140Sstevel@tonic-gateC_PICFLAGS =		$($(MACH)_C_PICFLAGS)
8150Sstevel@tonic-gateC_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
8160Sstevel@tonic-gate
8170Sstevel@tonic-gatesparc_C_BIGPICFLAGS =	-K PIC
8180Sstevel@tonic-gatesparcv9_C_BIGPICFLAGS =	-K PIC
8190Sstevel@tonic-gatei386_C_BIGPICFLAGS =	-K PIC
8200Sstevel@tonic-gateamd64_C_BIGPICFLAGS =	-K PIC
8210Sstevel@tonic-gateC_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
8220Sstevel@tonic-gateC_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
8230Sstevel@tonic-gate
8240Sstevel@tonic-gate# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
8250Sstevel@tonic-gatesparc_CC_PICFLAGS =	-Kpic
8260Sstevel@tonic-gatesparcv9_CC_PICFLAGS =	-KPIC
8270Sstevel@tonic-gatei386_CC_PICFLAGS = 	-Kpic
8280Sstevel@tonic-gateamd64_CC_PICFLAGS = 	-Kpic
8290Sstevel@tonic-gateCC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
8300Sstevel@tonic-gateCC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
8310Sstevel@tonic-gate
8320Sstevel@tonic-gateAS_PICFLAGS=		$(C_PICFLAGS)
8330Sstevel@tonic-gateAS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
8340Sstevel@tonic-gate
8350Sstevel@tonic-gate#
8360Sstevel@tonic-gate# Default label for CTF sections
8370Sstevel@tonic-gate#
8380Sstevel@tonic-gateCTFCVTFLAGS=		-i -L VERSION
8390Sstevel@tonic-gate
8400Sstevel@tonic-gate#
8410Sstevel@tonic-gate# Override to pass module-specific flags to ctfmerge.  Currently used
8420Sstevel@tonic-gate# only by krtld to turn on fuzzy matching.
8430Sstevel@tonic-gate#
8440Sstevel@tonic-gateCTFMRGFLAGS=
8450Sstevel@tonic-gate
8460Sstevel@tonic-gateCTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
8470Sstevel@tonic-gate
8480Sstevel@tonic-gateELFSIGN_O=	$(TRUE)
8490Sstevel@tonic-gateELFSIGN_CRYPTO=	$(ELFSIGN_O)
8500Sstevel@tonic-gateELFSIGN_OBJECT=	$(ELFSIGN_O)
8511167Skupfer$(EXPORT_RELEASE_BUILD)ELFSIGN_O =	$(ELFSIGN)
8523667Sjohnz$(EXPORT_RELEASE_BUILD)ELFSIGN_CFNAME =	SUNWosnetCF
8531167Skupfer$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY =	\
8543667Sjohnz			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CFNAME)
8551167Skupfer$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT=	\
8563667Sjohnz			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CFNAME)
8573667Sjohnz$(EXPORT_RELEASE_BUILD)ELFSIGN_SENAME =	SUNWosnetSE
8581167Skupfer$(EXPORT_RELEASE_BUILD)ELFSIGN_SEKEY =	\
8593667Sjohnz			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_SENAME)
8601167Skupfer$(EXPORT_RELEASE_BUILD)ELFSIGN_SECERT=	\
8613667Sjohnz			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_SENAME)
8621167Skupfer$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO=	$(ELFSIGN_O) sign \
8631167Skupfer			$(ELFSIGN_FORMAT_OPTION) \
8640Sstevel@tonic-gate			-k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@
8651167Skupfer$(EXPORT_RELEASE_BUILD)ELFSIGN_OBJECT=	$(ELFSIGN_O) sign \
8661167Skupfer			$(ELFSIGN_FORMAT_OPTION) \
8670Sstevel@tonic-gate			-k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@
8680Sstevel@tonic-gate
8690Sstevel@tonic-gate# Rules (normally from make.rules) and macros which are used for post
8700Sstevel@tonic-gate# processing files. Normally, these do stripping of the comment section
8710Sstevel@tonic-gate# automatically.
8720Sstevel@tonic-gate#    RELEASE_CM:	Should be editted to reflect the release.
8730Sstevel@tonic-gate#    POST_PROCESS_O:	Post-processing for `.o' files.
8740Sstevel@tonic-gate#    POST_PROCESS_A:	Post-processing for `.a' files (currently null).
8750Sstevel@tonic-gate#    POST_PROCESS_SO:	Post-processing for `.so' files.
8760Sstevel@tonic-gate#    POST_PROCESS:	Post-processing for executable files (no suffix).
8770Sstevel@tonic-gate# Note that these macros are not completely generalized as they are to be
8780Sstevel@tonic-gate# used with the file name to be processed following.
8790Sstevel@tonic-gate#
8800Sstevel@tonic-gate# It is left as an exercise to Release Engineering to embellish the generation
8810Sstevel@tonic-gate# of the release comment string.
8820Sstevel@tonic-gate#
8830Sstevel@tonic-gate#	If this is a standard development build:
8840Sstevel@tonic-gate#		compress the comment section (mcs -c)
8850Sstevel@tonic-gate#		add the standard comment (mcs -a $(RELEASE_CM))
8860Sstevel@tonic-gate#		add the development specific comment (mcs -a $(DEV_CM))
8870Sstevel@tonic-gate#
8880Sstevel@tonic-gate#	If this is an installation build:
8890Sstevel@tonic-gate#		delete the comment section (mcs -d)
8900Sstevel@tonic-gate#		add the standard comment (mcs -a $(RELEASE_CM))
8910Sstevel@tonic-gate#		add the development specific comment (mcs -a $(DEV_CM))
8920Sstevel@tonic-gate#
8930Sstevel@tonic-gate#	If this is an release build:
8940Sstevel@tonic-gate#		delete the comment section (mcs -d)
8950Sstevel@tonic-gate#		add the standard comment (mcs -a $(RELEASE_CM))
8960Sstevel@tonic-gate#
8970Sstevel@tonic-gate# The following list of macros are used in the definition of RELEASE_CM
8980Sstevel@tonic-gate# which is used to label all binaries in the build:
8990Sstevel@tonic-gate#
9000Sstevel@tonic-gate# 	RELEASE		Specific release of the build, eg: 5.2
9015303Smeem#	RELEASE_MAJOR	Major version number part of $(RELEASE)
9025303Smeem#	RELEASE_MINOR	Minor version number part of $(RELEASE)
9030Sstevel@tonic-gate#	VERSION		Version of the build (alpha, beta, Generic)
9040Sstevel@tonic-gate#	PATCHID		If this is a patch this value should contain
9050Sstevel@tonic-gate#			the patchid value (eg: "Generic 100832-01"), otherwise
9060Sstevel@tonic-gate#			it will be set to $(VERSION)
9070Sstevel@tonic-gate#	RELEASE_DATE	Date of the Release Build
9080Sstevel@tonic-gate#	PATCH_DATE	Date the patch was created, if this is blank it
9090Sstevel@tonic-gate#			will default to the RELEASE_DATE
9100Sstevel@tonic-gate#
9115303SmeemRELEASE_MAJOR=	5
9125303SmeemRELEASE_MINOR=	11
9135303SmeemRELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
9140Sstevel@tonic-gateVERSION=	SunOS Development
9150Sstevel@tonic-gatePATCHID=	$(VERSION)
91610738SJames.McPherson@Sun.COMRELEASE_DATE=	release date not set
9170Sstevel@tonic-gatePATCH_DATE=	$(RELEASE_DATE)
9180Sstevel@tonic-gateRELEASE_CM=	"@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
91910738SJames.McPherson@Sun.COMDEV_CM=		"@($(POUND_SIGN))SunOS Internal Development: non-nightly build"
9200Sstevel@tonic-gate
9210Sstevel@tonic-gatePROCESS_COMMENT=		   @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
9220Sstevel@tonic-gate$(STRIP_COMMENTS)PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
9230Sstevel@tonic-gate$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
9240Sstevel@tonic-gate
9250Sstevel@tonic-gateSTRIP_STABS=			   :
9260Sstevel@tonic-gate$(RELEASE_BUILD)STRIP_STABS=	   $(STRIP) -x $@
9270Sstevel@tonic-gate
9280Sstevel@tonic-gatePOST_PROCESS_O=		$(PROCESS_COMMENT) $@
9290Sstevel@tonic-gatePOST_PROCESS_A=
9300Sstevel@tonic-gatePOST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
9310Sstevel@tonic-gate			$(ELFSIGN_OBJECT)
932524SriePOST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
933524Srie			$(ELFSIGN_OBJECT)
9340Sstevel@tonic-gate
9350Sstevel@tonic-gate#
9369507SJerry.Gilliam@Sun.COM# chk4ubin is a tool that inspects a module for a symbol table
9379507SJerry.Gilliam@Sun.COM# ELF section size which can trigger an OBP bug on older platforms.
9389507SJerry.Gilliam@Sun.COM# This problem affects only specific sun4u bootable modules.
9399507SJerry.Gilliam@Sun.COM#
9409507SJerry.Gilliam@Sun.COMCHK4UBIN=	$(ONBLD_TOOLS)/bin/$(MACH)/chk4ubin
9419507SJerry.Gilliam@Sun.COMCHK4UBINFLAGS=
9429507SJerry.Gilliam@Sun.COMCHK4UBINARY=	$(CHK4UBIN) $(CHK4UBINFLAGS) $@
9439507SJerry.Gilliam@Sun.COM
9449507SJerry.Gilliam@Sun.COM#
9450Sstevel@tonic-gate# PKGARCHIVE specifies the default location where packages should be
9460Sstevel@tonic-gate# placed if built.
9470Sstevel@tonic-gate#
9480Sstevel@tonic-gate$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
9490Sstevel@tonic-gatePKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
9500Sstevel@tonic-gate
95111838SLiane.Praza@Sun.COM#
95211838SLiane.Praza@Sun.COM# The repositories will be created with these publisher settings.  To
95311838SLiane.Praza@Sun.COM# update an image to the resulting repositories, this must match the
95411838SLiane.Praza@Sun.COM# publisher name provided to "pkg set-publisher."
95511838SLiane.Praza@Sun.COM#
95611838SLiane.Praza@Sun.COMPKGPUBLISHER_REDIST=	on-nightly
95711838SLiane.Praza@Sun.COMPKGPUBLISHER_NONREDIST=	on-extra
95811838SLiane.Praza@Sun.COM
9590Sstevel@tonic-gate#	Default build rules which perform comment section post-processing.
9600Sstevel@tonic-gate#
9610Sstevel@tonic-gate.c:
9620Sstevel@tonic-gate	$(LINK.c) -o $@ $< $(LDLIBS)
9630Sstevel@tonic-gate	$(POST_PROCESS)
9640Sstevel@tonic-gate.c.o:
9650Sstevel@tonic-gate	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
9660Sstevel@tonic-gate	$(POST_PROCESS_O)
9670Sstevel@tonic-gate.c.a:
9680Sstevel@tonic-gate	$(COMPILE.c) -o $% $<
9690Sstevel@tonic-gate	$(PROCESS_COMMENT) $%
9700Sstevel@tonic-gate	$(AR) $(ARFLAGS) $@ $%
9710Sstevel@tonic-gate	$(RM) $%
9720Sstevel@tonic-gate.s.o:
9730Sstevel@tonic-gate	$(COMPILE.s) -o $@ $<
9740Sstevel@tonic-gate	$(POST_PROCESS_O)
9750Sstevel@tonic-gate.s.a:
9760Sstevel@tonic-gate	$(COMPILE.s) -o $% $<
9770Sstevel@tonic-gate	$(PROCESS_COMMENT) $%
9780Sstevel@tonic-gate	$(AR) $(ARFLAGS) $@ $%
9790Sstevel@tonic-gate	$(RM) $%
9800Sstevel@tonic-gate.cc:
9810Sstevel@tonic-gate	$(LINK.cc) -o $@ $< $(LDLIBS)
9820Sstevel@tonic-gate	$(POST_PROCESS)
9830Sstevel@tonic-gate.cc.o:
9840Sstevel@tonic-gate	$(COMPILE.cc) $(OUTPUT_OPTION) $<
9850Sstevel@tonic-gate	$(POST_PROCESS_O)
9860Sstevel@tonic-gate.cc.a:
9870Sstevel@tonic-gate	$(COMPILE.cc) -o $% $<
9880Sstevel@tonic-gate	$(AR) $(ARFLAGS) $@ $%
9890Sstevel@tonic-gate	$(PROCESS_COMMENT) $%
9900Sstevel@tonic-gate	$(RM) $%
9910Sstevel@tonic-gate.y:
9920Sstevel@tonic-gate	$(YACC.y) $<
9930Sstevel@tonic-gate	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
9940Sstevel@tonic-gate	$(POST_PROCESS)
9950Sstevel@tonic-gate	$(RM) y.tab.c
9960Sstevel@tonic-gate.y.o:
9970Sstevel@tonic-gate	$(YACC.y) $<
9980Sstevel@tonic-gate	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
9990Sstevel@tonic-gate	$(POST_PROCESS_O)
10000Sstevel@tonic-gate	$(RM) y.tab.c
10010Sstevel@tonic-gate.l:
10020Sstevel@tonic-gate	$(RM) $*.c
10030Sstevel@tonic-gate	$(LEX.l) $< > $*.c
10040Sstevel@tonic-gate	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
10050Sstevel@tonic-gate	$(POST_PROCESS)
10060Sstevel@tonic-gate	$(RM) $*.c
10070Sstevel@tonic-gate.l.o:
10080Sstevel@tonic-gate	$(RM) $*.c
10090Sstevel@tonic-gate	$(LEX.l) $< > $*.c
10100Sstevel@tonic-gate	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
10110Sstevel@tonic-gate	$(POST_PROCESS_O)
10120Sstevel@tonic-gate	$(RM) $*.c
10130Sstevel@tonic-gate
101410696SDavid.Hollister@Sun.COM.bin.o:
101510696SDavid.Hollister@Sun.COM	$(COMPILE.b) -o $@ $<
101610696SDavid.Hollister@Sun.COM	$(POST_PROCESS_O)
101710696SDavid.Hollister@Sun.COM
10180Sstevel@tonic-gate.java.class:
10190Sstevel@tonic-gate	$(COMPILE.java) $<
10200Sstevel@tonic-gate
10216350Scarlsonj# Bourne and Korn shell script message catalog build rules.
10226350Scarlsonj# We extract all gettext strings with sed(1) (being careful to permit
10236350Scarlsonj# multiple gettext strings on the same line), weed out the dups, and
10246350Scarlsonj# build the catalogue with awk(1).
10250Sstevel@tonic-gate
10266350Scarlsonj.sh.po .ksh.po:
10276350Scarlsonj	$(SED) -n -e ":a" 				\
10280Sstevel@tonic-gate		  -e "h" 					\
10290Sstevel@tonic-gate		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
10300Sstevel@tonic-gate		  -e "x"					\
10310Sstevel@tonic-gate		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
10320Sstevel@tonic-gate		  -e "t a"					\
10330Sstevel@tonic-gate	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
10340Sstevel@tonic-gate
10356350Scarlsonj#
10366350Scarlsonj# Python and Perl executable and message catalog build rules.
10376350Scarlsonj#
10387078Smjnelson.SUFFIXES: .pl .pm .py .pyc
10396350Scarlsonj
10406350Scarlsonj.pl:
10416350Scarlsonj	$(RM) $@;
10426350Scarlsonj	$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
10436350Scarlsonj	$(CHMOD) +x $@
10446350Scarlsonj
10456350Scarlsonj.py:
10466350Scarlsonj	$(RM) $@; $(CAT) $< > $@; $(CHMOD) +x $@
10476350Scarlsonj
10487078Smjnelson.py.pyc:
10497078Smjnelson	$(RM) $@
10507078Smjnelson	$(PYTHON) -mpy_compile $<
10517078Smjnelson	@[ $(<)c = $@ ] || $(MV) $(<)c $@
10527078Smjnelson
10539396SMatthew.Ahrens@Sun.COM.py.po:
10549396SMatthew.Ahrens@Sun.COM	$(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ;
10559396SMatthew.Ahrens@Sun.COM
10566350Scarlsonj.pl.po .pm.po:
10576350Scarlsonj	$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
10586350Scarlsonj	$(RM)	$@ ;
10596350Scarlsonj	$(SED) "/^domain/d" < $(<F).po > $@ ;
10606350Scarlsonj	$(RM) $(<F).po
10612712Snn35248
10620Sstevel@tonic-gate#
10630Sstevel@tonic-gate# When using xgettext, we want messages to go to the default domain,
10640Sstevel@tonic-gate# rather than the specified one.  This special version of the
10650Sstevel@tonic-gate# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
10660Sstevel@tonic-gate# causing xgettext to put all messages into the default domain.
10670Sstevel@tonic-gate#
10680Sstevel@tonic-gateCPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
10690Sstevel@tonic-gate
10700Sstevel@tonic-gate.c.i:
10710Sstevel@tonic-gate	$(CPPFORPO) $< > $@
10720Sstevel@tonic-gate
10730Sstevel@tonic-gate.h.i:
10740Sstevel@tonic-gate	$(CPPFORPO) $< > $@
10750Sstevel@tonic-gate
10760Sstevel@tonic-gate.y.i:
10770Sstevel@tonic-gate	$(YACC) -d $<
10780Sstevel@tonic-gate	$(CPPFORPO) y.tab.c  > $@
10790Sstevel@tonic-gate	$(RM) y.tab.c
10800Sstevel@tonic-gate
10810Sstevel@tonic-gate.l.i:
10820Sstevel@tonic-gate	$(LEX) $<
10830Sstevel@tonic-gate	$(CPPFORPO) lex.yy.c  > $@
10840Sstevel@tonic-gate	$(RM) lex.yy.c
10850Sstevel@tonic-gate
10860Sstevel@tonic-gate.c.po:
10870Sstevel@tonic-gate	$(CPPFORPO) $< > $<.i
10880Sstevel@tonic-gate	$(BUILD.po)
10890Sstevel@tonic-gate
10900Sstevel@tonic-gate.y.po:
10910Sstevel@tonic-gate	$(YACC) -d $<
10920Sstevel@tonic-gate	$(CPPFORPO) y.tab.c  > $<.i
10930Sstevel@tonic-gate	$(BUILD.po)
10940Sstevel@tonic-gate	$(RM) y.tab.c
10950Sstevel@tonic-gate
10960Sstevel@tonic-gate.l.po:
10970Sstevel@tonic-gate	$(LEX) $<
10980Sstevel@tonic-gate	$(CPPFORPO) lex.yy.c  > $<.i
10990Sstevel@tonic-gate	$(BUILD.po)
11000Sstevel@tonic-gate	$(RM) lex.yy.c
11010Sstevel@tonic-gate
11020Sstevel@tonic-gate#
11030Sstevel@tonic-gate# Rules to perform stylistic checks
11040Sstevel@tonic-gate#
11056350Scarlsonj.SUFFIXES: .x .xml .check .xmlchk
11060Sstevel@tonic-gate
11070Sstevel@tonic-gate.h.check:
11080Sstevel@tonic-gate	$(DOT_H_CHECK)
11090Sstevel@tonic-gate
11100Sstevel@tonic-gate.x.check:
11110Sstevel@tonic-gate	$(DOT_X_CHECK)
11120Sstevel@tonic-gate
11130Sstevel@tonic-gate.xml.xmlchk:
11140Sstevel@tonic-gate	$(MANIFEST_CHECK)
11150Sstevel@tonic-gate
11160Sstevel@tonic-gate#
11170Sstevel@tonic-gate# Rules to process ONC+ Source partial files
11180Sstevel@tonic-gate#
11190Sstevel@tonic-gate%_onc_plus:	%
11200Sstevel@tonic-gate	@$(ECHO) "extracting code from $< ... "
11210Sstevel@tonic-gate	sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $<  > $@
11221810Ssommerfe
11231810Ssommerfe#
11241810Ssommerfe# Include rules to render automated sccs get rules "safe".
11251810Ssommerfe#
11261810Ssommerfeinclude $(SRC)/Makefile.noget
1127