xref: /titanic_51/usr/src/Makefile.master (revision c7158ae983f5a04c4a998f468ecefba6d23ba721)
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
750ZDEFS=		-zdefs
751ZDIRECT=	-zdirect
752ZIGNORE=	-zignore
753ZINITFIRST=	-zinitfirst
754ZINTERPOSE=	-zinterpose
755ZLAZYLOAD=	-zlazyload
756ZLOADFLTR=	-zloadfltr
757ZMULDEFS=	-zmuldefs
758ZNODEFAULTLIB=	-znodefaultlib
759ZNODEFS=	-znodefs
760ZNODELETE=	-znodelete
761ZNODLOPEN=	-znodlopen
762ZNODUMP=	-znodump
763ZNOLAZYLOAD=	-znolazyload
764ZNORELOC=	-znoreloc
765ZNOVERSION=	-znoversion
766ZRECORD=	-zrecord
767ZREDLOCSYM=	-zredlocsym
768ZTEXT=		-ztext
769ZVERBOSE=	-zverbose
770
771GSHARED=	-G
772CCMT=		-mt
773
774# Handle different PIC models on different ISAs
775# (May be overridden by lower-level Makefiles)
776
777sparc_C_PICFLAGS =	-K pic
778sparcv9_C_PICFLAGS =	-K pic
779i386_C_PICFLAGS =	-K pic
780amd64_C_PICFLAGS =	-K pic
781C_PICFLAGS =		$($(MACH)_C_PICFLAGS)
782C_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
783
784sparc_C_BIGPICFLAGS =	-K PIC
785sparcv9_C_BIGPICFLAGS =	-K PIC
786i386_C_BIGPICFLAGS =	-K PIC
787amd64_C_BIGPICFLAGS =	-K PIC
788C_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
789C_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
790
791# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
792sparc_CC_PICFLAGS =	-Kpic
793sparcv9_CC_PICFLAGS =	-KPIC
794i386_CC_PICFLAGS = 	-Kpic
795amd64_CC_PICFLAGS = 	-Kpic
796CC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
797CC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
798
799AS_PICFLAGS=		$(C_PICFLAGS)
800AS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
801
802#
803# Default label for CTF sections
804#
805CTFCVTFLAGS=		-i -L VERSION
806
807#
808# Override to pass module-specific flags to ctfmerge.  Currently used
809# only by krtld to turn on fuzzy matching.
810#
811CTFMRGFLAGS=
812
813CTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
814
815ELFSIGN_O=	$(TRUE)
816ELFSIGN_CRYPTO=	$(ELFSIGN_O)
817ELFSIGN_OBJECT=	$(ELFSIGN_O)
818ELFSIGN_CRYPTO_LIMITED=	$(ELFSIGN_O)
819$(EXPORT_RELEASE_BUILD)ELFSIGN_O =	$(ELFSIGN)
820$(EXPORT_RELEASE_BUILD)ELFSIGN_CFNAME =	SUNWosnetCF
821$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY =	\
822			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CFNAME)
823$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT=	\
824			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CFNAME)
825$(EXPORT_RELEASE_BUILD)ELFSIGN_CLNAME =	SUNWosnetCFLimited
826$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY_LIMITED =	\
827			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CLNAME)
828$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT_LIMITED=	\
829			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CLNAME)
830$(EXPORT_RELEASE_BUILD)ELFSIGN_SENAME =	SUNWosnetSE
831$(EXPORT_RELEASE_BUILD)ELFSIGN_SEKEY =	\
832			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_SENAME)
833$(EXPORT_RELEASE_BUILD)ELFSIGN_SECERT=	\
834			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_SENAME)
835$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO=	$(ELFSIGN_O) sign \
836			$(ELFSIGN_FORMAT_OPTION) \
837			-k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@
838$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO_LIMITED=	$(ELFSIGN_O) sign \
839			$(ELFSIGN_FORMAT_OPTION) \
840			-k $(ELFSIGN_KEY_LIMITED) -c $(ELFSIGN_CERT_LIMITED) \
841			-e $@
842$(EXPORT_RELEASE_BUILD)ELFSIGN_OBJECT=	$(ELFSIGN_O) sign \
843			$(ELFSIGN_FORMAT_OPTION) \
844			-k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@
845
846# Rules (normally from make.rules) and macros which are used for post
847# processing files. Normally, these do stripping of the comment section
848# automatically.
849#    RELEASE_CM:	Should be editted to reflect the release.
850#    POST_PROCESS_O:	Post-processing for `.o' files.
851#    POST_PROCESS_A:	Post-processing for `.a' files (currently null).
852#    POST_PROCESS_SO:	Post-processing for `.so' files.
853#    POST_PROCESS:	Post-processing for executable files (no suffix).
854# Note that these macros are not completely generalized as they are to be
855# used with the file name to be processed following.
856#
857# It is left as an exercise to Release Engineering to embellish the generation
858# of the release comment string.
859#
860#	If this is a standard development build:
861#		compress the comment section (mcs -c)
862#		add the standard comment (mcs -a $(RELEASE_CM))
863#		add the development specific comment (mcs -a $(DEV_CM))
864#
865#	If this is an installation build:
866#		delete the comment section (mcs -d)
867#		add the standard comment (mcs -a $(RELEASE_CM))
868#		add the development specific comment (mcs -a $(DEV_CM))
869#
870#	If this is an release build:
871#		delete the comment section (mcs -d)
872#		add the standard comment (mcs -a $(RELEASE_CM))
873#
874#	The ONVERS macro sets the default value for the VERSION string
875#	within pkginfo.
876#
877# The following list of macros are used in the definition of RELEASE_CM
878# which is used to label all binaries in the build:
879#
880# 	RELEASE		Specific release of the build, eg: 5.2
881#	RELEASE_MAJOR	Major version number part of $(RELEASE)
882#	RELEASE_MINOR	Minor version number part of $(RELEASE)
883#	VERSION		Version of the build (alpha, beta, Generic)
884#	PATCHID		If this is a patch this value should contain
885#			the patchid value (eg: "Generic 100832-01"), otherwise
886#			it will be set to $(VERSION)
887#	RELEASE_DATE	Date of the Release Build
888#	PATCH_DATE	Date the patch was created, if this is blank it
889#			will default to the RELEASE_DATE
890#
891ONVERS=		"11.11"
892RELEASE_MAJOR=	5
893RELEASE_MINOR=	11
894RELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
895VERSION=	SunOS Development
896PATCHID=	$(VERSION)
897RELEASE_DATE=	October 2007
898PATCH_DATE=	$(RELEASE_DATE)
899RELEASE_CM=	"@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
900DEV_CM=		"@($(POUND_SIGN))SunOS Internal Development: \
901`$(ECHO) $$LOGNAME` `date +%Y-%m-%d` `$(ECHO) [\`basename $$CODEMGR_WS\`]`"
902
903PROCESS_COMMENT=		   @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
904$(STRIP_COMMENTS)PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
905$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
906
907STRIP_STABS=			   :
908$(RELEASE_BUILD)STRIP_STABS=	   $(STRIP) -x $@
909
910POST_PROCESS_O=		$(PROCESS_COMMENT) $@
911POST_PROCESS_A=
912POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
913			$(ELFSIGN_OBJECT)
914POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
915			$(ELFSIGN_OBJECT)
916
917#
918# The PKGDEFS macro points to the source directory containing the majority
919# of ON's package definitions plus Makefiles with general package creation
920# rules.
921#
922# PKGARCHIVE specifies the default location where packages should be
923# placed if built.
924#
925PKGDEFS=$(SRC)/pkgdefs
926$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
927PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
928
929#	Default build rules which perform comment section post-processing.
930#
931.c:
932	$(LINK.c) -o $@ $< $(LDLIBS)
933	$(POST_PROCESS)
934.c.o:
935	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
936	$(POST_PROCESS_O)
937.c.a:
938	$(COMPILE.c) -o $% $<
939	$(PROCESS_COMMENT) $%
940	$(AR) $(ARFLAGS) $@ $%
941	$(RM) $%
942.s.o:
943	$(COMPILE.s) -o $@ $<
944	$(POST_PROCESS_O)
945.s.a:
946	$(COMPILE.s) -o $% $<
947	$(PROCESS_COMMENT) $%
948	$(AR) $(ARFLAGS) $@ $%
949	$(RM) $%
950.cc:
951	$(LINK.cc) -o $@ $< $(LDLIBS)
952	$(POST_PROCESS)
953.cc.o:
954	$(COMPILE.cc) $(OUTPUT_OPTION) $<
955	$(POST_PROCESS_O)
956.cc.a:
957	$(COMPILE.cc) -o $% $<
958	$(AR) $(ARFLAGS) $@ $%
959	$(PROCESS_COMMENT) $%
960	$(RM) $%
961.y:
962	$(YACC.y) $<
963	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
964	$(POST_PROCESS)
965	$(RM) y.tab.c
966.y.o:
967	$(YACC.y) $<
968	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
969	$(POST_PROCESS_O)
970	$(RM) y.tab.c
971.l:
972	$(RM) $*.c
973	$(LEX.l) $< > $*.c
974	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
975	$(POST_PROCESS)
976	$(RM) $*.c
977.l.o:
978	$(RM) $*.c
979	$(LEX.l) $< > $*.c
980	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
981	$(POST_PROCESS_O)
982	$(RM) $*.c
983
984.java.class:
985	$(COMPILE.java) $<
986
987# Bourne and Korn shell script message catalog build rules.
988# We extract all gettext strings with sed(1) (being careful to permit
989# multiple gettext strings on the same line), weed out the dups, and
990# build the catalogue with awk(1).
991
992.sh.po .ksh.po:
993	$(SED) -n -e ":a" 				\
994		  -e "h" 					\
995		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
996		  -e "x"					\
997		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
998		  -e "t a"					\
999	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1000
1001#
1002# Python and Perl executable and message catalog build rules.
1003# Note that Python i18n isn't supported by this rule set yet,
1004# as it requires a special build tool (pygettext.py).
1005#
1006.SUFFIXES: .pl .pm .py
1007
1008.pl:
1009	$(RM) $@;
1010	$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
1011	$(CHMOD) +x $@
1012
1013.py:
1014	$(RM) $@; $(CAT) $< > $@; $(CHMOD) +x $@
1015
1016.pl.po .pm.po:
1017	$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
1018	$(RM)	$@ ;
1019	$(SED) "/^domain/d" < $(<F).po > $@ ;
1020	$(RM) $(<F).po
1021
1022#
1023# When using xgettext, we want messages to go to the default domain,
1024# rather than the specified one.  This special version of the
1025# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1026# causing xgettext to put all messages into the default domain.
1027#
1028CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1029
1030.c.i:
1031	$(CPPFORPO) $< > $@
1032
1033.h.i:
1034	$(CPPFORPO) $< > $@
1035
1036.y.i:
1037	$(YACC) -d $<
1038	$(CPPFORPO) y.tab.c  > $@
1039	$(RM) y.tab.c
1040
1041.l.i:
1042	$(LEX) $<
1043	$(CPPFORPO) lex.yy.c  > $@
1044	$(RM) lex.yy.c
1045
1046.c.po:
1047	$(CPPFORPO) $< > $<.i
1048	$(BUILD.po)
1049
1050.y.po:
1051	$(YACC) -d $<
1052	$(CPPFORPO) y.tab.c  > $<.i
1053	$(BUILD.po)
1054	$(RM) y.tab.c
1055
1056.l.po:
1057	$(LEX) $<
1058	$(CPPFORPO) lex.yy.c  > $<.i
1059	$(BUILD.po)
1060	$(RM) lex.yy.c
1061
1062#
1063# Rules to perform stylistic checks
1064#
1065.SUFFIXES: .x .xml .check .xmlchk
1066
1067.h.check:
1068	$(DOT_H_CHECK)
1069
1070.x.check:
1071	$(DOT_X_CHECK)
1072
1073.xml.xmlchk:
1074	$(MANIFEST_CHECK)
1075
1076#
1077# Rules to process ONC+ Source partial files
1078#
1079%_onc_plus:	%
1080	@$(ECHO) "extracting code from $< ... "
1081	sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $<  > $@
1082
1083#
1084# Include rules to render automated sccs get rules "safe".
1085#
1086include $(SRC)/Makefile.noget
1087