xref: /titanic_52/usr/src/Makefile.master (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate#
2*7c478bd9Sstevel@tonic-gate# CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate#
4*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate# with the License.
8*7c478bd9Sstevel@tonic-gate#
9*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate# and limitations under the License.
13*7c478bd9Sstevel@tonic-gate#
14*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate#
20*7c478bd9Sstevel@tonic-gate# CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate#
22*7c478bd9Sstevel@tonic-gate#
23*7c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate# Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate#
26*7c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
27*7c478bd9Sstevel@tonic-gate#
28*7c478bd9Sstevel@tonic-gate# Makefile.master, global definitions for system source
29*7c478bd9Sstevel@tonic-gate#
30*7c478bd9Sstevel@tonic-gateROOT=		/proto
31*7c478bd9Sstevel@tonic-gate
32*7c478bd9Sstevel@tonic-gate# Historically, ON builds were always done with root permissions, and the
33*7c478bd9Sstevel@tonic-gate# owner/group information was duplicated in the Makefiles and the packaging
34*7c478bd9Sstevel@tonic-gate# data and kept in sync by manual intervention.  This is no longer true.
35*7c478bd9Sstevel@tonic-gate# The only source of this information is packaging.  The proto area ($ROOT)
36*7c478bd9Sstevel@tonic-gate# does not have definitive onwer/group information, and no Makefile should
37*7c478bd9Sstevel@tonic-gate# attempt to set this.  CH once toggled operations restricted to root.  It
38*7c478bd9Sstevel@tonic-gate# is now just set to `#'.
39*7c478bd9Sstevel@tonic-gate#
40*7c478bd9Sstevel@tonic-gate# At some point in the future, CH, CHOWN, CHGRP, OWNER, and GROUP should all
41*7c478bd9Sstevel@tonic-gate# be stripped completely from the source base.  They are kept for now until
42*7c478bd9Sstevel@tonic-gate# on10-based projects can merge and transition away from them.
43*7c478bd9Sstevel@tonic-gate#
44*7c478bd9Sstevel@tonic-gate# RELEASE_BUILD should be cleared for final release builds. This is completely
45*7c478bd9Sstevel@tonic-gate# independent of CH. NOT_RELEASE_BUILD is exactly what the name implies.
46*7c478bd9Sstevel@tonic-gate#
47*7c478bd9Sstevel@tonic-gate# INTERNAL_RELEASE_BUILD is a subset of RELEASE_BUILD. It mostly controls
48*7c478bd9Sstevel@tonic-gate# identification strings. Enabling RELEASE_BUILD automatically enables
49*7c478bd9Sstevel@tonic-gate# INTERNAL_RELEASE_BUILD.
50*7c478bd9Sstevel@tonic-gate#
51*7c478bd9Sstevel@tonic-gate# EXPORT_RELEASE_BUILD controls whether binaries are built in a form that
52*7c478bd9Sstevel@tonic-gate# can be released for export under a binary license.  It is orthogonal to
53*7c478bd9Sstevel@tonic-gate# the other *RELEASE_BUILD settings.
54*7c478bd9Sstevel@tonic-gate#
55*7c478bd9Sstevel@tonic-gate# STRIP_COMMENTS toggles comment section striping. Generally the same setting
56*7c478bd9Sstevel@tonic-gate# as INTERNAL_RELEASE_BUILD.
57*7c478bd9Sstevel@tonic-gate#
58*7c478bd9Sstevel@tonic-gate# STRIPFLAG is similar.  It is set here for use in lower level Makefiles to
59*7c478bd9Sstevel@tonic-gate# allow a single point change to affect the entire build.
60*7c478bd9Sstevel@tonic-gate#
61*7c478bd9Sstevel@tonic-gate# __GNUC toggles the building of ON components using gcc and related tools.
62*7c478bd9Sstevel@tonic-gate# Normally set to `#', set it to `' to do gcc build.
63*7c478bd9Sstevel@tonic-gate#
64*7c478bd9Sstevel@tonic-gate# The declaration POUND_SIGN is always '#'. This is needed to get around the
65*7c478bd9Sstevel@tonic-gate# make feature that '#' is always a comment delimiter, even when escaped or
66*7c478bd9Sstevel@tonic-gate# quoted.  The only way of generating this is the :sh macro mechanism.  Note
67*7c478bd9Sstevel@tonic-gate# however that in general :sh macros should be avoided in makefiles that are
68*7c478bd9Sstevel@tonic-gate# widely included into other makefiles, as the resulting shell executions can
69*7c478bd9Sstevel@tonic-gate# cause a noticable slowdown in build times.
70*7c478bd9Sstevel@tonic-gate#
71*7c478bd9Sstevel@tonic-gatePOUND_SIGN:sh=				echo \\043
72*7c478bd9Sstevel@tonic-gateCH=					$(POUND_SIGN)
73*7c478bd9Sstevel@tonic-gate
74*7c478bd9Sstevel@tonic-gateNOT_RELEASE_BUILD=
75*7c478bd9Sstevel@tonic-gateINTERNAL_RELEASE_BUILD=			$(POUND_SIGN)
76*7c478bd9Sstevel@tonic-gateRELEASE_BUILD=				$(POUND_SIGN)
77*7c478bd9Sstevel@tonic-gateEXPORT_RELEASE_BUILD=
78*7c478bd9Sstevel@tonic-gate$(RELEASE_BUILD)NOT_RELEASE_BUILD=	$(POUND_SIGN)
79*7c478bd9Sstevel@tonic-gate$(RELEASE_BUILD)INTERNAL_RELEASE_BUILD=
80*7c478bd9Sstevel@tonic-gatePATCH_BUILD=				$(POUND_SIGN)
81*7c478bd9Sstevel@tonic-gate
82*7c478bd9Sstevel@tonic-gate# SPARC_BLD is '#' for an Intel build.
83*7c478bd9Sstevel@tonic-gate# INTEL_BLD is '#' for a Sparc build.
84*7c478bd9Sstevel@tonic-gateSPARC_BLD_1=    $(MACH:i386=$(POUND_SIGN))
85*7c478bd9Sstevel@tonic-gateSPARC_BLD=      $(SPARC_BLD_1:sparc=)
86*7c478bd9Sstevel@tonic-gateINTEL_BLD_1=    $(MACH:sparc=$(POUND_SIGN))
87*7c478bd9Sstevel@tonic-gateINTEL_BLD=      $(INTEL_BLD_1:i386=)
88*7c478bd9Sstevel@tonic-gate
89*7c478bd9Sstevel@tonic-gateSTRIP_COMMENTS=	$(INTERNAL_RELEASE_BUILD)
90*7c478bd9Sstevel@tonic-gate
91*7c478bd9Sstevel@tonic-gate# Historical notes: at one point, STRIPFLAG was set to '-s' for root builds,
92*7c478bd9Sstevel@tonic-gate# and empty for non-root.  It's now set empty all the time, so that builds
93*7c478bd9Sstevel@tonic-gate# using manual invocation of "make install" will have debug data (as they did
94*7c478bd9Sstevel@tonic-gate# when run as non-root before).  The 'nightly' script overrides DEF_STRIPFLAG
95*7c478bd9Sstevel@tonic-gate# with '-s' so that nightly builds are stripped -- since nightlies were once
96*7c478bd9Sstevel@tonic-gate# done only as root, that preserves the known nightly behavior.  The
97*7c478bd9Sstevel@tonic-gate# non-nightly behavior can always be overridden by putting "STRIPFLAG=" in the
98*7c478bd9Sstevel@tonic-gate# environment, on the 'make' command line, or by overriding STRIPFLAG in the
99*7c478bd9Sstevel@tonic-gate# subsystem Makefile itself.  STRIP_COMMENTS, although similar in nature, has
100*7c478bd9Sstevel@tonic-gate# always been controlled by INTERNAL_RELEASE_BUILD (always set by nightly).
101*7c478bd9Sstevel@tonic-gate
102*7c478bd9Sstevel@tonic-gateDEF_STRIPFLAG=
103*7c478bd9Sstevel@tonic-gateSTRIPFLAG=$(DEF_STRIPFLAG)
104*7c478bd9Sstevel@tonic-gate
105*7c478bd9Sstevel@tonic-gate# set __GNUC= in the environment to build 32-bit with the gcc compiler.
106*7c478bd9Sstevel@tonic-gate__GNUC=		$(POUND_SIGN)
107*7c478bd9Sstevel@tonic-gate
108*7c478bd9Sstevel@tonic-gate# set __GNUC64 to '#' in the environment to build 64-bit with the Studio
109*7c478bd9Sstevel@tonic-gate# compiler.
110*7c478bd9Sstevel@tonic-gate__GNUC64=
111*7c478bd9Sstevel@tonic-gate
112*7c478bd9Sstevel@tonic-gate# BUILD_TOOLS is the root of all tools including compilers.
113*7c478bd9Sstevel@tonic-gate# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
114*7c478bd9Sstevel@tonic-gate
115*7c478bd9Sstevel@tonic-gateBUILD_TOOLS=		/ws/onnv-tools
116*7c478bd9Sstevel@tonic-gateONBLD_TOOLS=		$(BUILD_TOOLS)/onbld
117*7c478bd9Sstevel@tonic-gate
118*7c478bd9Sstevel@tonic-gateJAVA_ROOT=	/usr/java
119*7c478bd9Sstevel@tonic-gate
120*7c478bd9Sstevel@tonic-gateSFW_ROOT=	/usr/sfw
121*7c478bd9Sstevel@tonic-gateSFWLIBDIR=	$(SFW_ROOT)/lib
122*7c478bd9Sstevel@tonic-gateSFWLIBDIR64=	$(SFW_ROOT)/lib/$(MACH64)
123*7c478bd9Sstevel@tonic-gate
124*7c478bd9Sstevel@tonic-gateRPCGEN=		/usr/bin/rpcgen
125*7c478bd9Sstevel@tonic-gateSTABS=		$(ONBLD_TOOLS)/bin/$(MACH)/stabs
126*7c478bd9Sstevel@tonic-gateECHO=		echo
127*7c478bd9Sstevel@tonic-gateINS=		install
128*7c478bd9Sstevel@tonic-gateTRUE=		true
129*7c478bd9Sstevel@tonic-gateSYMLINK=	/usr/bin/ln -s
130*7c478bd9Sstevel@tonic-gateLN=		/usr/bin/ln
131*7c478bd9Sstevel@tonic-gateCHMOD=		/usr/bin/chmod
132*7c478bd9Sstevel@tonic-gateCHOWN=		$(TRUE)
133*7c478bd9Sstevel@tonic-gateCHGRP=		$(TRUE)
134*7c478bd9Sstevel@tonic-gateMV=		/usr/bin/mv -f
135*7c478bd9Sstevel@tonic-gateRM=		/usr/bin/rm -f
136*7c478bd9Sstevel@tonic-gateGREP=		/usr/bin/grep
137*7c478bd9Sstevel@tonic-gateSED=		/usr/bin/sed
138*7c478bd9Sstevel@tonic-gateNAWK=		/usr/bin/nawk
139*7c478bd9Sstevel@tonic-gateCP=		/usr/bin/cp -f
140*7c478bd9Sstevel@tonic-gateMCS=		/usr/ccs/bin/mcs
141*7c478bd9Sstevel@tonic-gateCAT=            /usr/bin/cat
142*7c478bd9Sstevel@tonic-gateM4=		/usr/ccs/bin/m4
143*7c478bd9Sstevel@tonic-gateSTRIP=		/usr/ccs/bin/strip
144*7c478bd9Sstevel@tonic-gateLEX=		/usr/ccs/bin/lex
145*7c478bd9Sstevel@tonic-gateYACC=		/usr/ccs/bin/yacc
146*7c478bd9Sstevel@tonic-gateCPP=		/usr/lib/cpp
147*7c478bd9Sstevel@tonic-gateJAVAC=		$(JAVA_ROOT)/bin/javac
148*7c478bd9Sstevel@tonic-gateJAVAH=		$(JAVA_ROOT)/bin/javah
149*7c478bd9Sstevel@tonic-gateJAVADOC=	$(JAVA_ROOT)/bin/javadoc
150*7c478bd9Sstevel@tonic-gateRMIC=		$(JAVA_ROOT)/bin/rmic
151*7c478bd9Sstevel@tonic-gateJAR=		$(JAVA_ROOT)/bin/jar
152*7c478bd9Sstevel@tonic-gateCTFCONVERT=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
153*7c478bd9Sstevel@tonic-gateCTFMERGE=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
154*7c478bd9Sstevel@tonic-gateCTFSTABS=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
155*7c478bd9Sstevel@tonic-gateGENOFFSETS=	$(ONBLD_TOOLS)/bin/genoffsets
156*7c478bd9Sstevel@tonic-gateCTFCVTPTBL=	$(ONBLD_TOOLS)/bin/ctfcvtptbl
157*7c478bd9Sstevel@tonic-gateCTFFINDMOD=	$(ONBLD_TOOLS)/bin/ctffindmod
158*7c478bd9Sstevel@tonic-gateXREF=		$(ONBLD_TOOLS)/bin/xref
159*7c478bd9Sstevel@tonic-gateFIND=		/usr/bin/find
160*7c478bd9Sstevel@tonic-gatePERL=		/usr/bin/perl
161*7c478bd9Sstevel@tonic-gateSORT=		/usr/bin/sort
162*7c478bd9Sstevel@tonic-gateTOUCH=		/usr/bin/touch
163*7c478bd9Sstevel@tonic-gateWC=		/usr/bin/wc
164*7c478bd9Sstevel@tonic-gateXARGS=		/usr/bin/xargs
165*7c478bd9Sstevel@tonic-gateELFSIGN=	/usr/bin/elfsign
166*7c478bd9Sstevel@tonic-gateDTRACE=		/usr/sbin/dtrace
167*7c478bd9Sstevel@tonic-gate
168*7c478bd9Sstevel@tonic-gateFILEMODE=	644
169*7c478bd9Sstevel@tonic-gateDIRMODE=	755
170*7c478bd9Sstevel@tonic-gate
171*7c478bd9Sstevel@tonic-gate# Note: owner and group for proto area objects is no longer set by
172*7c478bd9Sstevel@tonic-gate# Makefiles at all.  These have no real effect and are kept here for
173*7c478bd9Sstevel@tonic-gate# transition purposes.  They (along with CH, CHOWN, and CHGRP) should be
174*7c478bd9Sstevel@tonic-gate# removed early in the s11 development cycle.
175*7c478bd9Sstevel@tonic-gateOWNER=		root
176*7c478bd9Sstevel@tonic-gateGROUP=		bin
177*7c478bd9Sstevel@tonic-gate
178*7c478bd9Sstevel@tonic-gate#
179*7c478bd9Sstevel@tonic-gate# The version of the patch makeup table optimized for build-time use.  Used
180*7c478bd9Sstevel@tonic-gate# during patch builds only.
181*7c478bd9Sstevel@tonic-gate$(PATCH_BUILD)PMTMO_FILE=$(SRC)/patch_makeup_table.mo
182*7c478bd9Sstevel@tonic-gate
183*7c478bd9Sstevel@tonic-gate# Declare that nothing should be built in parallel.
184*7c478bd9Sstevel@tonic-gate# Individual Makefiles can use the .PARALLEL target to declare otherwise.
185*7c478bd9Sstevel@tonic-gate.NO_PARALLEL:
186*7c478bd9Sstevel@tonic-gate
187*7c478bd9Sstevel@tonic-gate# For stylistic checks
188*7c478bd9Sstevel@tonic-gate#
189*7c478bd9Sstevel@tonic-gate# Note that the X and C checks are not used at this time and may need
190*7c478bd9Sstevel@tonic-gate# modification when they are actually used.
191*7c478bd9Sstevel@tonic-gate#
192*7c478bd9Sstevel@tonic-gateCSTYLE=		cstyle
193*7c478bd9Sstevel@tonic-gateCSTYLE_TAIL=
194*7c478bd9Sstevel@tonic-gateHDRCHK=		hdrchk
195*7c478bd9Sstevel@tonic-gateHDRCHK_TAIL=
196*7c478bd9Sstevel@tonic-gateJSTYLE=		jstyle
197*7c478bd9Sstevel@tonic-gate
198*7c478bd9Sstevel@tonic-gateDOT_H_CHECK=	\
199*7c478bd9Sstevel@tonic-gate	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
200*7c478bd9Sstevel@tonic-gate	$(HDRCHK) $< $(HDRCHK_TAIL)
201*7c478bd9Sstevel@tonic-gate
202*7c478bd9Sstevel@tonic-gateDOT_X_CHECK=	\
203*7c478bd9Sstevel@tonic-gate	@$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
204*7c478bd9Sstevel@tonic-gate	$(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
205*7c478bd9Sstevel@tonic-gate
206*7c478bd9Sstevel@tonic-gateDOT_C_CHECK=	\
207*7c478bd9Sstevel@tonic-gate	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
208*7c478bd9Sstevel@tonic-gate
209*7c478bd9Sstevel@tonic-gateMANIFEST_CHECK=	\
210*7c478bd9Sstevel@tonic-gate	@$(ECHO) "checking $<"; \
211*7c478bd9Sstevel@tonic-gate	SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
212*7c478bd9Sstevel@tonic-gate	$(SRC)/cmd/svc/svccfg/svccfg-native validate $<
213*7c478bd9Sstevel@tonic-gate
214*7c478bd9Sstevel@tonic-gateINS.file=	$(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
215*7c478bd9Sstevel@tonic-gateINS.dir=	$(INS) -s -d -m $(DIRMODE) $@
216*7c478bd9Sstevel@tonic-gate# installs and renames at once
217*7c478bd9Sstevel@tonic-gate#
218*7c478bd9Sstevel@tonic-gateINS.rename=	$(INS.file); $(MV) $(@D)/$(<F) $@
219*7c478bd9Sstevel@tonic-gate
220*7c478bd9Sstevel@tonic-gate# install a link
221*7c478bd9Sstevel@tonic-gateINSLINKTARGET=	$<
222*7c478bd9Sstevel@tonic-gateINS.link=	$(RM) $@; $(LN) $(INSLINKTARGET) $@
223*7c478bd9Sstevel@tonic-gate
224*7c478bd9Sstevel@tonic-gate# MACH must be set in the shell environment per uname -p on the build host
225*7c478bd9Sstevel@tonic-gate# More specific architecture variables should be set in lower makefiles.
226*7c478bd9Sstevel@tonic-gate#
227*7c478bd9Sstevel@tonic-gate# MACH64 is derived from MACH, and BUILD64 is set to `#' for
228*7c478bd9Sstevel@tonic-gate# architectures on which we do not build 64-bit versions.
229*7c478bd9Sstevel@tonic-gate# (There are no such architectures at the moment.)
230*7c478bd9Sstevel@tonic-gate#
231*7c478bd9Sstevel@tonic-gate# Set BUILD64=# in the environment to disable 64-bit amd64
232*7c478bd9Sstevel@tonic-gate# builds on i386 machines.
233*7c478bd9Sstevel@tonic-gate
234*7c478bd9Sstevel@tonic-gateMACH64_1=	$(MACH:sparc=sparcv9)
235*7c478bd9Sstevel@tonic-gateMACH64=		$(MACH64_1:i386=amd64)
236*7c478bd9Sstevel@tonic-gate
237*7c478bd9Sstevel@tonic-gateMACH32_1=	$(MACH:sparc=sparcv7)
238*7c478bd9Sstevel@tonic-gateMACH32=		$(MACH32_1:i386=i86)
239*7c478bd9Sstevel@tonic-gate
240*7c478bd9Sstevel@tonic-gatesparc_BUILD64=
241*7c478bd9Sstevel@tonic-gatei386_BUILD64=
242*7c478bd9Sstevel@tonic-gateBUILD64=	$($(MACH)_BUILD64)
243*7c478bd9Sstevel@tonic-gate
244*7c478bd9Sstevel@tonic-gate#
245*7c478bd9Sstevel@tonic-gate# C compiler mode. Future compilers may change the default on us,
246*7c478bd9Sstevel@tonic-gate# so force extended ANSI mode globally. Lower level makefiles can
247*7c478bd9Sstevel@tonic-gate# override this by setting CCMODE.
248*7c478bd9Sstevel@tonic-gate#
249*7c478bd9Sstevel@tonic-gateCCMODE=			-Xa
250*7c478bd9Sstevel@tonic-gateCCMODE64=		-Xa
251*7c478bd9Sstevel@tonic-gate
252*7c478bd9Sstevel@tonic-gate#
253*7c478bd9Sstevel@tonic-gate# C compiler verbose mode. This is so we can enable it globally,
254*7c478bd9Sstevel@tonic-gate# but turn it off in the lower level makefiles of things we cannot
255*7c478bd9Sstevel@tonic-gate# (or aren't going to) fix.
256*7c478bd9Sstevel@tonic-gate#
257*7c478bd9Sstevel@tonic-gateCCVERBOSE=		-v
258*7c478bd9Sstevel@tonic-gate
259*7c478bd9Sstevel@tonic-gate# set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings
260*7c478bd9Sstevel@tonic-gate# from the compiler about places the -xarch=v9 may differ from -xarch=v9c.
261*7c478bd9Sstevel@tonic-gateV9ABIWARN=
262*7c478bd9Sstevel@tonic-gate
263*7c478bd9Sstevel@tonic-gate# set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register
264*7c478bd9Sstevel@tonic-gate# symbols (used to detect conflicts between objects that use global registers)
265*7c478bd9Sstevel@tonic-gate# we disable this now for safety, and because genunix doesn't link with
266*7c478bd9Sstevel@tonic-gate# this feature (the v9 default) enabled.
267*7c478bd9Sstevel@tonic-gate#
268*7c478bd9Sstevel@tonic-gate# REGSYM is separate since the C++ driver syntax is different.
269*7c478bd9Sstevel@tonic-gateCCREGSYM=		-Wc,-Qiselect-regsym=0
270*7c478bd9Sstevel@tonic-gateCCCREGSYM=		-Qoption cg -Qiselect-regsym=0
271*7c478bd9Sstevel@tonic-gate
272*7c478bd9Sstevel@tonic-gate#
273*7c478bd9Sstevel@tonic-gate# generate 32-bit addresses in the v9 kernel. Saves memory.
274*7c478bd9Sstevel@tonic-gateCCABS32=		-Wc,-xcode=abs32
275*7c478bd9Sstevel@tonic-gate
276*7c478bd9Sstevel@tonic-gate# One optimization the compiler might perform is to turn this:
277*7c478bd9Sstevel@tonic-gate#	#pragma weak foo
278*7c478bd9Sstevel@tonic-gate#	extern int foo;
279*7c478bd9Sstevel@tonic-gate#	if (&foo)
280*7c478bd9Sstevel@tonic-gate#		foo = 5;
281*7c478bd9Sstevel@tonic-gate# into
282*7c478bd9Sstevel@tonic-gate#	foo = 5;
283*7c478bd9Sstevel@tonic-gate# Since we do some of this (foo might be referenced in common kernel code
284*7c478bd9Sstevel@tonic-gate# but provided only for some cpu modules or platforms), we disable this
285*7c478bd9Sstevel@tonic-gate# optimization.
286*7c478bd9Sstevel@tonic-gate#
287*7c478bd9Sstevel@tonic-gatesparc_CCUNBOUND	= -Wd,-xsafe=unboundsym
288*7c478bd9Sstevel@tonic-gatei386_CCUNBOUND	=
289*7c478bd9Sstevel@tonic-gateCCUNBOUND	= $($(MACH)_CCUNBOUND)
290*7c478bd9Sstevel@tonic-gate
291*7c478bd9Sstevel@tonic-gate#
292*7c478bd9Sstevel@tonic-gate# compiler '-xarch' flag. This is here to centralize it and make it
293*7c478bd9Sstevel@tonic-gate# overridable for testing.
294*7c478bd9Sstevel@tonic-gatesparc_XARCH=		-xarch=v8
295*7c478bd9Sstevel@tonic-gatesparcv9_XARCH=		-xarch=v9
296*7c478bd9Sstevel@tonic-gatei386_XARCH=
297*7c478bd9Sstevel@tonic-gateamd64_XARCH=		-xarch=amd64 -Ui386 -U__i386
298*7c478bd9Sstevel@tonic-gate
299*7c478bd9Sstevel@tonic-gate# assembler '-xarch' flag.  Different from compiler '-xarch' flag.
300*7c478bd9Sstevel@tonic-gatesparc_AS_XARCH=		-xarch=v8
301*7c478bd9Sstevel@tonic-gatesparcv9_AS_XARCH=	-xarch=v9
302*7c478bd9Sstevel@tonic-gatei386_AS_XARCH=
303*7c478bd9Sstevel@tonic-gateamd64_AS_XARCH=		-xarch=amd64 -P -Ui386 -U__i386
304*7c478bd9Sstevel@tonic-gate
305*7c478bd9Sstevel@tonic-gate#
306*7c478bd9Sstevel@tonic-gate# These flags define what we need to be 'standalone' i.e. -not- part
307*7c478bd9Sstevel@tonic-gate# of the rather more cosy userland environment.  This basically means
308*7c478bd9Sstevel@tonic-gate# the kernel.
309*7c478bd9Sstevel@tonic-gate#
310*7c478bd9Sstevel@tonic-gate# XX64	future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
311*7c478bd9Sstevel@tonic-gate#
312*7c478bd9Sstevel@tonic-gatesparc_STAND_FLAGS=
313*7c478bd9Sstevel@tonic-gatesparcv9_STAND_FLAGS=
314*7c478bd9Sstevel@tonic-gatei386_STAND_FLAGS=	-_gcc=-ffreestanding
315*7c478bd9Sstevel@tonic-gateamd64_STAND_FLAGS=	-Wu,-xmodel=kernel
316*7c478bd9Sstevel@tonic-gate
317*7c478bd9Sstevel@tonic-gateSAVEARGS=		-Wu,-save_args
318*7c478bd9Sstevel@tonic-gate$(__GNUC64)SAVEARGS=
319*7c478bd9Sstevel@tonic-gateamd64_STAND_FLAGS	+= $(SAVEARGS)
320*7c478bd9Sstevel@tonic-gate
321*7c478bd9Sstevel@tonic-gateSTAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
322*7c478bd9Sstevel@tonic-gateSTAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
323*7c478bd9Sstevel@tonic-gate
324*7c478bd9Sstevel@tonic-gate#
325*7c478bd9Sstevel@tonic-gate# disable the incremental linker
326*7c478bd9Sstevel@tonic-gateILDOFF=			-xildoff
327*7c478bd9Sstevel@tonic-gate#
328*7c478bd9Sstevel@tonic-gateXDEPEND=		-xdepend
329*7c478bd9Sstevel@tonic-gateXFFLAG=			-xF
330*7c478bd9Sstevel@tonic-gateXESS=			-xs
331*7c478bd9Sstevel@tonic-gateXSTRCONST=		-xstrconst
332*7c478bd9Sstevel@tonic-gate
333*7c478bd9Sstevel@tonic-gate#
334*7c478bd9Sstevel@tonic-gate# turn warnings into errors (C)
335*7c478bd9Sstevel@tonic-gateCERRWARN = -errtags=yes -errwarn=%all
336*7c478bd9Sstevel@tonic-gateCERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT
337*7c478bd9Sstevel@tonic-gateCERRWARN += -erroff=E_STATEMENT_NOT_REACHED
338*7c478bd9Sstevel@tonic-gate
339*7c478bd9Sstevel@tonic-gate#
340*7c478bd9Sstevel@tonic-gate# turn warnings into errors (C++)
341*7c478bd9Sstevel@tonic-gateCCERRWARN=		-xwe
342*7c478bd9Sstevel@tonic-gate
343*7c478bd9Sstevel@tonic-gate# C99 mode
344*7c478bd9Sstevel@tonic-gateC99_ENABLE=	-xc99=%all
345*7c478bd9Sstevel@tonic-gateC99_DISABLE=	-xc99=%none
346*7c478bd9Sstevel@tonic-gateC99MODE=	$(C99_DISABLE)
347*7c478bd9Sstevel@tonic-gateC99LMODE=	-Xc99=%none
348*7c478bd9Sstevel@tonic-gate
349*7c478bd9Sstevel@tonic-gate# In most places, assignments to these macros should be appended with +=
350*7c478bd9Sstevel@tonic-gate# (CPPFLAGS.master allows values to be prepended to CPPFLAGS).
351*7c478bd9Sstevel@tonic-gatesparc_CFLAGS=	$(sparc_XARCH)
352*7c478bd9Sstevel@tonic-gatesparcv9_CFLAGS=	$(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM)
353*7c478bd9Sstevel@tonic-gatei386_CFLAGS=	$(i386_XARCH)
354*7c478bd9Sstevel@tonic-gateamd64_CFLAGS=	$(amd64_XARCH)
355*7c478bd9Sstevel@tonic-gate
356*7c478bd9Sstevel@tonic-gatesparc_ASFLAGS=	$(sparc_AS_XARCH)
357*7c478bd9Sstevel@tonic-gatesparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
358*7c478bd9Sstevel@tonic-gatei386_ASFLAGS=	$(i386_AS_XARCH)
359*7c478bd9Sstevel@tonic-gateamd64_ASFLAGS=	$(amd64_AS_XARCH)
360*7c478bd9Sstevel@tonic-gate
361*7c478bd9Sstevel@tonic-gate#
362*7c478bd9Sstevel@tonic-gatesparc_COPTFLAG=		-xO3
363*7c478bd9Sstevel@tonic-gatesparcv9_COPTFLAG=	-xO3
364*7c478bd9Sstevel@tonic-gatei386_COPTFLAG=		-O
365*7c478bd9Sstevel@tonic-gateamd64_COPTFLAG=		-O
366*7c478bd9Sstevel@tonic-gate
367*7c478bd9Sstevel@tonic-gateCOPTFLAG= $($(MACH)_COPTFLAG)
368*7c478bd9Sstevel@tonic-gateCOPTFLAG64= $($(MACH64)_COPTFLAG)
369*7c478bd9Sstevel@tonic-gate
370*7c478bd9Sstevel@tonic-gate# When -g is used, the compiler globalizes static objects
371*7c478bd9Sstevel@tonic-gate# (gives them a unique prefix). Disable that.
372*7c478bd9Sstevel@tonic-gateCNOGLOBAL= -W0,-noglobal
373*7c478bd9Sstevel@tonic-gate
374*7c478bd9Sstevel@tonic-gate#
375*7c478bd9Sstevel@tonic-gate# Flags used to build in debug mode for ctf generation.  Bugs in the Devpro
376*7c478bd9Sstevel@tonic-gate# compilers currently prevent us from building with cc-emitted DWARF.
377*7c478bd9Sstevel@tonic-gate#
378*7c478bd9Sstevel@tonic-gateCTF_FLAGS_sparc	= -g -Wc,-Qiselect-T1 $(C99MODE) $(CNOGLOBAL)
379*7c478bd9Sstevel@tonic-gateCTF_FLAGS_i386	= -g $(C99MODE) $(CNOGLOBAL)
380*7c478bd9Sstevel@tonic-gateCTF_FLAGS	= $(CTF_FLAGS_$(MACH))
381*7c478bd9Sstevel@tonic-gate
382*7c478bd9Sstevel@tonic-gate#
383*7c478bd9Sstevel@tonic-gate# Flags used with genoffsets
384*7c478bd9Sstevel@tonic-gate#
385*7c478bd9Sstevel@tonic-gateGOFLAGS =
386*7c478bd9Sstevel@tonic-gate$(INTEL_BLD)GOFLAGS = -_noecho \
387*7c478bd9Sstevel@tonic-gate	-_gcc=-fno-eliminate-unused-debug-symbols \
388*7c478bd9Sstevel@tonic-gate	-_gcc=-fno-eliminate-unused-debug-types
389*7c478bd9Sstevel@tonic-gate
390*7c478bd9Sstevel@tonic-gateOFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
391*7c478bd9Sstevel@tonic-gate	$(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
392*7c478bd9Sstevel@tonic-gate
393*7c478bd9Sstevel@tonic-gateOFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
394*7c478bd9Sstevel@tonic-gate	$(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
395*7c478bd9Sstevel@tonic-gate
396*7c478bd9Sstevel@tonic-gate#
397*7c478bd9Sstevel@tonic-gate# tradeoff time for space (smaller is better)
398*7c478bd9Sstevel@tonic-gate#
399*7c478bd9Sstevel@tonic-gatesparc_SPACEFLAG		= -xspace -W0,-Lt -W2,-Rcond_elim
400*7c478bd9Sstevel@tonic-gatesparcv9_SPACEFLAG	= -xspace -W0,-Lt -W2,-Rcond_elim
401*7c478bd9Sstevel@tonic-gatei386_SPACEFLAG		= -xspace
402*7c478bd9Sstevel@tonic-gateamd64_SPACEFLAG		=
403*7c478bd9Sstevel@tonic-gate
404*7c478bd9Sstevel@tonic-gateSPACEFLAG		= $($(MACH)_SPACEFLAG)
405*7c478bd9Sstevel@tonic-gateSPACEFLAG64		= $($(MACH64)_SPACEFLAG)
406*7c478bd9Sstevel@tonic-gate
407*7c478bd9Sstevel@tonic-gatesparc_XREGSFLAG		= -xregs=no%appl
408*7c478bd9Sstevel@tonic-gatesparcv9_XREGSFLAG	= -xregs=no%appl
409*7c478bd9Sstevel@tonic-gatei386_XREGSFLAG		=
410*7c478bd9Sstevel@tonic-gateamd64_XREGSFLAG		=
411*7c478bd9Sstevel@tonic-gate
412*7c478bd9Sstevel@tonic-gateXREGSFLAG		= $($(MACH)_XREGSFLAG)
413*7c478bd9Sstevel@tonic-gateXREGSFLAG64		= $($(MACH64)_XREGSFLAG)
414*7c478bd9Sstevel@tonic-gate
415*7c478bd9Sstevel@tonic-gateCFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
416*7c478bd9Sstevel@tonic-gate		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND)
417*7c478bd9Sstevel@tonic-gateCFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
418*7c478bd9Sstevel@tonic-gate		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND)
419*7c478bd9Sstevel@tonic-gateNATIVE_CFLAGS=	$(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
420*7c478bd9Sstevel@tonic-gate		$(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND)
421*7c478bd9Sstevel@tonic-gate
422*7c478bd9Sstevel@tonic-gateDTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"	# For messaging.
423*7c478bd9Sstevel@tonic-gateDTS_ERRNO=-D_TS_ERRNO
424*7c478bd9Sstevel@tonic-gateCPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
425*7c478bd9Sstevel@tonic-gate	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
426*7c478bd9Sstevel@tonic-gateCPPFLAGS=	$(CPPFLAGS.master)
427*7c478bd9Sstevel@tonic-gateAS_CPPFLAGS=	$(CPPFLAGS.master)
428*7c478bd9Sstevel@tonic-gateJAVAFLAGS=	-deprecation
429*7c478bd9Sstevel@tonic-gate
430*7c478bd9Sstevel@tonic-gate#
431*7c478bd9Sstevel@tonic-gate# For source message catalogue
432*7c478bd9Sstevel@tonic-gate#
433*7c478bd9Sstevel@tonic-gate.SUFFIXES: $(SUFFIXES) .i .po
434*7c478bd9Sstevel@tonic-gateMSGROOT= $(ROOT)/catalog
435*7c478bd9Sstevel@tonic-gateMSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
436*7c478bd9Sstevel@tonic-gateMSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
437*7c478bd9Sstevel@tonic-gateDCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
438*7c478bd9Sstevel@tonic-gateDCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
439*7c478bd9Sstevel@tonic-gate
440*7c478bd9Sstevel@tonic-gateCLOBBERFILES += $(POFILE) $(POFILES)
441*7c478bd9Sstevel@tonic-gateCOMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
442*7c478bd9Sstevel@tonic-gateXGETTEXT= /usr/bin/xgettext
443*7c478bd9Sstevel@tonic-gateXGETFLAGS= -c TRANSLATION_NOTE
444*7c478bd9Sstevel@tonic-gateBUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
445*7c478bd9Sstevel@tonic-gate	$(RM)	$@ ;\
446*7c478bd9Sstevel@tonic-gate	sed "/^domain/d" < $(<F).po > $@ ;\
447*7c478bd9Sstevel@tonic-gate	$(RM) $(<F).po $<.i
448*7c478bd9Sstevel@tonic-gate#
449*7c478bd9Sstevel@tonic-gate# This is overwritten by local Makefile when PROG is a list.
450*7c478bd9Sstevel@tonic-gate#
451*7c478bd9Sstevel@tonic-gatePOFILE= $(PROG).po
452*7c478bd9Sstevel@tonic-gate
453*7c478bd9Sstevel@tonic-gatesparc_CCFLAGS=		-cg92 -compat=4 \
454*7c478bd9Sstevel@tonic-gate			-Qoption ccfe -messages=no%anachronism \
455*7c478bd9Sstevel@tonic-gate			$(CCERRWARN)
456*7c478bd9Sstevel@tonic-gatesparcv9_CCFLAGS=	$(sparcv9_XARCH) -dalign -compat=5 \
457*7c478bd9Sstevel@tonic-gate			-Qoption ccfe -messages=no%anachronism \
458*7c478bd9Sstevel@tonic-gate			-Qoption ccfe -features=no%conststrings \
459*7c478bd9Sstevel@tonic-gate			$(CCCREGSYM) \
460*7c478bd9Sstevel@tonic-gate			$(CCERRWARN)
461*7c478bd9Sstevel@tonic-gatei386_CCFLAGS=		-compat=4 \
462*7c478bd9Sstevel@tonic-gate			-Qoption ccfe -messages=no%anachronism \
463*7c478bd9Sstevel@tonic-gate			-Qoption ccfe -features=no%conststrings \
464*7c478bd9Sstevel@tonic-gate			$(CCERRWARN)
465*7c478bd9Sstevel@tonic-gateamd64_CCFLAGS=		$(amd64_XARCH) -compat=5 \
466*7c478bd9Sstevel@tonic-gate			-Qoption ccfe -messages=no%anachronism \
467*7c478bd9Sstevel@tonic-gate			-Qoption ccfe -features=no%conststrings \
468*7c478bd9Sstevel@tonic-gate			$(CCERRWARN)
469*7c478bd9Sstevel@tonic-gate
470*7c478bd9Sstevel@tonic-gatesparc_CCOPTFLAG=	-O
471*7c478bd9Sstevel@tonic-gatesparcv9_CCOPTFLAG=	-O
472*7c478bd9Sstevel@tonic-gatei386_CCOPTFLAG=		-O
473*7c478bd9Sstevel@tonic-gateamd64_CCOPTFLAG=	-O
474*7c478bd9Sstevel@tonic-gate
475*7c478bd9Sstevel@tonic-gateCCOPTFLAG=	$($(MACH)_CCOPTFLAG)
476*7c478bd9Sstevel@tonic-gateCCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
477*7c478bd9Sstevel@tonic-gateCCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS)
478*7c478bd9Sstevel@tonic-gateCCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS)
479*7c478bd9Sstevel@tonic-gate#
480*7c478bd9Sstevel@tonic-gate# Used by Makefile.cmd, Makefile.lib and Makefile.ucbcmd
481*7c478bd9Sstevel@tonic-gate#
482*7c478bd9Sstevel@tonic-gatePGA_MAPFILE =	$(SRC)/cmd/sgs/mapfiles/$(MACH)/map.pagealign
483*7c478bd9Sstevel@tonic-gate#
484*7c478bd9Sstevel@tonic-gate#
485*7c478bd9Sstevel@tonic-gate# LDLIBS32 can be set in the environment to override the following assignment.
486*7c478bd9Sstevel@tonic-gate# LDLIBS64 can be set to override the assignment made in Makefile.master.64.
487*7c478bd9Sstevel@tonic-gate# These environment settings make sure that no libraries are searched outside
488*7c478bd9Sstevel@tonic-gate# of the local workspace proto area:
489*7c478bd9Sstevel@tonic-gate#	LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
490*7c478bd9Sstevel@tonic-gate#	LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
491*7c478bd9Sstevel@tonic-gate#
492*7c478bd9Sstevel@tonic-gateLDLIBS32 =	$(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
493*7c478bd9Sstevel@tonic-gateLDLIBS.cmd = 	$(LDLIBS32)
494*7c478bd9Sstevel@tonic-gateLDLIBS.lib =	$(LDLIBS32)
495*7c478bd9Sstevel@tonic-gate#
496*7c478bd9Sstevel@tonic-gate# Define compilation macros.
497*7c478bd9Sstevel@tonic-gate#
498*7c478bd9Sstevel@tonic-gateCOMPILE.c=	$(CC) $(CFLAGS) $(CPPFLAGS) -c
499*7c478bd9Sstevel@tonic-gateCOMPILE64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) -c
500*7c478bd9Sstevel@tonic-gateCOMPILE.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
501*7c478bd9Sstevel@tonic-gateCOMPILE64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
502*7c478bd9Sstevel@tonic-gateCOMPILE.s=	$(AS) $(ASFLAGS) $(AS_CPPFLAGS)
503*7c478bd9Sstevel@tonic-gateCOMPILE64.s=	$(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
504*7c478bd9Sstevel@tonic-gateCOMPILE.d=	$(DTRACE) -G -32
505*7c478bd9Sstevel@tonic-gateCOMPILE64.d=	$(DTRACE) -G -64
506*7c478bd9Sstevel@tonic-gate
507*7c478bd9Sstevel@tonic-gateCLASSPATH=	.
508*7c478bd9Sstevel@tonic-gateCOMPILE.java=	$(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
509*7c478bd9Sstevel@tonic-gate
510*7c478bd9Sstevel@tonic-gate#
511*7c478bd9Sstevel@tonic-gate# Link time macros
512*7c478bd9Sstevel@tonic-gate#
513*7c478bd9Sstevel@tonic-gateCCNEEDED		= -lC
514*7c478bd9Sstevel@tonic-gate# XX64  What to do about libstdc++ for g++ ???
515*7c478bd9Sstevel@tonic-gate
516*7c478bd9Sstevel@tonic-gateLINK.c=		$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
517*7c478bd9Sstevel@tonic-gateLINK64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
518*7c478bd9Sstevel@tonic-gateNORUNPATH=	-norunpath -nolib
519*7c478bd9Sstevel@tonic-gateLINK.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
520*7c478bd9Sstevel@tonic-gate		$(LDFLAGS) $(CCNEEDED)
521*7c478bd9Sstevel@tonic-gateLINK64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
522*7c478bd9Sstevel@tonic-gate		$(LDFLAGS) $(CCNEEDED)
523*7c478bd9Sstevel@tonic-gate
524*7c478bd9Sstevel@tonic-gate#
525*7c478bd9Sstevel@tonic-gate# lint macros
526*7c478bd9Sstevel@tonic-gate#
527*7c478bd9Sstevel@tonic-gate# Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once
528*7c478bd9Sstevel@tonic-gate# ON is built with a version of lint that has the fix for 4484186.
529*7c478bd9Sstevel@tonic-gate#
530*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS =	-errtags=yes -s
531*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_PTRDIFF_OVERFLOW
532*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_NARROW_CONV
533*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-U__PRAGMA_REDEFINE_EXTNAME
534*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	$(C99LMODE)
535*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-errsecurity=$(SECLEVEL)
536*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_SEC_CREAT_WITHOUT_EXCL
537*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_SEC_FORBIDDEN_WARN_CREAT
538*7c478bd9Sstevel@tonic-gate# XX64 -- really only needed for amd64 lint
539*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_INT_TO_SMALL_INT
540*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_CONST_TO_SMALL_INT
541*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_TO_SMALL_INT
542*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_CAST_TO_PTR_FROM_INT
543*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_COMP_INT_WITH_LARGE_INT
544*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_INTEGRAL_CONST_EXP_EXPECTED
545*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_PASS_INT_TO_SMALL_INT
546*7c478bd9Sstevel@tonic-gateALWAYS_LINT_DEFS +=	-erroff=E_PTR_CONV_LOSES_BITS
547*7c478bd9Sstevel@tonic-gate
548*7c478bd9Sstevel@tonic-gateSECLEVEL=	core
549*7c478bd9Sstevel@tonic-gateLINT.c=		$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(ALWAYS_LINT_DEFS)
550*7c478bd9Sstevel@tonic-gateLINT64.c=	$(LINT) $(LINTFLAGS64) $(CPPFLAGS) $(ALWAYS_LINT_DEFS)
551*7c478bd9Sstevel@tonic-gateLINT.s=		$(LINT.c)
552*7c478bd9Sstevel@tonic-gate
553*7c478bd9Sstevel@tonic-gate# For some future builds, NATIVE_MACH and MACH might be different.
554*7c478bd9Sstevel@tonic-gate# Therefore, NATIVE_MACH needs to be redefined in the
555*7c478bd9Sstevel@tonic-gate# environment as `uname -p` to override this macro.
556*7c478bd9Sstevel@tonic-gate#
557*7c478bd9Sstevel@tonic-gate# For now at least, we cross-compile amd64 on i386 machines.
558*7c478bd9Sstevel@tonic-gateNATIVE_MACH=	$(MACH:amd64=i386)
559*7c478bd9Sstevel@tonic-gate
560*7c478bd9Sstevel@tonic-gate# Define native compilation macros
561*7c478bd9Sstevel@tonic-gate#
562*7c478bd9Sstevel@tonic-gate
563*7c478bd9Sstevel@tonic-gate# Base directory where compilers are loaded.
564*7c478bd9Sstevel@tonic-gate# Defined here so it can be overridden by developer.
565*7c478bd9Sstevel@tonic-gate#
566*7c478bd9Sstevel@tonic-gateSPRO_ROOT=		$(BUILD_TOOLS)/SUNWspro
567*7c478bd9Sstevel@tonic-gateSPRO_VROOT=		$(SPRO_ROOT)/SOS8
568*7c478bd9Sstevel@tonic-gateGNU_ROOT=		$(SFW_ROOT)
569*7c478bd9Sstevel@tonic-gate
570*7c478bd9Sstevel@tonic-gate# Specify platform compiler versions for languages
571*7c478bd9Sstevel@tonic-gate# that we use (currently only c and c++).
572*7c478bd9Sstevel@tonic-gate#
573*7c478bd9Sstevel@tonic-gatesparc_CC=		$(SPRO_VROOT)/bin/cc
574*7c478bd9Sstevel@tonic-gatesparc_CCC=		$(SPRO_VROOT)/bin/CC
575*7c478bd9Sstevel@tonic-gatesparc_CPP=		/usr/ccs/lib/cpp
576*7c478bd9Sstevel@tonic-gatesparc_AS=		/usr/ccs/bin/as -xregsym=no
577*7c478bd9Sstevel@tonic-gatesparc_LD=		/usr/ccs/bin/ld
578*7c478bd9Sstevel@tonic-gatesparc_LINT=		$(SPRO_VROOT)/bin/lint
579*7c478bd9Sstevel@tonic-gate
580*7c478bd9Sstevel@tonic-gatesparcv9_CC=		$(SPRO_VROOT)/bin/cc
581*7c478bd9Sstevel@tonic-gatesparcv9_CCC=		$(SPRO_VROOT)/bin/CC
582*7c478bd9Sstevel@tonic-gatesparcv9_CPP=		/usr/ccs/lib/cpp
583*7c478bd9Sstevel@tonic-gatesparcv9_AS=		/usr/ccs/bin/as -xregsym=no
584*7c478bd9Sstevel@tonic-gatesparcv9_LD=		/usr/ccs/bin/ld
585*7c478bd9Sstevel@tonic-gatesparcv9_LINT=		$(SPRO_VROOT)/bin/lint
586*7c478bd9Sstevel@tonic-gate
587*7c478bd9Sstevel@tonic-gate# We compile 32-bit objects with cc by default
588*7c478bd9Sstevel@tonic-gatei386_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
589*7c478bd9Sstevel@tonic-gate$(__GNUC)i386_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
590*7c478bd9Sstevel@tonic-gatei386_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
591*7c478bd9Sstevel@tonic-gate$(__GNUC)i386_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
592*7c478bd9Sstevel@tonic-gatei386_CPP=		/usr/ccs/lib/cpp
593*7c478bd9Sstevel@tonic-gatei386_AS=		/usr/ccs/bin/as
594*7c478bd9Sstevel@tonic-gate$(__GNUC)i386_AS=	$(ONBLD_TOOLS)/bin/$(MACH)/aw
595*7c478bd9Sstevel@tonic-gatei386_LD=		/usr/ccs/bin/ld
596*7c478bd9Sstevel@tonic-gatei386_LINT=		$(SPRO_VROOT)/bin/lint
597*7c478bd9Sstevel@tonic-gate
598*7c478bd9Sstevel@tonic-gate# We compile 64-bit objects with gcc
599*7c478bd9Sstevel@tonic-gateamd64_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
600*7c478bd9Sstevel@tonic-gate$(__GNUC64)amd64_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
601*7c478bd9Sstevel@tonic-gateamd64_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
602*7c478bd9Sstevel@tonic-gate$(__GNUC64)amd64_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
603*7c478bd9Sstevel@tonic-gateamd64_CPP=		/usr/ccs/lib/cpp
604*7c478bd9Sstevel@tonic-gateamd64_AS=		$(ONBLD_TOOLS)/bin/$(MACH)/aw
605*7c478bd9Sstevel@tonic-gateamd64_LD=		/usr/ccs/bin/ld
606*7c478bd9Sstevel@tonic-gateamd64_LINT=		$(SPRO_ROOT)/SOS10-EA/bin/lint
607*7c478bd9Sstevel@tonic-gate
608*7c478bd9Sstevel@tonic-gateNATIVECC=		$($(NATIVE_MACH)_CC)
609*7c478bd9Sstevel@tonic-gateNATIVECCC=		$($(NATIVE_MACH)_CCC)
610*7c478bd9Sstevel@tonic-gateNATIVECPP=		$($(NATIVE_MACH)_CPP)
611*7c478bd9Sstevel@tonic-gateNATIVEAS=		$($(NATIVE_MACH)_AS)
612*7c478bd9Sstevel@tonic-gateNATIVELD=		$($(NATIVE_MACH)_LD)
613*7c478bd9Sstevel@tonic-gateNATIVELINT=		$($(NATIVE_MACH)_LINT)
614*7c478bd9Sstevel@tonic-gate
615*7c478bd9Sstevel@tonic-gate#
616*7c478bd9Sstevel@tonic-gate# Makefile.master.64 overrides these settings
617*7c478bd9Sstevel@tonic-gate#
618*7c478bd9Sstevel@tonic-gateCC=			$(NATIVECC)
619*7c478bd9Sstevel@tonic-gateCCC=			$(NATIVECCC)
620*7c478bd9Sstevel@tonic-gateCPP=			$(NATIVECPP)
621*7c478bd9Sstevel@tonic-gateAS=			$(NATIVEAS)
622*7c478bd9Sstevel@tonic-gateLD=			$(NATIVELD)
623*7c478bd9Sstevel@tonic-gateLINT=			$(NATIVELINT)
624*7c478bd9Sstevel@tonic-gate
625*7c478bd9Sstevel@tonic-gate# Pass -Y flag to cpp (method of which is release-dependent)
626*7c478bd9Sstevel@tonic-gateCCYFLAG=		-Y I,
627*7c478bd9Sstevel@tonic-gate
628*7c478bd9Sstevel@tonic-gateBDIRECT=	-Bdirect
629*7c478bd9Sstevel@tonic-gateBDYNAMIC=	-Bdynamic
630*7c478bd9Sstevel@tonic-gateBLOCAL=		-Blocal
631*7c478bd9Sstevel@tonic-gateBREDUCE=	-Breduce
632*7c478bd9Sstevel@tonic-gateBSTATIC=	-Bstatic
633*7c478bd9Sstevel@tonic-gateBSYMBOLIC=	-Bsymbolic
634*7c478bd9Sstevel@tonic-gate
635*7c478bd9Sstevel@tonic-gateZCOMBRELOC=	-zcombreloc
636*7c478bd9Sstevel@tonic-gateZDEFS=		-zdefs
637*7c478bd9Sstevel@tonic-gateZIGNORE=	-zignore
638*7c478bd9Sstevel@tonic-gateZINITFIRST=	-zinitfirst
639*7c478bd9Sstevel@tonic-gateZINTERPOSE=	-zinterpose
640*7c478bd9Sstevel@tonic-gateZLAZYLOAD=	-zlazyload
641*7c478bd9Sstevel@tonic-gateZLOADFLTR=	-zloadfltr
642*7c478bd9Sstevel@tonic-gateZMULDEFS=	-zmuldefs
643*7c478bd9Sstevel@tonic-gateZNODEFAULTLIB=	-znodefaultlib
644*7c478bd9Sstevel@tonic-gateZNODEFS=	-znodefs
645*7c478bd9Sstevel@tonic-gateZNODELETE=	-znodelete
646*7c478bd9Sstevel@tonic-gateZNODLOPEN=	-znodlopen
647*7c478bd9Sstevel@tonic-gateZNODUMP=	-znodump
648*7c478bd9Sstevel@tonic-gateZNOLAZYLOAD=	-znolazyload
649*7c478bd9Sstevel@tonic-gateZNOVERSION=	-znoversion
650*7c478bd9Sstevel@tonic-gateZREDLOCSYM=	-zredlocsym
651*7c478bd9Sstevel@tonic-gateZTEXT=		-ztext
652*7c478bd9Sstevel@tonic-gate
653*7c478bd9Sstevel@tonic-gateGSHARED=	-G
654*7c478bd9Sstevel@tonic-gateCCMT=		-mt
655*7c478bd9Sstevel@tonic-gate
656*7c478bd9Sstevel@tonic-gate# Handle different PIC models on different ISAs
657*7c478bd9Sstevel@tonic-gate# (May be overridden by lower-level Makefiles)
658*7c478bd9Sstevel@tonic-gate
659*7c478bd9Sstevel@tonic-gatesparc_C_PICFLAGS =	-K pic
660*7c478bd9Sstevel@tonic-gatesparcv9_C_PICFLAGS =	-K pic
661*7c478bd9Sstevel@tonic-gatei386_C_PICFLAGS =	-K pic
662*7c478bd9Sstevel@tonic-gateamd64_C_PICFLAGS =	-K pic
663*7c478bd9Sstevel@tonic-gateC_PICFLAGS =		$($(MACH)_C_PICFLAGS)
664*7c478bd9Sstevel@tonic-gateC_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
665*7c478bd9Sstevel@tonic-gate
666*7c478bd9Sstevel@tonic-gatesparc_C_BIGPICFLAGS =	-K PIC
667*7c478bd9Sstevel@tonic-gatesparcv9_C_BIGPICFLAGS =	-K PIC
668*7c478bd9Sstevel@tonic-gatei386_C_BIGPICFLAGS =	-K PIC
669*7c478bd9Sstevel@tonic-gateamd64_C_BIGPICFLAGS =	-K PIC
670*7c478bd9Sstevel@tonic-gateC_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
671*7c478bd9Sstevel@tonic-gateC_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
672*7c478bd9Sstevel@tonic-gate
673*7c478bd9Sstevel@tonic-gate# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
674*7c478bd9Sstevel@tonic-gatesparc_CC_PICFLAGS =	-Kpic
675*7c478bd9Sstevel@tonic-gatesparcv9_CC_PICFLAGS =	-KPIC
676*7c478bd9Sstevel@tonic-gatei386_CC_PICFLAGS = 	-Kpic
677*7c478bd9Sstevel@tonic-gateamd64_CC_PICFLAGS = 	-Kpic
678*7c478bd9Sstevel@tonic-gateCC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
679*7c478bd9Sstevel@tonic-gateCC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
680*7c478bd9Sstevel@tonic-gate
681*7c478bd9Sstevel@tonic-gateAS_PICFLAGS=		$(C_PICFLAGS)
682*7c478bd9Sstevel@tonic-gateAS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
683*7c478bd9Sstevel@tonic-gate
684*7c478bd9Sstevel@tonic-gate#
685*7c478bd9Sstevel@tonic-gate# Default label for CTF sections
686*7c478bd9Sstevel@tonic-gate#
687*7c478bd9Sstevel@tonic-gateCTFCVTFLAGS=		-i -L VERSION
688*7c478bd9Sstevel@tonic-gate
689*7c478bd9Sstevel@tonic-gate#
690*7c478bd9Sstevel@tonic-gate# Override to pass module-specific flags to ctfmerge.  Currently used
691*7c478bd9Sstevel@tonic-gate# only by krtld to turn on fuzzy matching.
692*7c478bd9Sstevel@tonic-gate#
693*7c478bd9Sstevel@tonic-gateCTFMRGFLAGS=
694*7c478bd9Sstevel@tonic-gate
695*7c478bd9Sstevel@tonic-gateCTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
696*7c478bd9Sstevel@tonic-gate
697*7c478bd9Sstevel@tonic-gateELFSIGN_O=	$(TRUE)
698*7c478bd9Sstevel@tonic-gateELFSIGN_CRYPTO=	$(ELFSIGN_O)
699*7c478bd9Sstevel@tonic-gateELFSIGN_OBJECT=	$(ELFSIGN_O)
700*7c478bd9Sstevel@tonic-gate# EXPORT DELETE START
701*7c478bd9Sstevel@tonic-gate# Note: The setting of ELFSIGN_O, etc. to $(TRUE) above must stay outside
702*7c478bd9Sstevel@tonic-gate# of the export src markers.  The real setting for non source product builds
703*7c478bd9Sstevel@tonic-gate# is inside the markers.
704*7c478bd9Sstevel@tonic-gate# This is needed to reduce the amount of changes to Makefiles elsewhere
705*7c478bd9Sstevel@tonic-gate# in the source tree (particularly in uts/{sparc,intel})
706*7c478bd9Sstevel@tonic-gateELFSIGN_O =	$(ELFSIGN)
707*7c478bd9Sstevel@tonic-gateELFSIGN_KEY =	$(SRC)/cmd/cmd-crypto/etc/keys/SUNWosnet
708*7c478bd9Sstevel@tonic-gateELFSIGN_CERT=	$(SRC)/cmd/cmd-crypto/etc/certs/SUNWosnet
709*7c478bd9Sstevel@tonic-gateELFSIGN_SEKEY =	$(SRC)/cmd/cmd-crypto/etc/keys/SUNWosnetSolaris
710*7c478bd9Sstevel@tonic-gateELFSIGN_SECERT=	$(SRC)/cmd/cmd-crypto/etc/certs/SUNWosnetSolaris
711*7c478bd9Sstevel@tonic-gateELFSIGN_CRYPTO=	$(ELFSIGN_O) sign $(ELFSIGN_FORMAT_OPTION) \
712*7c478bd9Sstevel@tonic-gate			-k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@
713*7c478bd9Sstevel@tonic-gateELFSIGN_OBJECT=	$(ELFSIGN_O) sign $(ELFSIGN_FORMAT_OPTION) \
714*7c478bd9Sstevel@tonic-gate			-k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@
715*7c478bd9Sstevel@tonic-gate# EXPORT DELETE END
716*7c478bd9Sstevel@tonic-gate
717*7c478bd9Sstevel@tonic-gate# Rules (normally from make.rules) and macros which are used for post
718*7c478bd9Sstevel@tonic-gate# processing files. Normally, these do stripping of the comment section
719*7c478bd9Sstevel@tonic-gate# automatically.
720*7c478bd9Sstevel@tonic-gate#    RELEASE_CM:	Should be editted to reflect the release.
721*7c478bd9Sstevel@tonic-gate#    POST_PROCESS_O:	Post-processing for `.o' files.
722*7c478bd9Sstevel@tonic-gate#    POST_PROCESS_A:	Post-processing for `.a' files (currently null).
723*7c478bd9Sstevel@tonic-gate#    POST_PROCESS_SO:	Post-processing for `.so' files.
724*7c478bd9Sstevel@tonic-gate#    POST_PROCESS:	Post-processing for executable files (no suffix).
725*7c478bd9Sstevel@tonic-gate# Note that these macros are not completely generalized as they are to be
726*7c478bd9Sstevel@tonic-gate# used with the file name to be processed following.
727*7c478bd9Sstevel@tonic-gate#
728*7c478bd9Sstevel@tonic-gate# It is left as an exercise to Release Engineering to embellish the generation
729*7c478bd9Sstevel@tonic-gate# of the release comment string.
730*7c478bd9Sstevel@tonic-gate#
731*7c478bd9Sstevel@tonic-gate#	If this is a standard development build:
732*7c478bd9Sstevel@tonic-gate#		compress the comment section (mcs -c)
733*7c478bd9Sstevel@tonic-gate#		add the standard comment (mcs -a $(RELEASE_CM))
734*7c478bd9Sstevel@tonic-gate#		add the development specific comment (mcs -a $(DEV_CM))
735*7c478bd9Sstevel@tonic-gate#
736*7c478bd9Sstevel@tonic-gate#	If this is an installation build:
737*7c478bd9Sstevel@tonic-gate#		delete the comment section (mcs -d)
738*7c478bd9Sstevel@tonic-gate#		add the standard comment (mcs -a $(RELEASE_CM))
739*7c478bd9Sstevel@tonic-gate#		add the development specific comment (mcs -a $(DEV_CM))
740*7c478bd9Sstevel@tonic-gate#
741*7c478bd9Sstevel@tonic-gate#	If this is an release build:
742*7c478bd9Sstevel@tonic-gate#		delete the comment section (mcs -d)
743*7c478bd9Sstevel@tonic-gate#		add the standard comment (mcs -a $(RELEASE_CM))
744*7c478bd9Sstevel@tonic-gate#
745*7c478bd9Sstevel@tonic-gate#	The ONVERS macro sets the default value for the VERSION string
746*7c478bd9Sstevel@tonic-gate#	within pkginfo.
747*7c478bd9Sstevel@tonic-gate#
748*7c478bd9Sstevel@tonic-gate# The following list of macros are used in the definition of RELEASE_CM
749*7c478bd9Sstevel@tonic-gate# which is used to label all binaries in the build:
750*7c478bd9Sstevel@tonic-gate#
751*7c478bd9Sstevel@tonic-gate# 	RELEASE		Specific release of the build, eg: 5.2
752*7c478bd9Sstevel@tonic-gate#	VERSION		Version of the build (alpha, beta, Generic)
753*7c478bd9Sstevel@tonic-gate#	PATCHID		If this is a patch this value should contain
754*7c478bd9Sstevel@tonic-gate#			the patchid value (eg: "Generic 100832-01"), otherwise
755*7c478bd9Sstevel@tonic-gate#			it will be set to $(VERSION)
756*7c478bd9Sstevel@tonic-gate#	RELEASE_DATE	Date of the Release Build
757*7c478bd9Sstevel@tonic-gate#	PATCH_DATE	Date the patch was created, if this is blank it
758*7c478bd9Sstevel@tonic-gate#			will default to the RELEASE_DATE
759*7c478bd9Sstevel@tonic-gate#
760*7c478bd9Sstevel@tonic-gateONVERS=		"11.11"
761*7c478bd9Sstevel@tonic-gateRELEASE=	5.11
762*7c478bd9Sstevel@tonic-gateVERSION=	SunOS Development
763*7c478bd9Sstevel@tonic-gatePATCHID=	$(VERSION)
764*7c478bd9Sstevel@tonic-gateRELEASE_DATE=	October 2007
765*7c478bd9Sstevel@tonic-gatePATCH_DATE=	$(RELEASE_DATE)
766*7c478bd9Sstevel@tonic-gateRELEASE_CM=	"@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
767*7c478bd9Sstevel@tonic-gateDEV_CM=		"@($(POUND_SIGN))SunOS Internal Development: \
768*7c478bd9Sstevel@tonic-gate`$(ECHO) $$LOGNAME` `date +%Y-%m-%d` `$(ECHO) [\`basename $$CODEMGR_WS\`]`"
769*7c478bd9Sstevel@tonic-gate
770*7c478bd9Sstevel@tonic-gatePROCESS_COMMENT=		   @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
771*7c478bd9Sstevel@tonic-gate$(STRIP_COMMENTS)PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
772*7c478bd9Sstevel@tonic-gate$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
773*7c478bd9Sstevel@tonic-gate
774*7c478bd9Sstevel@tonic-gateSTRIP_STABS=			   :
775*7c478bd9Sstevel@tonic-gate$(RELEASE_BUILD)STRIP_STABS=	   $(STRIP) -x $@
776*7c478bd9Sstevel@tonic-gate
777*7c478bd9Sstevel@tonic-gatePOST_PROCESS_O=		$(PROCESS_COMMENT) $@
778*7c478bd9Sstevel@tonic-gatePOST_PROCESS_A=
779*7c478bd9Sstevel@tonic-gatePOST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
780*7c478bd9Sstevel@tonic-gate			$(ELFSIGN_OBJECT)
781*7c478bd9Sstevel@tonic-gatePOST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(ELFSIGN_OBJECT)
782*7c478bd9Sstevel@tonic-gate
783*7c478bd9Sstevel@tonic-gate#
784*7c478bd9Sstevel@tonic-gate# The PKGDEFS macro points to the source directory containing the majority
785*7c478bd9Sstevel@tonic-gate# of ON's package definitions plus Makefiles with general package creation
786*7c478bd9Sstevel@tonic-gate# rules.
787*7c478bd9Sstevel@tonic-gate#
788*7c478bd9Sstevel@tonic-gate# PKGARCHIVE specifies the default location where packages should be
789*7c478bd9Sstevel@tonic-gate# placed if built.
790*7c478bd9Sstevel@tonic-gate#
791*7c478bd9Sstevel@tonic-gatePKGDEFS=$(SRC)/pkgdefs
792*7c478bd9Sstevel@tonic-gate$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
793*7c478bd9Sstevel@tonic-gatePKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
794*7c478bd9Sstevel@tonic-gate
795*7c478bd9Sstevel@tonic-gate#	Default build rules which perform comment section post-processing.
796*7c478bd9Sstevel@tonic-gate#
797*7c478bd9Sstevel@tonic-gate.c:
798*7c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ $< $(LDLIBS)
799*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
800*7c478bd9Sstevel@tonic-gate.c.o:
801*7c478bd9Sstevel@tonic-gate	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
802*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
803*7c478bd9Sstevel@tonic-gate.c.a:
804*7c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $% $<
805*7c478bd9Sstevel@tonic-gate	$(PROCESS_COMMENT) $%
806*7c478bd9Sstevel@tonic-gate	$(AR) $(ARFLAGS) $@ $%
807*7c478bd9Sstevel@tonic-gate	$(RM) $%
808*7c478bd9Sstevel@tonic-gate.s.o:
809*7c478bd9Sstevel@tonic-gate	$(COMPILE.s) -o $@ $<
810*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
811*7c478bd9Sstevel@tonic-gate.s.a:
812*7c478bd9Sstevel@tonic-gate	$(COMPILE.s) -o $% $<
813*7c478bd9Sstevel@tonic-gate	$(PROCESS_COMMENT) $%
814*7c478bd9Sstevel@tonic-gate	$(AR) $(ARFLAGS) $@ $%
815*7c478bd9Sstevel@tonic-gate	$(RM) $%
816*7c478bd9Sstevel@tonic-gate.cc:
817*7c478bd9Sstevel@tonic-gate	$(LINK.cc) -o $@ $< $(LDLIBS)
818*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
819*7c478bd9Sstevel@tonic-gate.cc.o:
820*7c478bd9Sstevel@tonic-gate	$(COMPILE.cc) $(OUTPUT_OPTION) $<
821*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
822*7c478bd9Sstevel@tonic-gate.cc.a:
823*7c478bd9Sstevel@tonic-gate	$(COMPILE.cc) -o $% $<
824*7c478bd9Sstevel@tonic-gate	$(AR) $(ARFLAGS) $@ $%
825*7c478bd9Sstevel@tonic-gate	$(PROCESS_COMMENT) $%
826*7c478bd9Sstevel@tonic-gate	$(RM) $%
827*7c478bd9Sstevel@tonic-gate.y:
828*7c478bd9Sstevel@tonic-gate	$(YACC.y) $<
829*7c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
830*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
831*7c478bd9Sstevel@tonic-gate	$(RM) y.tab.c
832*7c478bd9Sstevel@tonic-gate.y.o:
833*7c478bd9Sstevel@tonic-gate	$(YACC.y) $<
834*7c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
835*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
836*7c478bd9Sstevel@tonic-gate	$(RM) y.tab.c
837*7c478bd9Sstevel@tonic-gate.l:
838*7c478bd9Sstevel@tonic-gate	$(RM) $*.c
839*7c478bd9Sstevel@tonic-gate	$(LEX.l) $< > $*.c
840*7c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
841*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
842*7c478bd9Sstevel@tonic-gate	$(RM) $*.c
843*7c478bd9Sstevel@tonic-gate.l.o:
844*7c478bd9Sstevel@tonic-gate	$(RM) $*.c
845*7c478bd9Sstevel@tonic-gate	$(LEX.l) $< > $*.c
846*7c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
847*7c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
848*7c478bd9Sstevel@tonic-gate	$(RM) $*.c
849*7c478bd9Sstevel@tonic-gate
850*7c478bd9Sstevel@tonic-gate.java.class:
851*7c478bd9Sstevel@tonic-gate	$(COMPILE.java) $<
852*7c478bd9Sstevel@tonic-gate
853*7c478bd9Sstevel@tonic-gate#
854*7c478bd9Sstevel@tonic-gate# Rules to create message catalogue files from .sh, .c, .y, and .l files.
855*7c478bd9Sstevel@tonic-gate# For .sh files, we extract all gettext strings with sed(1) (being careful
856*7c478bd9Sstevel@tonic-gate# to permit multiple gettext strings on the same line), weed out the dups,
857*7c478bd9Sstevel@tonic-gate# and build the catalogue with awk(1).
858*7c478bd9Sstevel@tonic-gate#
859*7c478bd9Sstevel@tonic-gate
860*7c478bd9Sstevel@tonic-gate.sh.po:
861*7c478bd9Sstevel@tonic-gate	$(SED) -n -e ":a" 					\
862*7c478bd9Sstevel@tonic-gate		  -e "h" 					\
863*7c478bd9Sstevel@tonic-gate		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
864*7c478bd9Sstevel@tonic-gate		  -e "x"					\
865*7c478bd9Sstevel@tonic-gate		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
866*7c478bd9Sstevel@tonic-gate		  -e "t a"					\
867*7c478bd9Sstevel@tonic-gate	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
868*7c478bd9Sstevel@tonic-gate
869*7c478bd9Sstevel@tonic-gate#
870*7c478bd9Sstevel@tonic-gate# When using xgettext, we want messages to go to the default domain,
871*7c478bd9Sstevel@tonic-gate# rather than the specified one.  This special version of the
872*7c478bd9Sstevel@tonic-gate# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
873*7c478bd9Sstevel@tonic-gate# causing xgettext to put all messages into the default domain.
874*7c478bd9Sstevel@tonic-gate#
875*7c478bd9Sstevel@tonic-gateCPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
876*7c478bd9Sstevel@tonic-gate
877*7c478bd9Sstevel@tonic-gate.c.i:
878*7c478bd9Sstevel@tonic-gate	$(CPPFORPO) $< > $@
879*7c478bd9Sstevel@tonic-gate
880*7c478bd9Sstevel@tonic-gate.h.i:
881*7c478bd9Sstevel@tonic-gate	$(CPPFORPO) $< > $@
882*7c478bd9Sstevel@tonic-gate
883*7c478bd9Sstevel@tonic-gate.y.i:
884*7c478bd9Sstevel@tonic-gate	$(YACC) -d $<
885*7c478bd9Sstevel@tonic-gate	$(CPPFORPO) y.tab.c  > $@
886*7c478bd9Sstevel@tonic-gate	$(RM) y.tab.c
887*7c478bd9Sstevel@tonic-gate
888*7c478bd9Sstevel@tonic-gate.l.i:
889*7c478bd9Sstevel@tonic-gate	$(LEX) $<
890*7c478bd9Sstevel@tonic-gate	$(CPPFORPO) lex.yy.c  > $@
891*7c478bd9Sstevel@tonic-gate	$(RM) lex.yy.c
892*7c478bd9Sstevel@tonic-gate
893*7c478bd9Sstevel@tonic-gate.c.po:
894*7c478bd9Sstevel@tonic-gate	$(CPPFORPO) $< > $<.i
895*7c478bd9Sstevel@tonic-gate	$(BUILD.po)
896*7c478bd9Sstevel@tonic-gate
897*7c478bd9Sstevel@tonic-gate.y.po:
898*7c478bd9Sstevel@tonic-gate	$(YACC) -d $<
899*7c478bd9Sstevel@tonic-gate	$(CPPFORPO) y.tab.c  > $<.i
900*7c478bd9Sstevel@tonic-gate	$(BUILD.po)
901*7c478bd9Sstevel@tonic-gate	$(RM) y.tab.c
902*7c478bd9Sstevel@tonic-gate
903*7c478bd9Sstevel@tonic-gate.l.po:
904*7c478bd9Sstevel@tonic-gate	$(LEX) $<
905*7c478bd9Sstevel@tonic-gate	$(CPPFORPO) lex.yy.c  > $<.i
906*7c478bd9Sstevel@tonic-gate	$(BUILD.po)
907*7c478bd9Sstevel@tonic-gate	$(RM) lex.yy.c
908*7c478bd9Sstevel@tonic-gate
909*7c478bd9Sstevel@tonic-gate#
910*7c478bd9Sstevel@tonic-gate# Rules to perform stylistic checks
911*7c478bd9Sstevel@tonic-gate#
912*7c478bd9Sstevel@tonic-gate.SUFFIXES: $(SUFFIXES) .x .xml .check .xmlchk
913*7c478bd9Sstevel@tonic-gate
914*7c478bd9Sstevel@tonic-gate.h.check:
915*7c478bd9Sstevel@tonic-gate	$(DOT_H_CHECK)
916*7c478bd9Sstevel@tonic-gate
917*7c478bd9Sstevel@tonic-gate.x.check:
918*7c478bd9Sstevel@tonic-gate	$(DOT_X_CHECK)
919*7c478bd9Sstevel@tonic-gate
920*7c478bd9Sstevel@tonic-gate.xml.xmlchk:
921*7c478bd9Sstevel@tonic-gate	$(MANIFEST_CHECK)
922*7c478bd9Sstevel@tonic-gate
923*7c478bd9Sstevel@tonic-gate#
924*7c478bd9Sstevel@tonic-gate# Rules to process ONC+ Source partial files
925*7c478bd9Sstevel@tonic-gate#
926*7c478bd9Sstevel@tonic-gate%_onc_plus:	%
927*7c478bd9Sstevel@tonic-gate	@$(ECHO) "extracting code from $< ... "
928*7c478bd9Sstevel@tonic-gate	sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $<  > $@
929