Makefile.master revision 2886:be6558533f55
1212420Sken#
2212420Sken# CDDL HEADER START
3212420Sken#
4212420Sken# The contents of this file are subject to the terms of the
5212420Sken# Common Development and Distribution License (the "License").
6212420Sken# You may not use this file except in compliance with the License.
7212420Sken#
8212420Sken# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9212420Sken# or http://www.opensolaris.org/os/licensing.
10212420Sken# See the License for the specific language governing permissions
11212420Sken# and limitations under the License.
12212420Sken#
13212420Sken# When distributing Covered Code, include this CDDL HEADER in each
14212420Sken# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15212420Sken# If applicable, add the following below this CDDL HEADER, with the
16212420Sken# fields enclosed by brackets "[]" replaced with your own identifying
17212420Sken# information: Portions Copyright [yyyy] [name of copyright owner]
18212420Sken#
19212420Sken# CDDL HEADER END
20212420Sken#
21212420Sken
22212420Sken#
23212420Sken# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24212420Sken# Use is subject to license terms.
25212420Sken#
26212420Sken# ident	"%Z%%M%	%I%	%E% SMI"
27212420Sken#
28212420Sken
29212420Sken#
30212420Sken# Makefile.master, global definitions for system source
31212420Sken#
32212420SkenROOT=		/proto
33212420Sken
34230592Sken# Historically, ON builds were always done with root permissions, and the
35237683Sken# owner/group information was duplicated in the Makefiles and the packaging
36230592Sken# data and kept in sync by manual intervention.  This is no longer true.
37230592Sken# The only source of this information is packaging.  The proto area ($ROOT)
38230592Sken# does not have definitive onwer/group information, and no Makefile should
39230592Sken# attempt to set this.  CH once toggled operations restricted to root.  It
40230592Sken# is now just set to `#'.
41230592Sken#
42230592Sken# At some point in the future, CH, CHOWN, CHGRP, OWNER, and GROUP should all
43230592Sken# be stripped completely from the source base.  They are kept for now until
44230592Sken# on10-based projects can merge and transition away from them.
45230592Sken#
46230592Sken# RELEASE_BUILD should be cleared for final release builds. This is completely
47230592Sken# independent of CH. NOT_RELEASE_BUILD is exactly what the name implies.
48230592Sken#
49230592Sken# INTERNAL_RELEASE_BUILD is a subset of RELEASE_BUILD. It mostly controls
50230592Sken# identification strings. Enabling RELEASE_BUILD automatically enables
51230592Sken# INTERNAL_RELEASE_BUILD.
52230592Sken#
53230592Sken# EXPORT_RELEASE_BUILD controls whether binaries are built in a form that
54230592Sken# can be released for export under a binary license.  It is orthogonal to
55230592Sken# the other *RELEASE_BUILD settings.  ("#" means do an export release
56230592Sken# build, "" means do a normal build.)
57230592Sken#
58230592Sken# CLOSED_BUILD controls whether we try to build files under
59230592Sken# usr/closed.  ("" means to build closed code, "#" means don't try to
60230592Sken# build it.)  Skipping the closed code implies doing an export release
61230592Sken# build.
62230592Sken#
63212420Sken# STRIP_COMMENTS toggles comment section striping. Generally the same setting
64212420Sken# as INTERNAL_RELEASE_BUILD.
65212420Sken#
66212420Sken# __GNUC toggles the building of ON components using gcc and related tools.
67212420Sken# Normally set to `#', set it to `' to do gcc build.
68212420Sken#
69212420Sken# The declaration POUND_SIGN is always '#'. This is needed to get around the
70212420Sken# make feature that '#' is always a comment delimiter, even when escaped or
71212420Sken# quoted.  The only way of generating this is the :sh macro mechanism.  Note
72212420Sken# however that in general :sh macros should be avoided in makefiles that are
73212420Sken# widely included into other makefiles, as the resulting shell executions can
74212420Sken# cause a noticable slowdown in build times.
75212420Sken#
76212420SkenPOUND_SIGN:sh=				echo \\043
77212420SkenCH=					$(POUND_SIGN)
78212420Sken
79212420SkenNOT_RELEASE_BUILD=
80212420SkenINTERNAL_RELEASE_BUILD=			$(POUND_SIGN)
81212420SkenRELEASE_BUILD=				$(POUND_SIGN)
82212420Sken$(RELEASE_BUILD)NOT_RELEASE_BUILD=	$(POUND_SIGN)
83212420Sken$(RELEASE_BUILD)INTERNAL_RELEASE_BUILD=
84212420SkenPATCH_BUILD=				$(POUND_SIGN)
85212420Sken
86212420Sken# If CLOSED_IS_PRESENT is not set, assume the closed tree is present.
87212420SkenCLOSED_BUILD_1=	$(CLOSED_IS_PRESENT:yes=)
88212420SkenCLOSED_BUILD=	$(CLOSED_BUILD_1:no=$(POUND_SIGN))
89212420Sken
90212420SkenEXPORT_RELEASE_BUILD=			$(POUND_SIGN)
91212420Sken$(CLOSED_BUILD)EXPORT_RELEASE_BUILD=
92212420Sken
93212420Sken# SPARC_BLD is '#' for an Intel build.
94212420Sken# INTEL_BLD is '#' for a Sparc build.
95212420SkenSPARC_BLD_1=    $(MACH:i386=$(POUND_SIGN))
96212420SkenSPARC_BLD=      $(SPARC_BLD_1:sparc=)
97212420SkenINTEL_BLD_1=    $(MACH:sparc=$(POUND_SIGN))
98212420SkenINTEL_BLD=      $(INTEL_BLD_1:i386=)
99212420Sken
100212420SkenSTRIP_COMMENTS=	$(INTERNAL_RELEASE_BUILD)
101212420Sken
102212420Sken# set __GNUC= in the environment to build 32-bit with the gcc compiler.
103212420Sken# The default is to use the Sun Studio compiler for all processor types.
104212420Sken__GNUC=		$(POUND_SIGN)
105212420Sken
106212420Sken# set __GNUC64= in the environment to build 64-bit with the gcc compiler.
107212420Sken# Inherit the __GNUC value by default, and if that is set to $(POUND_SIGN)
108212420Sken# then this means use the Sun Studio compiler.
109212420Sken__GNUC64=	$(__GNUC)
110212420Sken
111212420Sken# set __SSNEXT= in the enviroment to build with the 'next' release of
112212420Sken# the Sun Studio compiler. This will cause command line options specific
113212420Sken# to the 'next' version of the Sun Studio compiler to be used.
114212420Sken__SSNEXT=	$(POUND_SIGN)
115212420Sken
116212420Sken# CLOSED is the root of the tree that contains source which isn't released
117212420Sken# as open source
118212420SkenCLOSED=		$(SRC)/../closed
119212420Sken
120212420Sken# BUILD_TOOLS is the root of all tools including compilers.
121212420Sken# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
122212420Sken
123212420SkenBUILD_TOOLS=		/ws/onnv-tools
124212420SkenONBLD_TOOLS=		$(BUILD_TOOLS)/onbld
125230592Sken
126230592SkenJAVA_ROOT=	/usr/java
127230592Sken
128230592SkenSFW_ROOT=	/usr/sfw
129230592SkenSFWINCDIR=	$(SFW_ROOT)/include
130230592SkenSFWLIBDIR=	$(SFW_ROOT)/lib
131230592SkenSFWLIBDIR64=	$(SFW_ROOT)/lib/$(MACH64)
132230592Sken
133230592SkenRPCGEN=		/usr/bin/rpcgen
134230592SkenSTABS=		$(ONBLD_TOOLS)/bin/$(MACH)/stabs
135230592SkenECHO=		echo
136230592SkenINS=		install
137230592SkenTRUE=		true
138230592SkenSYMLINK=	/usr/bin/ln -s
139230592SkenLN=		/usr/bin/ln
140230592SkenCHMOD=		/usr/bin/chmod
141230592SkenCHOWN=		$(TRUE)
142230592SkenCHGRP=		$(TRUE)
143230592SkenMV=		/usr/bin/mv -f
144230592SkenRM=		/usr/bin/rm -f
145230592SkenGREP=		/usr/bin/grep
146230592SkenEGREP=		/usr/bin/egrep
147230592SkenSED=		/usr/bin/sed
148230592SkenNAWK=		/usr/bin/nawk
149230592SkenCP=		/usr/bin/cp -f
150230592SkenMCS=		/usr/ccs/bin/mcs
151230592SkenCAT=            /usr/bin/cat
152230592SkenM4=		/usr/ccs/bin/m4
153230592SkenSTRIP=		/usr/ccs/bin/strip
154230592SkenLEX=		/usr/ccs/bin/lex
155230592SkenYACC=		/usr/ccs/bin/yacc
156230592SkenCPP=		/usr/lib/cpp
157230592SkenJAVAC=		$(JAVA_ROOT)/bin/javac
158230592SkenJAVAH=		$(JAVA_ROOT)/bin/javah
159230592SkenJAVADOC=	$(JAVA_ROOT)/bin/javadoc
160230592SkenRMIC=		$(JAVA_ROOT)/bin/rmic
161230592SkenJAR=		$(JAVA_ROOT)/bin/jar
162230592SkenCTFCONVERT=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
163230592SkenCTFMERGE=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
164230592SkenCTFSTABS=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
165230592SkenGENOFFSETS=	$(ONBLD_TOOLS)/bin/genoffsets
166230592SkenCTFCVTPTBL=	$(ONBLD_TOOLS)/bin/ctfcvtptbl
167230592SkenCTFFINDMOD=	$(ONBLD_TOOLS)/bin/ctffindmod
168230592SkenXREF=		$(ONBLD_TOOLS)/bin/xref
169230592SkenFIND=		/usr/bin/find
170230592SkenPERL=		/usr/bin/perl
171230592SkenSORT=		/usr/bin/sort
172230592SkenTOUCH=		/usr/bin/touch
173230592SkenWC=		/usr/bin/wc
174230592SkenXARGS=		/usr/bin/xargs
175230592SkenELFSIGN=	/usr/bin/elfsign
176230592SkenDTRACE=		/usr/sbin/dtrace
177230592SkenCHECK_FNAMES=	$(ONBLD_TOOLS)/bin/check_fnames
178230592Sken
179230592Sken# Due to 6367203, objects built with gcc will fail the namespace checks.
180230592Sken# Remove this override once the compiler bug is fixed.
181230592Sken$(__GNUC)CHECK_FNAMES=	$(TRUE)
182230592Sken
183230592SkenFILEMODE=	644
184230592SkenDIRMODE=	755
185230592Sken
186230592Sken# Note: owner and group for proto area objects is no longer set by
187230592Sken# Makefiles at all.  These have no real effect and are kept here for
188230592Sken# transition purposes.  They (along with CH, CHOWN, and CHGRP) should be
189230592Sken# removed early in the s11 development cycle.
190230592SkenOWNER=		root
191230592SkenGROUP=		bin
192230592Sken
193230592Sken#
194230592Sken# The version of the patch makeup table optimized for build-time use.  Used
195230592Sken# during patch builds only.
196230592Sken$(PATCH_BUILD)PMTMO_FILE=$(SRC)/patch_makeup_table.mo
197230592Sken
198230592Sken# Declare that nothing should be built in parallel.
199230592Sken# Individual Makefiles can use the .PARALLEL target to declare otherwise.
200230592Sken.NO_PARALLEL:
201230592Sken
202230592Sken# For stylistic checks
203230592Sken#
204230592Sken# Note that the X and C checks are not used at this time and may need
205230592Sken# modification when they are actually used.
206230592Sken#
207230592SkenCSTYLE=		cstyle
208230592SkenCSTYLE_TAIL=
209230592SkenHDRCHK=		hdrchk
210230592SkenHDRCHK_TAIL=
211230592SkenJSTYLE=		jstyle
212230592Sken
213230592SkenDOT_H_CHECK=	\
214230592Sken	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
215230592Sken	$(HDRCHK) $< $(HDRCHK_TAIL)
216230592Sken
217230592SkenDOT_X_CHECK=	\
218230592Sken	@$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
219230592Sken	$(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
220230592Sken
221230592SkenDOT_C_CHECK=	\
222230592Sken	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
223230592Sken
224230592SkenMANIFEST_CHECK=	\
225230592Sken	@$(ECHO) "checking $<"; \
226230592Sken	SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
227230592Sken	$(SRC)/cmd/svc/svccfg/svccfg-native validate $<
228230592Sken
229230592SkenINS.file=	$(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
230230592SkenINS.dir=	$(INS) -s -d -m $(DIRMODE) $@
231230592Sken# installs and renames at once
232230592Sken#
233230592SkenINS.rename=	$(INS.file); $(MV) $(@D)/$(<F) $@
234230592Sken
235230592Sken# install a link
236230592SkenINSLINKTARGET=	$<
237230592SkenINS.link=	$(RM) $@; $(LN) $(INSLINKTARGET) $@
238230592Sken
239230592Sken# MACH must be set in the shell environment per uname -p on the build host
240230592Sken# More specific architecture variables should be set in lower makefiles.
241230592Sken#
242230592Sken# MACH64 is derived from MACH, and BUILD64 is set to `#' for
243230592Sken# architectures on which we do not build 64-bit versions.
244230592Sken# (There are no such architectures at the moment.)
245230592Sken#
246230592Sken# Set BUILD64=# in the environment to disable 64-bit amd64
247230592Sken# builds on i386 machines.
248230592Sken
249230592SkenMACH64_1=	$(MACH:sparc=sparcv9)
250230592SkenMACH64=		$(MACH64_1:i386=amd64)
251230592Sken
252230592SkenMACH32_1=	$(MACH:sparc=sparcv7)
253230592SkenMACH32=		$(MACH32_1:i386=i86)
254230592Sken
255230592Skensparc_BUILD64=
256230592Skeni386_BUILD64=
257230592SkenBUILD64=	$($(MACH)_BUILD64)
258230592Sken
259230592Sken#
260230592Sken# C compiler mode. Future compilers may change the default on us,
261230592Sken# so force extended ANSI mode globally. Lower level makefiles can
262230592Sken# override this by setting CCMODE.
263230592Sken#
264230592SkenCCMODE=			-Xa
265230592SkenCCMODE64=		-Xa
266230592Sken
267230592Sken#
268230592Sken# C compiler verbose mode. This is so we can enable it globally,
269230592Sken# but turn it off in the lower level makefiles of things we cannot
270230592Sken# (or aren't going to) fix.
271230592Sken#
272230592SkenCCVERBOSE=		-v
273230592Sken
274230592Sken# set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings
275230592Sken# from the compiler about places the -xarch=v9 may differ from -xarch=v9c.
276230592SkenV9ABIWARN=
277230592Sken
278230592Sken# set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register
279230592Sken# symbols (used to detect conflicts between objects that use global registers)
280230592Sken# we disable this now for safety, and because genunix doesn't link with
281230592Sken# this feature (the v9 default) enabled.
282230592Sken#
283230592Sken# REGSYM is separate since the C++ driver syntax is different.
284230592SkenCCREGSYM=		-Wc,-Qiselect-regsym=0
285230592SkenCCCREGSYM=		-Qoption cg -Qiselect-regsym=0
286230592Sken
287230592Sken# Prevent the removal of static symbols by the SPARC code generator (cg).
288230592Sken# The x86 code generator (ube) does not remove such symbols and as such
289230592Sken# using this workaround is not applicable for x86.
290230592Sken#
291230592SkenCCSTATICSYM=		-Wc,-Qassembler-ounrefsym=0
292230592Sken#
293230592Sken# generate 32-bit addresses in the v9 kernel. Saves memory.
294230592SkenCCABS32=		-Wc,-xcode=abs32
295230592Sken
296230592Sken# One optimization the compiler might perform is to turn this:
297230592Sken#	#pragma weak foo
298230592Sken#	extern int foo;
299230592Sken#	if (&foo)
300230592Sken#		foo = 5;
301230592Sken# into
302230592Sken#	foo = 5;
303230592Sken# Since we do some of this (foo might be referenced in common kernel code
304230592Sken# but provided only for some cpu modules or platforms), we disable this
305230592Sken# optimization.
306230592Sken# 
307230592Skensparc_CCUNBOUND	= -Wd,-xsafe=unboundsym
308230592Skeni386_CCUNBOUND	=
309230592SkenCCUNBOUND	= $($(MACH)_CCUNBOUND)
310230592Sken
311230592Sken#
312230592Sken# compiler '-xarch' flag. This is here to centralize it and make it
313230592Sken# overridable for testing.
314230592Skensparc_XARCH=		-xarch=v8
315230592Skensparcv9_XARCH=		-xarch=v9
316230592Skeni386_XARCH=
317230592Skenamd64_XARCH=		-xarch=amd64 -Ui386 -U__i386
318230592Sken
319230592Sken# assembler '-xarch' flag.  Different from compiler '-xarch' flag.
320230592Skensparc_AS_XARCH=		-xarch=v8plus
321230592Skensparcv9_AS_XARCH=	-xarch=v9
322230592Skeni386_AS_XARCH=
323230592Skenamd64_AS_XARCH=		-xarch=amd64 -P -Ui386 -U__i386
324230592Sken
325230592Sken#
326230592Sken# These flags define what we need to be 'standalone' i.e. -not- part
327230592Sken# of the rather more cosy userland environment.  This basically means
328230592Sken# the kernel.
329230592Sken#
330230592Sken# XX64	future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
331230592Sken#
332230592Skensparc_STAND_FLAGS=	-_gcc=-ffreestanding
333230592Skensparcv9_STAND_FLAGS=	-_gcc=-ffreestanding
334230592Skeni386_STAND_FLAGS=	-_gcc=-ffreestanding
335230592Skenamd64_STAND_FLAGS=	-Wu,-xmodel=kernel
336230592Sken$(__SSNEXT)amd64_STAND_FLAGS=	-xmodel=kernel
337230592Sken
338230592SkenSAVEARGS=		-Wu,-save_args
339230592Skenamd64_STAND_FLAGS	+= $(SAVEARGS)
340230592Sken
341230592SkenSTAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
342230592SkenSTAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
343230592Sken
344230592Sken#
345230592Sken# disable the incremental linker
346230592SkenILDOFF=			-xildoff
347230592Sken#
348230592SkenXDEPEND=		-xdepend
349230592SkenXFFLAG=			-xF
350230592SkenXESS=			-xs
351230592SkenXSTRCONST=		-xstrconst 
352230592Sken
353230592Sken#
354230592Sken# turn warnings into errors (C)
355230592SkenCERRWARN = -errtags=yes -errwarn=%all
356212420SkenCERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT
357212420SkenCERRWARN += -erroff=E_STATEMENT_NOT_REACHED
358212420Sken
359212420Sken#
360212420Sken# turn warnings into errors (C++)
361212420SkenCCERRWARN=		-xwe
362212420Sken
363212420Sken# C99 mode
364230592SkenC99_ENABLE=	-xc99=%all
365230592SkenC99_DISABLE=	-xc99=%none
366230592SkenC99MODE=	$(C99_DISABLE)
367230592SkenC99LMODE=	$(C99MODE:-xc99%=-Xc99%)
368230592Sken
369230592Sken# In most places, assignments to these macros should be appended with +=
370230592Sken# (CPPFLAGS.master allows values to be prepended to CPPFLAGS).
371230592Skensparc_CFLAGS=	$(sparc_XARCH) $(CCSTATICSYM)
372230592Skensparcv9_CFLAGS=	$(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM) \
373230592Sken		$(CCSTATICSYM)
374230592Skeni386_CFLAGS=	$(i386_XARCH)
375230592Skenamd64_CFLAGS=	$(amd64_XARCH)
376230592Sken
377230592Skensparc_ASFLAGS=	$(sparc_AS_XARCH)
378230592Skensparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
379230592Skeni386_ASFLAGS=	$(i386_AS_XARCH)
380230592Skenamd64_ASFLAGS=	$(amd64_AS_XARCH)
381230592Sken
382230592Sken#
383230592Skensparc_COPTFLAG=		-xO3
384230592Skensparcv9_COPTFLAG=	-xO3
385230592Skeni386_COPTFLAG=		-O
386230592Skenamd64_COPTFLAG=		-xO3
387212420Sken
388COPTFLAG= $($(MACH)_COPTFLAG)
389COPTFLAG64= $($(MACH64)_COPTFLAG)
390
391# When -g is used, the compiler globalizes static objects
392# (gives them a unique prefix). Disable that.
393CNOGLOBAL= -W0,-noglobal
394
395# Direct the Sun Studio compiler to use a static globalization prefix based on the
396# name of the module rather than something unique. Otherwise, objects
397# will not build deterministically, as subsequent compilations of identical
398# source will yeild objects that always look different.
399#
400# In the same spirit, this will also remove the date from the N_OPT stab.
401CGLOBALSTATIC= -W0,-xglobalstatic
402
403# Normally, gcc uses indirect DWARF strings to save space.  However,
404# this causes relocations that ctfconvert cannot handle.  Disable this.
405CDWARFSTR=	-_gcc=-fno-dwarf2-indirect-strings
406
407# Sometimes we want all symbols and types in debugging information even
408# if they aren't used.
409CALLSYMS=	-W0,-xdbggen=no%usedonly
410
411#
412# Default debug format for Sun Studio 11 is dwarf, so force it to
413# generate stabs.
414#
415DEBUGFORMAT=	-xdebugformat=stabs
416
417#
418# Flags used to build in debug mode for ctf generation.  Bugs in the Devpro
419# compilers currently prevent us from building with cc-emitted DWARF.
420#
421CTF_FLAGS_sparc	= -g -Wc,-Qiselect-T1 $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
422CTF_FLAGS_i386	= -g $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
423CTF_FLAGS	= $(CTF_FLAGS_$(MACH)) $(DEBUGFORMAT)
424
425#
426# Flags used with genoffsets
427#
428GOFLAGS = -_noecho \
429	$(CALLSYMS) \
430	$(CDWARFSTR)
431
432OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
433	$(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
434
435OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
436	$(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
437
438#
439# tradeoff time for space (smaller is better)
440#
441sparc_SPACEFLAG		= -xspace -W0,-Lt
442sparcv9_SPACEFLAG	= -xspace -W0,-Lt
443i386_SPACEFLAG		= -xspace
444amd64_SPACEFLAG		=
445
446SPACEFLAG		= $($(MACH)_SPACEFLAG)
447SPACEFLAG64		= $($(MACH64)_SPACEFLAG)
448
449#
450# The Sun Studio 11 compiler has changed the behaviour of integer
451# wrap arounds and so a flag is needed to use the legacy behaviour
452# (without this flag panics/hangs could be exposed within the source).
453#
454sparc_IROPTFLAG		= -W2,-xwrap_int
455sparcv9_IROPTFLAG	= -W2,-xwrap_int
456i386_IROPTFLAG		=
457amd64_IROPTFLAG		=
458
459IROPTFLAG		= $($(MACH)_IROPTFLAG)
460IROPTFLAG64		= $($(MACH64)_IROPTFLAG)
461
462sparc_XREGSFLAG		= -xregs=no%appl
463sparcv9_XREGSFLAG	= -xregs=no%appl
464i386_XREGSFLAG		=
465amd64_XREGSFLAG		=
466
467XREGSFLAG		= $($(MACH)_XREGSFLAG)
468XREGSFLAG64		= $($(MACH64)_XREGSFLAG)
469
470CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
471		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \
472		$(CGLOBALSTATIC)
473CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
474		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \
475		$(CGLOBALSTATIC)
476#
477# Flags that are used to build parts of the code that are subsequently
478# run on the build machine (also known as the NATIVE_BUILD).
479#
480NATIVE_CFLAGS=	$(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
481		$(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \
482		$(IROPTFLAG) $(CGLOBALSTATIC)
483
484DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"	# For messaging.
485DTS_ERRNO=-D_TS_ERRNO
486CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
487	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
488CPPFLAGS=	$(CPPFLAGS.master)
489AS_CPPFLAGS=	$(CPPFLAGS.master)
490JAVAFLAGS=	-deprecation
491
492#
493# For source message catalogue
494#
495.SUFFIXES: $(SUFFIXES) .i .po
496MSGROOT= $(ROOT)/catalog
497MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
498MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
499DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN) 
500DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
501
502CLOBBERFILES += $(POFILE) $(POFILES)
503COMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
504XGETTEXT= /usr/bin/xgettext
505XGETFLAGS= -c TRANSLATION_NOTE
506BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
507	$(RM)	$@ ;\
508	sed "/^domain/d" < $(<F).po > $@ ;\
509	$(RM) $(<F).po $<.i
510#
511# This is overwritten by local Makefile when PROG is a list.
512#
513POFILE= $(PROG).po
514
515sparc_CCFLAGS=		-cg92 -compat=4 \
516			-Qoption ccfe -messages=no%anachronism \
517			$(CCERRWARN)
518sparcv9_CCFLAGS=	$(sparcv9_XARCH) -dalign -compat=5 \
519			-Qoption ccfe -messages=no%anachronism \
520			-Qoption ccfe -features=no%conststrings \
521			$(CCCREGSYM) \
522			$(CCERRWARN)
523i386_CCFLAGS=		-compat=4 \
524			-Qoption ccfe -messages=no%anachronism \
525			-Qoption ccfe -features=no%conststrings \
526			$(CCERRWARN)
527amd64_CCFLAGS=		$(amd64_XARCH) -compat=5 \
528			-Qoption ccfe -messages=no%anachronism \
529			-Qoption ccfe -features=no%conststrings \
530			$(CCERRWARN)
531
532sparc_CCOPTFLAG=	-O
533sparcv9_CCOPTFLAG=	-O
534i386_CCOPTFLAG=		-O
535amd64_CCOPTFLAG=	-O
536
537CCOPTFLAG=	$($(MACH)_CCOPTFLAG)
538CCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
539CCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS)
540CCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS)
541#
542# Used by Makefile.cmd, Makefile.lib and Makefile.ucbcmd
543#
544PGA_MAPFILE =	$(SRC)/cmd/sgs/mapfiles/$(MACH)/map.pagealign
545#
546# 
547# LDLIBS32 can be set in the environment to override the following assignment.
548# LDLIBS64 can be set to override the assignment made in Makefile.master.64.
549# These environment settings make sure that no libraries are searched outside
550# of the local workspace proto area:
551#	LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
552#	LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
553#
554LDLIBS32 =	$(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
555LDLIBS.cmd = 	$(LDLIBS32)
556LDLIBS.lib =	$(LDLIBS32)
557#
558# Define compilation macros.
559#
560COMPILE.c=	$(CC) $(CFLAGS) $(CPPFLAGS) -c
561COMPILE64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) -c
562COMPILE.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
563COMPILE64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
564COMPILE.s=	$(AS) $(ASFLAGS) $(AS_CPPFLAGS)
565COMPILE64.s=	$(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
566COMPILE.d=	$(DTRACE) -G -32
567COMPILE64.d=	$(DTRACE) -G -64
568
569CLASSPATH=	.
570COMPILE.java=	$(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
571
572#
573# Link time macros
574#
575CCNEEDED		= -lC
576$(__GNUC)CCNEEDED	= -L$(SFWLIBDIR) -R$(SFWLIBDIR) -lstdc++ -lgcc_s
577
578LINK.c=		$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
579LINK64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
580NORUNPATH=	-norunpath -nolib
581LINK.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
582		$(LDFLAGS) $(CCNEEDED)
583LINK64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
584		$(LDFLAGS) $(CCNEEDED)
585
586#
587# lint macros
588#
589# Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once
590# ON is built with a version of lint that has the fix for 4484186.
591#
592ALWAYS_LINT_DEFS =	-errtags=yes -s
593ALWAYS_LINT_DEFS +=	-erroff=E_PTRDIFF_OVERFLOW
594ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_NARROW_CONV
595ALWAYS_LINT_DEFS +=	-U__PRAGMA_REDEFINE_EXTNAME
596ALWAYS_LINT_DEFS +=	$(C99LMODE)
597ALWAYS_LINT_DEFS +=	-errsecurity=$(SECLEVEL)
598ALWAYS_LINT_DEFS +=	-erroff=E_SEC_CREAT_WITHOUT_EXCL
599ALWAYS_LINT_DEFS +=	-erroff=E_SEC_FORBIDDEN_WARN_CREAT
600# XX64 -- really only needed for amd64 lint
601ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_INT_TO_SMALL_INT
602ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_CONST_TO_SMALL_INT
603ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_TO_SMALL_INT
604ALWAYS_LINT_DEFS +=	-erroff=E_CAST_TO_PTR_FROM_INT
605ALWAYS_LINT_DEFS +=	-erroff=E_COMP_INT_WITH_LARGE_INT
606ALWAYS_LINT_DEFS +=	-erroff=E_INTEGRAL_CONST_EXP_EXPECTED
607ALWAYS_LINT_DEFS +=	-erroff=E_PASS_INT_TO_SMALL_INT
608ALWAYS_LINT_DEFS +=	-erroff=E_PTR_CONV_LOSES_BITS
609
610SECLEVEL=	core
611LINT.c=		$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(ALWAYS_LINT_DEFS)
612LINT64.c=	$(LINT) $(LINTFLAGS64) $(CPPFLAGS) $(ALWAYS_LINT_DEFS)
613LINT.s=		$(LINT.c)
614
615# For some future builds, NATIVE_MACH and MACH might be different.
616# Therefore, NATIVE_MACH needs to be redefined in the
617# environment as `uname -p` to override this macro.
618#
619# For now at least, we cross-compile amd64 on i386 machines.
620NATIVE_MACH=	$(MACH:amd64=i386)
621
622# Define native compilation macros
623#
624
625# Base directory where compilers are loaded.
626# Defined here so it can be overridden by developer.
627#
628SPRO_ROOT=		$(BUILD_TOOLS)/SUNWspro
629SPRO_VROOT=		$(SPRO_ROOT)/SS11
630GNU_ROOT=		$(SFW_ROOT)
631
632# Specify platform compiler versions for languages
633# that we use (currently only c and c++).
634#
635sparc_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
636$(__GNUC)sparc_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
637sparc_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
638$(__GNUC)sparc_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
639sparc_CPP=		/usr/ccs/lib/cpp
640sparc_AS=		/usr/ccs/bin/as -xregsym=no
641sparc_LD=		/usr/ccs/bin/ld
642sparc_LINT=		$(SPRO_VROOT)/bin/lint
643
644sparcv9_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
645$(__GNUC64)sparcv9_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
646sparcv9_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
647$(__GNUC64)sparcv9_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
648sparcv9_CPP=		/usr/ccs/lib/cpp
649sparcv9_AS=		/usr/ccs/bin/as -xregsym=no
650sparcv9_LD=		/usr/ccs/bin/ld
651sparcv9_LINT=		$(SPRO_VROOT)/bin/lint
652
653# We compile 32-bit objects with cc by default
654i386_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
655$(__GNUC)i386_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
656i386_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
657$(__GNUC)i386_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
658i386_CPP=		/usr/ccs/lib/cpp
659i386_AS=		/usr/ccs/bin/as
660$(__GNUC)i386_AS=	$(ONBLD_TOOLS)/bin/$(MACH)/aw
661i386_LD=		/usr/ccs/bin/ld
662i386_LINT=		$(SPRO_VROOT)/bin/lint
663
664# We compile 64-bit objects with gcc
665amd64_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
666$(__GNUC64)amd64_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
667amd64_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
668$(__GNUC64)amd64_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
669amd64_CPP=		/usr/ccs/lib/cpp
670amd64_AS=		$(ONBLD_TOOLS)/bin/$(MACH)/aw
671amd64_LD=		/usr/ccs/bin/ld
672amd64_LINT=		$(SPRO_VROOT)/bin/lint
673
674NATIVECC=		$($(NATIVE_MACH)_CC)
675NATIVECCC=		$($(NATIVE_MACH)_CCC)
676NATIVECPP=		$($(NATIVE_MACH)_CPP)
677NATIVEAS=		$($(NATIVE_MACH)_AS)
678NATIVELD=		$($(NATIVE_MACH)_LD)
679NATIVELINT=		$($(NATIVE_MACH)_LINT)
680
681#
682# Makefile.master.64 overrides these settings
683#
684CC=			$(NATIVECC)
685CCC=			$(NATIVECCC)
686CPP=			$(NATIVECPP)
687AS=			$(NATIVEAS)
688LD=			$(NATIVELD)
689LINT=			$(NATIVELINT)
690
691# The real compilers used for this build
692CW_CC_CMD=		$(CC) -_compiler
693CW_CCC_CMD=		$(CCC) -_compiler
694REAL_CC=		$(CW_CC_CMD:sh)
695REAL_CCC=		$(CW_CCC_CMD:sh)
696
697# Pass -Y flag to cpp (method of which is release-dependent)
698CCYFLAG=		-Y I,
699
700BDIRECT=	-Bdirect
701BDYNAMIC=	-Bdynamic
702BLOCAL=		-Blocal
703BREDUCE=	-Breduce
704BSTATIC=	-Bstatic
705BSYMBOLIC=	-Bsymbolic
706
707ZCOMBRELOC=	-zcombreloc
708ZDEFS=		-zdefs
709ZIGNORE=	-zignore
710ZINITFIRST=	-zinitfirst
711ZINTERPOSE=	-zinterpose
712ZLAZYLOAD=	-zlazyload
713ZLOADFLTR=	-zloadfltr
714ZMULDEFS=	-zmuldefs
715ZNODEFAULTLIB=	-znodefaultlib
716ZNODEFS=	-znodefs
717ZNODELETE=	-znodelete
718ZNODLOPEN=	-znodlopen
719ZNODUMP=	-znodump
720ZNOLAZYLOAD=	-znolazyload
721ZNORELOC=	-znoreloc
722ZNOVERSION=	-znoversion
723ZREDLOCSYM=	-zredlocsym
724ZTEXT=		-ztext
725
726GSHARED=	-G
727CCMT=		-mt
728
729# Handle different PIC models on different ISAs
730# (May be overridden by lower-level Makefiles)
731
732sparc_C_PICFLAGS =	-K pic
733sparcv9_C_PICFLAGS =	-K pic
734i386_C_PICFLAGS =	-K pic
735amd64_C_PICFLAGS =	-K pic
736C_PICFLAGS =		$($(MACH)_C_PICFLAGS)
737C_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
738
739sparc_C_BIGPICFLAGS =	-K PIC
740sparcv9_C_BIGPICFLAGS =	-K PIC
741i386_C_BIGPICFLAGS =	-K PIC
742amd64_C_BIGPICFLAGS =	-K PIC
743C_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
744C_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
745
746# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
747sparc_CC_PICFLAGS =	-Kpic
748sparcv9_CC_PICFLAGS =	-KPIC
749i386_CC_PICFLAGS = 	-Kpic
750amd64_CC_PICFLAGS = 	-Kpic
751CC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
752CC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
753
754AS_PICFLAGS=		$(C_PICFLAGS)
755AS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
756
757#
758# Default label for CTF sections
759#
760CTFCVTFLAGS=		-i -L VERSION
761
762#
763# Override to pass module-specific flags to ctfmerge.  Currently used
764# only by krtld to turn on fuzzy matching.
765#
766CTFMRGFLAGS=
767
768CTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
769
770ELFSIGN_O=	$(TRUE)
771ELFSIGN_CRYPTO=	$(ELFSIGN_O)
772ELFSIGN_OBJECT=	$(ELFSIGN_O)
773$(EXPORT_RELEASE_BUILD)ELFSIGN_O =	$(ELFSIGN)
774$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY =	\
775			$(CLOSED)/cmd/cmd-crypto/etc/keys/SUNWosnet
776$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT=	\
777			$(CLOSED)/cmd/cmd-crypto/etc/certs/SUNWosnet
778$(EXPORT_RELEASE_BUILD)ELFSIGN_SEKEY =	\
779			$(CLOSED)/cmd/cmd-crypto/etc/keys/SUNWosnetSolaris
780$(EXPORT_RELEASE_BUILD)ELFSIGN_SECERT=	\
781			$(CLOSED)/cmd/cmd-crypto/etc/certs/SUNWosnetSolaris
782$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO=	$(ELFSIGN_O) sign \
783			$(ELFSIGN_FORMAT_OPTION) \
784			-k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@
785$(EXPORT_RELEASE_BUILD)ELFSIGN_OBJECT=	$(ELFSIGN_O) sign \
786			$(ELFSIGN_FORMAT_OPTION) \
787			-k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@
788
789# Rules (normally from make.rules) and macros which are used for post
790# processing files. Normally, these do stripping of the comment section
791# automatically.
792#    RELEASE_CM:	Should be editted to reflect the release.
793#    POST_PROCESS_O:	Post-processing for `.o' files.
794#    POST_PROCESS_A:	Post-processing for `.a' files (currently null).
795#    POST_PROCESS_SO:	Post-processing for `.so' files.
796#    POST_PROCESS:	Post-processing for executable files (no suffix).
797# Note that these macros are not completely generalized as they are to be
798# used with the file name to be processed following.
799#
800# It is left as an exercise to Release Engineering to embellish the generation
801# of the release comment string.
802#
803#	If this is a standard development build:
804#		compress the comment section (mcs -c)
805#		add the standard comment (mcs -a $(RELEASE_CM))
806#		add the development specific comment (mcs -a $(DEV_CM))
807#
808#	If this is an installation build:
809#		delete the comment section (mcs -d)
810#		add the standard comment (mcs -a $(RELEASE_CM))
811#		add the development specific comment (mcs -a $(DEV_CM))
812#
813#	If this is an release build:
814#		delete the comment section (mcs -d)
815#		add the standard comment (mcs -a $(RELEASE_CM))
816#
817#	The ONVERS macro sets the default value for the VERSION string
818#	within pkginfo.
819#
820# The following list of macros are used in the definition of RELEASE_CM
821# which is used to label all binaries in the build:
822#
823# 	RELEASE		Specific release of the build, eg: 5.2
824#	VERSION		Version of the build (alpha, beta, Generic)
825#	PATCHID		If this is a patch this value should contain
826#			the patchid value (eg: "Generic 100832-01"), otherwise
827#			it will be set to $(VERSION)
828#	RELEASE_DATE	Date of the Release Build
829#	PATCH_DATE	Date the patch was created, if this is blank it
830#			will default to the RELEASE_DATE
831#
832ONVERS=		"11.11"
833RELEASE=	5.11
834VERSION=	SunOS Development
835PATCHID=	$(VERSION)
836RELEASE_DATE=	October 2007
837PATCH_DATE=	$(RELEASE_DATE)
838RELEASE_CM=	"@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
839DEV_CM=		"@($(POUND_SIGN))SunOS Internal Development: \
840`$(ECHO) $$LOGNAME` `date +%Y-%m-%d` `$(ECHO) [\`basename $$CODEMGR_WS\`]`"
841
842PROCESS_COMMENT=		   @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
843$(STRIP_COMMENTS)PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
844$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
845
846STRIP_STABS=			   :
847$(RELEASE_BUILD)STRIP_STABS=	   $(STRIP) -x $@
848
849POST_PROCESS_O=		$(PROCESS_COMMENT) $@
850POST_PROCESS_A=
851POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
852			$(ELFSIGN_OBJECT)
853POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
854			$(ELFSIGN_OBJECT)
855
856#
857# The PKGDEFS macro points to the source directory containing the majority
858# of ON's package definitions plus Makefiles with general package creation
859# rules.
860#
861# PKGARCHIVE specifies the default location where packages should be
862# placed if built.
863#
864PKGDEFS=$(SRC)/pkgdefs
865$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
866PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
867
868#	Default build rules which perform comment section post-processing.
869#
870.c:
871	$(LINK.c) -o $@ $< $(LDLIBS)
872	$(POST_PROCESS)
873.c.o:
874	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
875	$(POST_PROCESS_O)
876.c.a:
877	$(COMPILE.c) -o $% $<
878	$(PROCESS_COMMENT) $%
879	$(AR) $(ARFLAGS) $@ $%
880	$(RM) $%
881.s.o:
882	$(COMPILE.s) -o $@ $<
883	$(POST_PROCESS_O)
884.s.a:
885	$(COMPILE.s) -o $% $<
886	$(PROCESS_COMMENT) $%
887	$(AR) $(ARFLAGS) $@ $%
888	$(RM) $%
889.cc:
890	$(LINK.cc) -o $@ $< $(LDLIBS)
891	$(POST_PROCESS)
892.cc.o:
893	$(COMPILE.cc) $(OUTPUT_OPTION) $<
894	$(POST_PROCESS_O)
895.cc.a:
896	$(COMPILE.cc) -o $% $<
897	$(AR) $(ARFLAGS) $@ $%
898	$(PROCESS_COMMENT) $%
899	$(RM) $%
900.y:
901	$(YACC.y) $<
902	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
903	$(POST_PROCESS)
904	$(RM) y.tab.c
905.y.o:
906	$(YACC.y) $<
907	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
908	$(POST_PROCESS_O)
909	$(RM) y.tab.c
910.l:
911	$(RM) $*.c
912	$(LEX.l) $< > $*.c
913	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
914	$(POST_PROCESS)
915	$(RM) $*.c
916.l.o:
917	$(RM) $*.c
918	$(LEX.l) $< > $*.c
919	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
920	$(POST_PROCESS_O)
921	$(RM) $*.c
922
923.java.class:
924	$(COMPILE.java) $<
925
926#
927# Rules to create message catalogue files from .sh, .ksh, .c, .y, and .l
928# files.  For .sh and .ksh files, we extract all gettext strings with
929# sed(1) (being careful to permit multiple gettext strings on the same
930# line), weed out the dups, and build the catalogue with awk(1).
931#
932
933.sh.po:
934	$(SED) -n -e ":a" 					\
935		  -e "h" 					\
936		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
937		  -e "x"					\
938		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
939		  -e "t a"					\
940	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
941
942.ksh.po:
943	$(SED) -n -e ":a" 					\
944		  -e "h" 					\
945		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
946		  -e "x"					\
947		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
948		  -e "t a"					\
949	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
950
951#
952# When using xgettext, we want messages to go to the default domain,
953# rather than the specified one.  This special version of the
954# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
955# causing xgettext to put all messages into the default domain.
956#
957CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
958
959.c.i:
960	$(CPPFORPO) $< > $@
961
962.h.i:
963	$(CPPFORPO) $< > $@
964
965.y.i:
966	$(YACC) -d $<
967	$(CPPFORPO) y.tab.c  > $@
968	$(RM) y.tab.c 
969
970.l.i:
971	$(LEX) $<
972	$(CPPFORPO) lex.yy.c  > $@
973	$(RM) lex.yy.c
974
975.c.po:
976	$(CPPFORPO) $< > $<.i
977	$(BUILD.po)
978
979.y.po:
980	$(YACC) -d $<
981	$(CPPFORPO) y.tab.c  > $<.i
982	$(BUILD.po)
983	$(RM) y.tab.c 
984
985.l.po:
986	$(LEX) $<
987	$(CPPFORPO) lex.yy.c  > $<.i
988	$(BUILD.po)
989	$(RM) lex.yy.c
990
991#
992# Rules to perform stylistic checks
993#
994.SUFFIXES: $(SUFFIXES) .x .xml .check .xmlchk
995
996.h.check:
997	$(DOT_H_CHECK)
998
999.x.check:
1000	$(DOT_X_CHECK)
1001
1002.xml.xmlchk:
1003	$(MANIFEST_CHECK)
1004
1005#
1006# Rules to process ONC+ Source partial files
1007#
1008%_onc_plus:	%
1009	@$(ECHO) "extracting code from $< ... "
1010	sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $<  > $@
1011
1012#
1013# Include rules to render automated sccs get rules "safe".
1014# 
1015include $(SRC)/Makefile.noget
1016