Makefile.master revision 6510:1c846e50b601
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21
22#
23# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29#
30# Makefile.master, global definitions for system source
31#
32ROOT=		/proto
33
34# Historically, ON builds were always done with root permissions, and the
35# owner/group information was duplicated in the Makefiles and the packaging
36# data and kept in sync by manual intervention.  This is no longer true.
37# The only source of this information is packaging.  The proto area ($ROOT)
38# does not have definitive onwer/group information, and no Makefile should
39# attempt to set this.  CH once toggled operations restricted to root.  It
40# is now just set to `#'.
41#
42# At some point in the future, CH, CHOWN, CHGRP, OWNER, and GROUP should all
43# be stripped completely from the source base.  They are kept for now until
44# on10-based projects can merge and transition away from them.
45#
46# RELEASE_BUILD should be cleared for final release builds. This is completely
47# independent of CH. NOT_RELEASE_BUILD is exactly what the name implies.
48#
49# INTERNAL_RELEASE_BUILD is a subset of RELEASE_BUILD. It mostly controls
50# identification strings. Enabling RELEASE_BUILD automatically enables
51# INTERNAL_RELEASE_BUILD.
52#
53# EXPORT_RELEASE_BUILD controls whether binaries are built in a form that
54# can be released for export under a binary license.  It is orthogonal to
55# the other *RELEASE_BUILD settings.  ("#" means do an export release
56# build, "" means do a normal build.)
57#
58# CLOSED_BUILD controls whether we try to build files under
59# usr/closed.  ("" means to build closed code, "#" means don't try to
60# build it.)  Skipping the closed code implies doing an export release
61# build.
62#
63# STRIP_COMMENTS toggles comment section striping. Generally the same setting
64# as INTERNAL_RELEASE_BUILD.
65#
66# __GNUC toggles the building of ON components using gcc and related tools.
67# Normally set to `#', set it to `' to do gcc build.
68#
69# The declaration POUND_SIGN is always '#'. This is needed to get around the
70# make feature that '#' is always a comment delimiter, even when escaped or
71# quoted.  The only way of generating this is the :sh macro mechanism.  Note
72# however that in general :sh macros should be avoided in makefiles that are
73# widely included into other makefiles, as the resulting shell executions can
74# cause a noticable slowdown in build times.
75#
76POUND_SIGN:sh=				echo \\043
77CH=					$(POUND_SIGN)
78
79NOT_RELEASE_BUILD=
80INTERNAL_RELEASE_BUILD=			$(POUND_SIGN)
81RELEASE_BUILD=				$(POUND_SIGN)
82$(RELEASE_BUILD)NOT_RELEASE_BUILD=	$(POUND_SIGN)
83$(RELEASE_BUILD)INTERNAL_RELEASE_BUILD=
84PATCH_BUILD=				$(POUND_SIGN)
85
86# If CLOSED_IS_PRESENT is not set, assume the closed tree is present.
87CLOSED_BUILD_1=	$(CLOSED_IS_PRESENT:yes=)
88CLOSED_BUILD=	$(CLOSED_BUILD_1:no=$(POUND_SIGN))
89
90EXPORT_RELEASE_BUILD=			$(POUND_SIGN)
91$(CLOSED_BUILD)EXPORT_RELEASE_BUILD=
92
93# SPARC_BLD is '#' for an Intel build.
94# INTEL_BLD is '#' for a Sparc build.
95SPARC_BLD_1=    $(MACH:i386=$(POUND_SIGN))
96SPARC_BLD=      $(SPARC_BLD_1:sparc=)
97INTEL_BLD_1=    $(MACH:sparc=$(POUND_SIGN))
98INTEL_BLD=      $(INTEL_BLD_1:i386=)
99
100STRIP_COMMENTS=	$(INTERNAL_RELEASE_BUILD)
101
102# set __GNUC= in the environment to build 32-bit with the gcc compiler.
103# The default is to use the Sun Studio compiler for all processor types.
104__GNUC=		$(POUND_SIGN)
105
106# set __GNUC64= in the environment to build 64-bit with the gcc compiler.
107# Inherit the __GNUC value by default, and if that is set to $(POUND_SIGN)
108# then this means use the Sun Studio compiler.
109__GNUC64=	$(__GNUC)
110
111# set __SSNEXT= in the enviroment to build with the 'next' release of
112# the Sun Studio compiler. This will cause command line options specific
113# to the 'next' version of the Sun Studio compiler to be used.
114__SSNEXT=	$(POUND_SIGN)
115
116# CLOSED is the root of the tree that contains source which isn't released
117# as open source
118CLOSED=		$(SRC)/../closed
119
120# BUILD_TOOLS is the root of all tools including compilers.
121# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
122
123BUILD_TOOLS=		/ws/onnv-tools
124ONBLD_TOOLS=		$(BUILD_TOOLS)/onbld
125
126JAVA_ROOT=	/usr/java
127
128SFW_ROOT=	/usr/sfw
129SFWINCDIR=	$(SFW_ROOT)/include
130SFWLIBDIR=	$(SFW_ROOT)/lib
131SFWLIBDIR64=	$(SFW_ROOT)/lib/$(MACH64)
132
133RPCGEN=		/usr/bin/rpcgen
134STABS=		$(ONBLD_TOOLS)/bin/$(MACH)/stabs
135ELFEXTRACT=	$(ONBLD_TOOLS)/bin/$(MACH)/elfextract
136MBH_PATCH=	$(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch
137ECHO=		echo
138INS=		install
139TRUE=		true
140SYMLINK=	/usr/bin/ln -s
141LN=		/usr/bin/ln
142CHMOD=		/usr/bin/chmod
143CHOWN=		$(TRUE)
144CHGRP=		$(TRUE)
145MV=		/usr/bin/mv -f
146RM=		/usr/bin/rm -f
147CUT=		/usr/bin/cut
148NM=		/usr/ccs/bin/nm
149DIFF=		/usr/bin/diff
150GREP=		/usr/bin/grep
151EGREP=		/usr/bin/egrep
152KSH93=		/usr/bin/ksh93
153SED=		/usr/bin/sed
154NAWK=		/usr/bin/nawk
155CP=		/usr/bin/cp -f
156MCS=		/usr/ccs/bin/mcs
157CAT=            /usr/bin/cat
158ELFDUMP=	/usr/ccs/bin/elfdump
159M4=		/usr/ccs/bin/m4
160STRIP=		/usr/ccs/bin/strip
161LEX=		/usr/ccs/bin/lex
162FLEX=		$(SFW_ROOT)/bin/flex
163YACC=		/usr/ccs/bin/yacc
164CPP=		/usr/lib/cpp
165JAVAC=		$(JAVA_ROOT)/bin/javac
166JAVAH=		$(JAVA_ROOT)/bin/javah
167JAVADOC=	$(JAVA_ROOT)/bin/javadoc
168RMIC=		$(JAVA_ROOT)/bin/rmic
169JAR=		$(JAVA_ROOT)/bin/jar
170CTFCONVERT=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
171CTFMERGE=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
172CTFSTABS=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
173NDRGEN=		$(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
174GENOFFSETS=	$(ONBLD_TOOLS)/bin/genoffsets
175CTFCVTPTBL=	$(ONBLD_TOOLS)/bin/ctfcvtptbl
176CTFFINDMOD=	$(ONBLD_TOOLS)/bin/ctffindmod
177XREF=		$(ONBLD_TOOLS)/bin/xref
178FIND=		/usr/bin/find
179PERL=		/usr/bin/perl
180SORT=		/usr/bin/sort
181TOUCH=		/usr/bin/touch
182WC=		/usr/bin/wc
183XARGS=		/usr/bin/xargs
184ELFEDIT=	/usr/bin/elfedit
185ELFSIGN=	/usr/bin/elfsign
186DTRACE=		/usr/sbin/dtrace
187CHECK_FNAMES=	$(ONBLD_TOOLS)/bin/check_fnames
188
189# Due to 6367203, objects built with gcc will fail the namespace checks.
190# Remove this override once the compiler bug is fixed.
191$(__GNUC)CHECK_FNAMES=	$(TRUE)
192
193FILEMODE=	644
194DIRMODE=	755
195
196# Note: owner and group for proto area objects is no longer set by
197# Makefiles at all.  These have no real effect and are kept here for
198# transition purposes.  They (along with CH, CHOWN, and CHGRP) should be
199# removed early in the s11 development cycle.
200OWNER=		root
201GROUP=		bin
202
203#
204# The version of the patch makeup table optimized for build-time use.  Used
205# during patch builds only.
206$(PATCH_BUILD)PMTMO_FILE=$(SRC)/patch_makeup_table.mo
207
208# Declare that nothing should be built in parallel.
209# Individual Makefiles can use the .PARALLEL target to declare otherwise.
210.NO_PARALLEL:
211
212# For stylistic checks
213#
214# Note that the X and C checks are not used at this time and may need
215# modification when they are actually used.
216#
217CSTYLE=		cstyle
218CSTYLE_TAIL=
219HDRCHK=		hdrchk
220HDRCHK_TAIL=
221JSTYLE=		jstyle
222
223DOT_H_CHECK=	\
224	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
225	$(HDRCHK) $< $(HDRCHK_TAIL)
226
227DOT_X_CHECK=	\
228	@$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
229	$(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
230
231DOT_C_CHECK=	\
232	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
233
234MANIFEST_CHECK=	\
235	@$(ECHO) "checking $<"; \
236	SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
237	$(SRC)/cmd/svc/svccfg/svccfg-native validate $<
238
239INS.file=	$(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
240INS.dir=	$(INS) -s -d -m $(DIRMODE) $@
241# installs and renames at once
242#
243INS.rename=	$(INS.file); $(MV) $(@D)/$(<F) $@
244
245# install a link
246INSLINKTARGET=	$<
247INS.link=	$(RM) $@; $(LN) $(INSLINKTARGET) $@
248
249# MACH must be set in the shell environment per uname -p on the build host
250# More specific architecture variables should be set in lower makefiles.
251#
252# MACH64 is derived from MACH, and BUILD64 is set to `#' for
253# architectures on which we do not build 64-bit versions.
254# (There are no such architectures at the moment.)
255#
256# Set BUILD64=# in the environment to disable 64-bit amd64
257# builds on i386 machines.
258
259MACH64_1=	$(MACH:sparc=sparcv9)
260MACH64=		$(MACH64_1:i386=amd64)
261
262MACH32_1=	$(MACH:sparc=sparcv7)
263MACH32=		$(MACH32_1:i386=i86)
264
265sparc_BUILD64=
266i386_BUILD64=
267BUILD64=	$($(MACH)_BUILD64)
268
269#
270# C compiler mode. Future compilers may change the default on us,
271# so force extended ANSI mode globally. Lower level makefiles can
272# override this by setting CCMODE.
273#
274CCMODE=			-Xa
275CCMODE64=		-Xa
276
277#
278# C compiler verbose mode. This is so we can enable it globally,
279# but turn it off in the lower level makefiles of things we cannot
280# (or aren't going to) fix.
281#
282CCVERBOSE=		-v
283
284# set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings
285# from the compiler about places the -xarch=v9 may differ from -xarch=v9c.
286V9ABIWARN=
287
288# set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register
289# symbols (used to detect conflicts between objects that use global registers)
290# we disable this now for safety, and because genunix doesn't link with
291# this feature (the v9 default) enabled.
292#
293# REGSYM is separate since the C++ driver syntax is different.
294CCREGSYM=		-Wc,-Qiselect-regsym=0
295CCCREGSYM=		-Qoption cg -Qiselect-regsym=0
296
297# Prevent the removal of static symbols by the SPARC code generator (cg).
298# The x86 code generator (ube) does not remove such symbols and as such
299# using this workaround is not applicable for x86.
300#
301CCSTATICSYM=		-Wc,-Qassembler-ounrefsym=0
302#
303# generate 32-bit addresses in the v9 kernel. Saves memory.
304CCABS32=		-Wc,-xcode=abs32
305
306# One optimization the compiler might perform is to turn this:
307#	#pragma weak foo
308#	extern int foo;
309#	if (&foo)
310#		foo = 5;
311# into
312#	foo = 5;
313# Since we do some of this (foo might be referenced in common kernel code
314# but provided only for some cpu modules or platforms), we disable this
315# optimization.
316# 
317sparc_CCUNBOUND	= -Wd,-xsafe=unboundsym
318i386_CCUNBOUND	=
319CCUNBOUND	= $($(MACH)_CCUNBOUND)
320
321#
322# compiler '-xarch' flag. This is here to centralize it and make it
323# overridable for testing.
324sparc_XARCH=		-xarch=v8
325sparcv9_XARCH=		-xarch=v9
326i386_XARCH=
327amd64_XARCH=		-xarch=amd64 -Ui386 -U__i386
328
329# assembler '-xarch' flag.  Different from compiler '-xarch' flag.
330sparc_AS_XARCH=		-xarch=v8plus
331sparcv9_AS_XARCH=	-xarch=v9
332i386_AS_XARCH=
333amd64_AS_XARCH=		-xarch=amd64 -P -Ui386 -U__i386
334
335#
336# These flags define what we need to be 'standalone' i.e. -not- part
337# of the rather more cosy userland environment.  This basically means
338# the kernel.
339#
340# XX64	future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
341#
342sparc_STAND_FLAGS=	-_gcc=-ffreestanding
343sparcv9_STAND_FLAGS=	-_gcc=-ffreestanding
344i386_STAND_FLAGS=	-_gcc=-ffreestanding
345amd64_STAND_FLAGS=	-Wu,-xmodel=kernel
346$(__SSNEXT)amd64_STAND_FLAGS=	-xmodel=kernel
347
348SAVEARGS=		-Wu,-save_args
349amd64_STAND_FLAGS	+= $(SAVEARGS)
350
351STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
352STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
353
354#
355# disable the incremental linker
356ILDOFF=			-xildoff
357#
358XDEPEND=		-xdepend
359XFFLAG=			-xF=%all
360XESS=			-xs
361XSTRCONST=		-xstrconst 
362
363#
364# turn warnings into errors (C)
365CERRWARN = -errtags=yes -errwarn=%all
366CERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT
367CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
368
369#
370# turn warnings into errors (C++)
371CCERRWARN=		-xwe
372
373# C99 mode
374C99_ENABLE=	-xc99=%all
375C99_DISABLE=	-xc99=%none
376C99MODE=	$(C99_DISABLE)
377C99LMODE=	$(C99MODE:-xc99%=-Xc99%)
378
379# In most places, assignments to these macros should be appended with +=
380# (CPPFLAGS.master allows values to be prepended to CPPFLAGS).
381sparc_CFLAGS=	$(sparc_XARCH) $(CCSTATICSYM)
382sparcv9_CFLAGS=	$(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM) \
383		$(CCSTATICSYM)
384i386_CFLAGS=	$(i386_XARCH)
385amd64_CFLAGS=	$(amd64_XARCH)
386
387sparc_ASFLAGS=	$(sparc_AS_XARCH)
388sparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
389i386_ASFLAGS=	$(i386_AS_XARCH)
390amd64_ASFLAGS=	$(amd64_AS_XARCH)
391
392#
393sparc_COPTFLAG=		-xO3
394sparcv9_COPTFLAG=	-xO3
395i386_COPTFLAG=		-O
396amd64_COPTFLAG=		-xO3
397
398COPTFLAG= $($(MACH)_COPTFLAG)
399COPTFLAG64= $($(MACH64)_COPTFLAG)
400
401# When -g is used, the compiler globalizes static objects
402# (gives them a unique prefix). Disable that.
403CNOGLOBAL= -W0,-noglobal
404
405# Direct the Sun Studio compiler to use a static globalization prefix based on the
406# name of the module rather than something unique. Otherwise, objects
407# will not build deterministically, as subsequent compilations of identical
408# source will yeild objects that always look different.
409#
410# In the same spirit, this will also remove the date from the N_OPT stab.
411CGLOBALSTATIC= -W0,-xglobalstatic
412
413# Normally, gcc uses indirect DWARF strings to save space.  However,
414# this causes relocations that ctfconvert cannot handle.  Disable this.
415CDWARFSTR=	-_gcc=-fno-dwarf2-indirect-strings
416
417# Sometimes we want all symbols and types in debugging information even
418# if they aren't used.
419CALLSYMS=	-W0,-xdbggen=no%usedonly
420
421#
422# Default debug format for Sun Studio 11 is dwarf, so force it to
423# generate stabs.
424#
425DEBUGFORMAT=	-xdebugformat=stabs
426
427#
428# Flags used to build in debug mode for ctf generation.  Bugs in the Devpro
429# compilers currently prevent us from building with cc-emitted DWARF.
430#
431CTF_FLAGS_sparc	= -g -Wc,-Qiselect-T1 $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
432CTF_FLAGS_i386	= -g $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
433CTF_FLAGS	= $(CTF_FLAGS_$(MACH)) $(DEBUGFORMAT)
434
435#
436# Flags used with genoffsets
437#
438GOFLAGS = -_noecho \
439	$(CALLSYMS) \
440	$(CDWARFSTR)
441
442OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
443	$(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
444
445OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
446	$(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
447
448#
449# tradeoff time for space (smaller is better)
450#
451sparc_SPACEFLAG		= -xspace -W0,-Lt
452sparcv9_SPACEFLAG	= -xspace -W0,-Lt
453i386_SPACEFLAG		= -xspace
454amd64_SPACEFLAG		=
455
456SPACEFLAG		= $($(MACH)_SPACEFLAG)
457SPACEFLAG64		= $($(MACH64)_SPACEFLAG)
458
459#
460# The Sun Studio 11 compiler has changed the behaviour of integer
461# wrap arounds and so a flag is needed to use the legacy behaviour
462# (without this flag panics/hangs could be exposed within the source).
463#
464sparc_IROPTFLAG		= -W2,-xwrap_int
465sparcv9_IROPTFLAG	= -W2,-xwrap_int
466i386_IROPTFLAG		=
467amd64_IROPTFLAG		=
468
469IROPTFLAG		= $($(MACH)_IROPTFLAG)
470IROPTFLAG64		= $($(MACH64)_IROPTFLAG)
471
472sparc_XREGSFLAG		= -xregs=no%appl
473sparcv9_XREGSFLAG	= -xregs=no%appl
474i386_XREGSFLAG		=
475amd64_XREGSFLAG		=
476
477XREGSFLAG		= $($(MACH)_XREGSFLAG)
478XREGSFLAG64		= $($(MACH64)_XREGSFLAG)
479
480CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
481		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \
482		$(CGLOBALSTATIC)
483CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
484		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \
485		$(CGLOBALSTATIC)
486#
487# Flags that are used to build parts of the code that are subsequently
488# run on the build machine (also known as the NATIVE_BUILD).
489#
490NATIVE_CFLAGS=	$(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
491		$(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \
492		$(IROPTFLAG) $(CGLOBALSTATIC)
493
494DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"	# For messaging.
495DTS_ERRNO=-D_TS_ERRNO
496CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
497	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
498CPPFLAGS=	$(CPPFLAGS.master)
499AS_CPPFLAGS=	$(CPPFLAGS.master)
500JAVAFLAGS=	-deprecation
501
502#
503# For source message catalogue
504#
505.SUFFIXES: $(SUFFIXES) .i .po
506MSGROOT= $(ROOT)/catalog
507MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
508MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
509DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN) 
510DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
511
512CLOBBERFILES += $(POFILE) $(POFILES)
513COMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
514XGETTEXT= /usr/bin/xgettext
515XGETFLAGS= -c TRANSLATION_NOTE
516BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
517	$(RM)	$@ ;\
518	$(SED) "/^domain/d" < $(<F).po > $@ ;\
519	$(RM) $(<F).po $<.i
520
521#
522# This is overwritten by local Makefile when PROG is a list.
523#
524POFILE= $(PROG).po
525
526sparc_CCFLAGS=		-cg92 -compat=4 \
527			-Qoption ccfe -messages=no%anachronism \
528			$(CCERRWARN)
529sparcv9_CCFLAGS=	$(sparcv9_XARCH) -dalign -compat=5 \
530			-Qoption ccfe -messages=no%anachronism \
531			-Qoption ccfe -features=no%conststrings \
532			$(CCCREGSYM) \
533			$(CCERRWARN)
534i386_CCFLAGS=		-compat=4 \
535			-Qoption ccfe -messages=no%anachronism \
536			-Qoption ccfe -features=no%conststrings \
537			$(CCERRWARN)
538amd64_CCFLAGS=		$(amd64_XARCH) -compat=5 \
539			-Qoption ccfe -messages=no%anachronism \
540			-Qoption ccfe -features=no%conststrings \
541			$(CCERRWARN)
542
543sparc_CCOPTFLAG=	-O
544sparcv9_CCOPTFLAG=	-O
545i386_CCOPTFLAG=		-O
546amd64_CCOPTFLAG=	-O
547
548CCOPTFLAG=	$($(MACH)_CCOPTFLAG)
549CCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
550CCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS)
551CCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS)
552
553#
554# Various mapfiles that are used throughout the build, and delivered to
555# /usr/lib/ld.
556#
557MAPFILE.NED_i386 =	$(SRC)/common/mapfiles/i386/map.noexdata
558MAPFILE.NED_sparc =
559MAPFILE.NED =		$(MAPFILE.NED_$(MACH))
560MAPFILE.PGA =		$(SRC)/common/mapfiles/$(MACH)/map.pagealign
561MAPFILE.NES =		$(SRC)/common/mapfiles/common/map.noexstk
562MAPFILE.FLT =		$(SRC)/common/mapfiles/common/map.filter
563MAPFILE.LEX =		$(SRC)/common/mapfiles/common/map.lex.yy
564
565#
566# Generated mapfiles that are compiler specific, and used throughout the
567# build.  These mapfiles are not delivered in /usr/lib/ld.
568#
569MAPFILE.NGB_sparc=	$(SRC)/common/mapfiles/gen/sparc_cc_map.noexeglobs
570$(__GNUC64)MAPFILE.NGB_sparc= \
571			$(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
572MAPFILE.NGB_sparcv9=	$(SRC)/common/mapfiles/gen/sparcv9_cc_map.noexeglobs
573$(__GNUC64)MAPFILE.NGB_sparcv9= \
574			$(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
575MAPFILE.NGB_i386=	$(SRC)/common/mapfiles/gen/i386_cc_map.noexeglobs
576$(__GNUC64)MAPFILE.NGB_i386= \
577			$(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
578MAPFILE.NGB_amd64=	$(SRC)/common/mapfiles/gen/amd64_cc_map.noexeglobs
579$(__GNUC64)MAPFILE.NGB_amd64= \
580			$(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
581MAPFILE.NGB =		$(MAPFILE.NGB_$(MACH))
582
583#
584# A generic interface mapfile name, used by various dynamic objects to define
585# the interfaces and interposers the object must export.
586#
587MAPFILE.INT =		mapfile-intf
588
589# 
590# LDLIBS32 can be set in the environment to override the following assignment.
591# LDLIBS64 can be set to override the assignment made in Makefile.master.64.
592# These environment settings make sure that no libraries are searched outside
593# of the local workspace proto area:
594#	LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
595#	LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
596#
597LDLIBS32 =	$(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
598LDLIBS.cmd = 	$(LDLIBS32)
599LDLIBS.lib =	$(LDLIBS32)
600#
601# Define compilation macros.
602#
603COMPILE.c=	$(CC) $(CFLAGS) $(CPPFLAGS) -c
604COMPILE64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) -c
605COMPILE.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
606COMPILE64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
607COMPILE.s=	$(AS) $(ASFLAGS) $(AS_CPPFLAGS)
608COMPILE64.s=	$(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
609COMPILE.d=	$(DTRACE) -G -32
610COMPILE64.d=	$(DTRACE) -G -64
611
612CLASSPATH=	.
613COMPILE.java=	$(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
614
615#
616# Link time macros
617#
618CCNEEDED		= -lC
619$(__GNUC)CCNEEDED	= -L$(SFWLIBDIR) -R$(SFWLIBDIR) -lstdc++ -lgcc_s
620
621LINK.c=		$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
622LINK64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
623NORUNPATH=	-norunpath -nolib
624LINK.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
625		$(LDFLAGS) $(CCNEEDED)
626LINK64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
627		$(LDFLAGS) $(CCNEEDED)
628
629#
630# lint macros
631#
632# Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once
633# ON is built with a version of lint that has the fix for 4484186.
634#
635ALWAYS_LINT_DEFS =	-errtags=yes -s
636ALWAYS_LINT_DEFS +=	-erroff=E_PTRDIFF_OVERFLOW
637ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_NARROW_CONV
638ALWAYS_LINT_DEFS +=	-U__PRAGMA_REDEFINE_EXTNAME
639ALWAYS_LINT_DEFS +=	$(C99LMODE)
640ALWAYS_LINT_DEFS +=	-errsecurity=$(SECLEVEL)
641ALWAYS_LINT_DEFS +=	-erroff=E_SEC_CREAT_WITHOUT_EXCL
642ALWAYS_LINT_DEFS +=	-erroff=E_SEC_FORBIDDEN_WARN_CREAT
643# XX64 -- really only needed for amd64 lint
644ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_INT_TO_SMALL_INT
645ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_CONST_TO_SMALL_INT
646ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_TO_SMALL_INT
647ALWAYS_LINT_DEFS +=	-erroff=E_CAST_TO_PTR_FROM_INT
648ALWAYS_LINT_DEFS +=	-erroff=E_COMP_INT_WITH_LARGE_INT
649ALWAYS_LINT_DEFS +=	-erroff=E_INTEGRAL_CONST_EXP_EXPECTED
650ALWAYS_LINT_DEFS +=	-erroff=E_PASS_INT_TO_SMALL_INT
651ALWAYS_LINT_DEFS +=	-erroff=E_PTR_CONV_LOSES_BITS
652
653SECLEVEL=	core
654LINT.c=		$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(ALWAYS_LINT_DEFS)
655LINT64.c=	$(LINT) $(LINTFLAGS64) $(CPPFLAGS) $(ALWAYS_LINT_DEFS)
656LINT.s=		$(LINT.c)
657
658# For some future builds, NATIVE_MACH and MACH might be different.
659# Therefore, NATIVE_MACH needs to be redefined in the
660# environment as `uname -p` to override this macro.
661#
662# For now at least, we cross-compile amd64 on i386 machines.
663NATIVE_MACH=	$(MACH:amd64=i386)
664
665# Define native compilation macros
666#
667
668# Base directory where compilers are loaded.
669# Defined here so it can be overridden by developer.
670#
671SPRO_ROOT=		$(BUILD_TOOLS)/SUNWspro
672SPRO_VROOT=		$(SPRO_ROOT)/SS11
673GNU_ROOT=		$(SFW_ROOT)
674
675# Specify platform compiler versions for languages
676# that we use (currently only c and c++).
677#
678sparc_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
679$(__GNUC)sparc_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
680sparc_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
681$(__GNUC)sparc_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
682sparc_CPP=		/usr/ccs/lib/cpp
683sparc_AS=		/usr/ccs/bin/as -xregsym=no
684sparc_LD=		/usr/ccs/bin/ld
685sparc_LINT=		$(SPRO_VROOT)/bin/lint
686
687sparcv9_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
688$(__GNUC64)sparcv9_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
689sparcv9_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
690$(__GNUC64)sparcv9_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
691sparcv9_CPP=		/usr/ccs/lib/cpp
692sparcv9_AS=		/usr/ccs/bin/as -xregsym=no
693sparcv9_LD=		/usr/ccs/bin/ld
694sparcv9_LINT=		$(SPRO_VROOT)/bin/lint
695
696# We compile 32-bit objects with cc by default
697i386_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
698$(__GNUC)i386_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
699i386_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
700$(__GNUC)i386_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
701i386_CPP=		/usr/ccs/lib/cpp
702i386_AS=		/usr/ccs/bin/as
703$(__GNUC)i386_AS=	$(ONBLD_TOOLS)/bin/$(MACH)/aw
704i386_LD=		/usr/ccs/bin/ld
705i386_LINT=		$(SPRO_VROOT)/bin/lint
706
707# We compile 64-bit objects with gcc
708amd64_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
709$(__GNUC64)amd64_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
710amd64_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
711$(__GNUC64)amd64_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
712amd64_CPP=		/usr/ccs/lib/cpp
713amd64_AS=		$(ONBLD_TOOLS)/bin/$(MACH)/aw
714amd64_LD=		/usr/ccs/bin/ld
715amd64_LINT=		$(SPRO_VROOT)/bin/lint
716
717NATIVECC=		$($(NATIVE_MACH)_CC)
718NATIVECCC=		$($(NATIVE_MACH)_CCC)
719NATIVECPP=		$($(NATIVE_MACH)_CPP)
720NATIVEAS=		$($(NATIVE_MACH)_AS)
721NATIVELD=		$($(NATIVE_MACH)_LD)
722NATIVELINT=		$($(NATIVE_MACH)_LINT)
723
724#
725# Makefile.master.64 overrides these settings
726#
727CC=			$(NATIVECC)
728CCC=			$(NATIVECCC)
729CPP=			$(NATIVECPP)
730AS=			$(NATIVEAS)
731LD=			$(NATIVELD)
732LINT=			$(NATIVELINT)
733
734# The real compilers used for this build
735CW_CC_CMD=		$(CC) -_compiler
736CW_CCC_CMD=		$(CCC) -_compiler
737REAL_CC=		$(CW_CC_CMD:sh)
738REAL_CCC=		$(CW_CCC_CMD:sh)
739
740# Pass -Y flag to cpp (method of which is release-dependent)
741CCYFLAG=		-Y I,
742
743BDIRECT=	-Bdirect
744BDYNAMIC=	-Bdynamic
745BLOCAL=		-Blocal
746BNODIRECT=	-Bnodirect
747BREDUCE=	-Breduce
748BSTATIC=	-Bstatic
749
750ZCOMBRELOC=	-zcombreloc
751ZDEFS=		-zdefs
752ZDIRECT=	-zdirect
753ZIGNORE=	-zignore
754ZINITFIRST=	-zinitfirst
755ZINTERPOSE=	-zinterpose
756ZLAZYLOAD=	-zlazyload
757ZLOADFLTR=	-zloadfltr
758ZMULDEFS=	-zmuldefs
759ZNODEFAULTLIB=	-znodefaultlib
760ZNODEFS=	-znodefs
761ZNODELETE=	-znodelete
762ZNODLOPEN=	-znodlopen
763ZNODUMP=	-znodump
764ZNOLAZYLOAD=	-znolazyload
765ZNORELOC=	-znoreloc
766ZNOVERSION=	-znoversion
767ZRECORD=	-zrecord
768ZREDLOCSYM=	-zredlocsym
769ZTEXT=		-ztext
770ZVERBOSE=	-zverbose
771
772GSHARED=	-G
773CCMT=		-mt
774
775# Handle different PIC models on different ISAs
776# (May be overridden by lower-level Makefiles)
777
778sparc_C_PICFLAGS =	-K pic
779sparcv9_C_PICFLAGS =	-K pic
780i386_C_PICFLAGS =	-K pic
781amd64_C_PICFLAGS =	-K pic
782C_PICFLAGS =		$($(MACH)_C_PICFLAGS)
783C_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
784
785sparc_C_BIGPICFLAGS =	-K PIC
786sparcv9_C_BIGPICFLAGS =	-K PIC
787i386_C_BIGPICFLAGS =	-K PIC
788amd64_C_BIGPICFLAGS =	-K PIC
789C_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
790C_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
791
792# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
793sparc_CC_PICFLAGS =	-Kpic
794sparcv9_CC_PICFLAGS =	-KPIC
795i386_CC_PICFLAGS = 	-Kpic
796amd64_CC_PICFLAGS = 	-Kpic
797CC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
798CC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
799
800AS_PICFLAGS=		$(C_PICFLAGS)
801AS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
802
803#
804# Default label for CTF sections
805#
806CTFCVTFLAGS=		-i -L VERSION
807
808#
809# Override to pass module-specific flags to ctfmerge.  Currently used
810# only by krtld to turn on fuzzy matching.
811#
812CTFMRGFLAGS=
813
814CTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
815
816ELFSIGN_O=	$(TRUE)
817ELFSIGN_CRYPTO=	$(ELFSIGN_O)
818ELFSIGN_OBJECT=	$(ELFSIGN_O)
819ELFSIGN_CRYPTO_LIMITED=	$(ELFSIGN_O)
820$(EXPORT_RELEASE_BUILD)ELFSIGN_O =	$(ELFSIGN)
821$(EXPORT_RELEASE_BUILD)ELFSIGN_CFNAME =	SUNWosnetCF
822$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY =	\
823			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CFNAME)
824$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT=	\
825			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CFNAME)
826$(EXPORT_RELEASE_BUILD)ELFSIGN_CLNAME =	SUNWosnetCFLimited
827$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY_LIMITED =	\
828			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CLNAME)
829$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT_LIMITED=	\
830			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CLNAME)
831$(EXPORT_RELEASE_BUILD)ELFSIGN_SENAME =	SUNWosnetSE
832$(EXPORT_RELEASE_BUILD)ELFSIGN_SEKEY =	\
833			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_SENAME)
834$(EXPORT_RELEASE_BUILD)ELFSIGN_SECERT=	\
835			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_SENAME)
836$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO=	$(ELFSIGN_O) sign \
837			$(ELFSIGN_FORMAT_OPTION) \
838			-k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@
839$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO_LIMITED=	$(ELFSIGN_O) sign \
840			$(ELFSIGN_FORMAT_OPTION) \
841			-k $(ELFSIGN_KEY_LIMITED) -c $(ELFSIGN_CERT_LIMITED) \
842			-e $@
843$(EXPORT_RELEASE_BUILD)ELFSIGN_OBJECT=	$(ELFSIGN_O) sign \
844			$(ELFSIGN_FORMAT_OPTION) \
845			-k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@
846
847# Rules (normally from make.rules) and macros which are used for post
848# processing files. Normally, these do stripping of the comment section
849# automatically.
850#    RELEASE_CM:	Should be editted to reflect the release.
851#    POST_PROCESS_O:	Post-processing for `.o' files.
852#    POST_PROCESS_A:	Post-processing for `.a' files (currently null).
853#    POST_PROCESS_SO:	Post-processing for `.so' files.
854#    POST_PROCESS:	Post-processing for executable files (no suffix).
855# Note that these macros are not completely generalized as they are to be
856# used with the file name to be processed following.
857#
858# It is left as an exercise to Release Engineering to embellish the generation
859# of the release comment string.
860#
861#	If this is a standard development build:
862#		compress the comment section (mcs -c)
863#		add the standard comment (mcs -a $(RELEASE_CM))
864#		add the development specific comment (mcs -a $(DEV_CM))
865#
866#	If this is an installation build:
867#		delete the comment section (mcs -d)
868#		add the standard comment (mcs -a $(RELEASE_CM))
869#		add the development specific comment (mcs -a $(DEV_CM))
870#
871#	If this is an release build:
872#		delete the comment section (mcs -d)
873#		add the standard comment (mcs -a $(RELEASE_CM))
874#
875#	The ONVERS macro sets the default value for the VERSION string
876#	within pkginfo.
877#
878# The following list of macros are used in the definition of RELEASE_CM
879# which is used to label all binaries in the build:
880#
881# 	RELEASE		Specific release of the build, eg: 5.2
882#	RELEASE_MAJOR	Major version number part of $(RELEASE)
883#	RELEASE_MINOR	Minor version number part of $(RELEASE)
884#	VERSION		Version of the build (alpha, beta, Generic)
885#	PATCHID		If this is a patch this value should contain
886#			the patchid value (eg: "Generic 100832-01"), otherwise
887#			it will be set to $(VERSION)
888#	RELEASE_DATE	Date of the Release Build
889#	PATCH_DATE	Date the patch was created, if this is blank it
890#			will default to the RELEASE_DATE
891#
892ONVERS=		"11.11"
893RELEASE_MAJOR=	5
894RELEASE_MINOR=	11
895RELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
896VERSION=	SunOS Development
897PATCHID=	$(VERSION)
898RELEASE_DATE=	October 2007
899PATCH_DATE=	$(RELEASE_DATE)
900RELEASE_CM=	"@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
901DEV_CM=		"@($(POUND_SIGN))SunOS Internal Development: \
902`$(ECHO) $$LOGNAME` `date +%Y-%m-%d` `$(ECHO) [\`basename $$CODEMGR_WS\`]`"
903
904PROCESS_COMMENT=		   @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
905$(STRIP_COMMENTS)PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
906$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
907
908STRIP_STABS=			   :
909$(RELEASE_BUILD)STRIP_STABS=	   $(STRIP) -x $@
910
911POST_PROCESS_O=		$(PROCESS_COMMENT) $@
912POST_PROCESS_A=
913POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
914			$(ELFSIGN_OBJECT)
915POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
916			$(ELFSIGN_OBJECT)
917
918#
919# The PKGDEFS macro points to the source directory containing the majority
920# of ON's package definitions plus Makefiles with general package creation
921# rules.
922#
923# PKGARCHIVE specifies the default location where packages should be
924# placed if built.
925#
926PKGDEFS=$(SRC)/pkgdefs
927$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
928PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
929
930#	Default build rules which perform comment section post-processing.
931#
932.c:
933	$(LINK.c) -o $@ $< $(LDLIBS)
934	$(POST_PROCESS)
935.c.o:
936	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
937	$(POST_PROCESS_O)
938.c.a:
939	$(COMPILE.c) -o $% $<
940	$(PROCESS_COMMENT) $%
941	$(AR) $(ARFLAGS) $@ $%
942	$(RM) $%
943.s.o:
944	$(COMPILE.s) -o $@ $<
945	$(POST_PROCESS_O)
946.s.a:
947	$(COMPILE.s) -o $% $<
948	$(PROCESS_COMMENT) $%
949	$(AR) $(ARFLAGS) $@ $%
950	$(RM) $%
951.cc:
952	$(LINK.cc) -o $@ $< $(LDLIBS)
953	$(POST_PROCESS)
954.cc.o:
955	$(COMPILE.cc) $(OUTPUT_OPTION) $<
956	$(POST_PROCESS_O)
957.cc.a:
958	$(COMPILE.cc) -o $% $<
959	$(AR) $(ARFLAGS) $@ $%
960	$(PROCESS_COMMENT) $%
961	$(RM) $%
962.y:
963	$(YACC.y) $<
964	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
965	$(POST_PROCESS)
966	$(RM) y.tab.c
967.y.o:
968	$(YACC.y) $<
969	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
970	$(POST_PROCESS_O)
971	$(RM) y.tab.c
972.l:
973	$(RM) $*.c
974	$(LEX.l) $< > $*.c
975	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
976	$(POST_PROCESS)
977	$(RM) $*.c
978.l.o:
979	$(RM) $*.c
980	$(LEX.l) $< > $*.c
981	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
982	$(POST_PROCESS_O)
983	$(RM) $*.c
984
985.java.class:
986	$(COMPILE.java) $<
987
988# Bourne and Korn shell script message catalog build rules.
989# We extract all gettext strings with sed(1) (being careful to permit
990# multiple gettext strings on the same line), weed out the dups, and
991# build the catalogue with awk(1).
992
993.sh.po .ksh.po:
994	$(SED) -n -e ":a" 				\
995		  -e "h" 					\
996		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
997		  -e "x"					\
998		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
999		  -e "t a"					\
1000	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1001
1002#
1003# Python and Perl executable and message catalog build rules.
1004# Note that Python i18n isn't supported by this rule set yet,
1005# as it requires a special build tool (pygettext.py).
1006#
1007.SUFFIXES: .pl .pm .py
1008
1009.pl:
1010	$(RM) $@;
1011	$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
1012	$(CHMOD) +x $@
1013
1014.py:
1015	$(RM) $@; $(CAT) $< > $@; $(CHMOD) +x $@
1016
1017.pl.po .pm.po:
1018	$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
1019	$(RM)	$@ ;
1020	$(SED) "/^domain/d" < $(<F).po > $@ ;
1021	$(RM) $(<F).po
1022
1023#
1024# When using xgettext, we want messages to go to the default domain,
1025# rather than the specified one.  This special version of the
1026# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1027# causing xgettext to put all messages into the default domain.
1028#
1029CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1030
1031.c.i:
1032	$(CPPFORPO) $< > $@
1033
1034.h.i:
1035	$(CPPFORPO) $< > $@
1036
1037.y.i:
1038	$(YACC) -d $<
1039	$(CPPFORPO) y.tab.c  > $@
1040	$(RM) y.tab.c 
1041
1042.l.i:
1043	$(LEX) $<
1044	$(CPPFORPO) lex.yy.c  > $@
1045	$(RM) lex.yy.c
1046
1047.c.po:
1048	$(CPPFORPO) $< > $<.i
1049	$(BUILD.po)
1050
1051.y.po:
1052	$(YACC) -d $<
1053	$(CPPFORPO) y.tab.c  > $<.i
1054	$(BUILD.po)
1055	$(RM) y.tab.c 
1056
1057.l.po:
1058	$(LEX) $<
1059	$(CPPFORPO) lex.yy.c  > $<.i
1060	$(BUILD.po)
1061	$(RM) lex.yy.c
1062
1063#
1064# Rules to perform stylistic checks
1065#
1066.SUFFIXES: .x .xml .check .xmlchk
1067
1068.h.check:
1069	$(DOT_H_CHECK)
1070
1071.x.check:
1072	$(DOT_X_CHECK)
1073
1074.xml.xmlchk:
1075	$(MANIFEST_CHECK)
1076
1077#
1078# Rules to process ONC+ Source partial files
1079#
1080%_onc_plus:	%
1081	@$(ECHO) "extracting code from $< ... "
1082	sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $<  > $@
1083
1084#
1085# Include rules to render automated sccs get rules "safe".
1086# 
1087include $(SRC)/Makefile.noget
1088