xref: /titanic_51/usr/src/Makefile.master (revision a0aa776e20803c84edd153d9cb584fd67163aef3)
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 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26#
27# Makefile.master, global definitions for system source
28#
29ROOT=		/proto
30
31#
32# RELEASE_BUILD should be cleared for final release builds.
33# NOT_RELEASE_BUILD is exactly what the name implies.
34#
35# INTERNAL_RELEASE_BUILD is a subset of RELEASE_BUILD. It mostly controls
36# identification strings. Enabling RELEASE_BUILD automatically enables
37# INTERNAL_RELEASE_BUILD.
38#
39# EXPORT_RELEASE_BUILD controls whether binaries are built in a form that
40# can be released for export under a binary license.  It is orthogonal to
41# the other *RELEASE_BUILD settings.  ("#" means do an export release
42# build, "" means do a normal build.)
43#
44# CLOSED_BUILD controls whether we try to build files under
45# usr/closed.  ("" means to build closed code, "#" means don't try to
46# build it.)  Skipping the closed code implies doing an export release
47# build.
48#
49# STRIP_COMMENTS toggles comment section striping. Generally the same setting
50# as INTERNAL_RELEASE_BUILD.
51#
52# __GNUC toggles the building of ON components using gcc and related tools.
53# Normally set to `#', set it to `' to do gcc build.
54#
55# The declaration POUND_SIGN is always '#'. This is needed to get around the
56# make feature that '#' is always a comment delimiter, even when escaped or
57# quoted.  The only way of generating this is the :sh macro mechanism.  Note
58# however that in general :sh macros should be avoided in makefiles that are
59# widely included into other makefiles, as the resulting shell executions can
60# cause a noticable slowdown in build times.
61#
62POUND_SIGN:sh=				echo \\043
63
64NOT_RELEASE_BUILD=
65INTERNAL_RELEASE_BUILD=			$(POUND_SIGN)
66RELEASE_BUILD=				$(POUND_SIGN)
67$(RELEASE_BUILD)NOT_RELEASE_BUILD=	$(POUND_SIGN)
68$(RELEASE_BUILD)INTERNAL_RELEASE_BUILD=
69PATCH_BUILD=				$(POUND_SIGN)
70
71# If CLOSED_IS_PRESENT is not set, assume the closed tree is present.
72CLOSED_BUILD_1=	$(CLOSED_IS_PRESENT:yes=)
73CLOSED_BUILD=	$(CLOSED_BUILD_1:no=$(POUND_SIGN))
74
75EXPORT_RELEASE_BUILD=			$(POUND_SIGN)
76$(CLOSED_BUILD)EXPORT_RELEASE_BUILD=
77
78# SPARC_BLD is '#' for an Intel build.
79# INTEL_BLD is '#' for a Sparc build.
80SPARC_BLD_1=    $(MACH:i386=$(POUND_SIGN))
81SPARC_BLD=      $(SPARC_BLD_1:sparc=)
82INTEL_BLD_1=    $(MACH:sparc=$(POUND_SIGN))
83INTEL_BLD=      $(INTEL_BLD_1:i386=)
84
85STRIP_COMMENTS=	$(INTERNAL_RELEASE_BUILD)
86
87# set __GNUC= in the environment to build 32-bit with the gcc compiler.
88# The default is to use the Sun Studio compiler for all processor types.
89__GNUC=		$(POUND_SIGN)
90
91# set __GNUC64= in the environment to build 64-bit with the gcc compiler.
92# Inherit the __GNUC value by default, and if that is set to $(POUND_SIGN)
93# then this means use the Sun Studio compiler.
94__GNUC64=	$(__GNUC)
95
96# set __SSNEXT= in the enviroment to build with the 'next' release of
97# the Sun Studio compiler. This will cause command line options specific
98# to the 'next' version of the Sun Studio compiler to be used.
99__SSNEXT=	$(POUND_SIGN)
100
101# CLOSED is the root of the tree that contains source which isn't released
102# as open source
103CLOSED=		$(SRC)/../closed
104
105# BUILD_TOOLS is the root of all tools including compilers.
106# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
107
108BUILD_TOOLS=		/ws/onnv-tools
109ONBLD_TOOLS=		$(BUILD_TOOLS)/onbld
110
111JAVA_ROOT=	/usr/java
112
113SFW_ROOT=	/usr/sfw
114SFWINCDIR=	$(SFW_ROOT)/include
115SFWLIBDIR=	$(SFW_ROOT)/lib
116SFWLIBDIR64=	$(SFW_ROOT)/lib/$(MACH64)
117
118RPCGEN=		/usr/bin/rpcgen
119STABS=		$(ONBLD_TOOLS)/bin/$(MACH)/stabs
120ELFEXTRACT=	$(ONBLD_TOOLS)/bin/$(MACH)/elfextract
121MBH_PATCH=	$(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch
122ECHO=		echo
123INS=		install
124TRUE=		true
125SYMLINK=	/usr/bin/ln -s
126LN=		/usr/bin/ln
127CHMOD=		/usr/bin/chmod
128MV=		/usr/bin/mv -f
129RM=		/usr/bin/rm -f
130CUT=		/usr/bin/cut
131NM=		/usr/ccs/bin/nm
132DIFF=		/usr/bin/diff
133GREP=		/usr/bin/grep
134EGREP=		/usr/bin/egrep
135ELFWRAP=	/usr/bin/elfwrap
136KSH93=		/usr/bin/ksh93
137SED=		/usr/bin/sed
138NAWK=		/usr/bin/nawk
139CP=		/usr/bin/cp -f
140MCS=		/usr/ccs/bin/mcs
141CAT=            /usr/bin/cat
142ELFDUMP=	/usr/ccs/bin/elfdump
143M4=		/usr/ccs/bin/m4
144STRIP=		/usr/ccs/bin/strip
145LEX=		/usr/ccs/bin/lex
146FLEX=		$(SFW_ROOT)/bin/flex
147YACC=		/usr/ccs/bin/yacc
148CPP=		/usr/lib/cpp
149JAVAC=		$(JAVA_ROOT)/bin/javac
150JAVAH=		$(JAVA_ROOT)/bin/javah
151JAVADOC=	$(JAVA_ROOT)/bin/javadoc
152RMIC=		$(JAVA_ROOT)/bin/rmic
153JAR=		$(JAVA_ROOT)/bin/jar
154CTFCONVERT=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
155CTFMERGE=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
156CTFSTABS=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
157NDRGEN=		$(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
158GENOFFSETS=	$(ONBLD_TOOLS)/bin/genoffsets
159CTFCVTPTBL=	$(ONBLD_TOOLS)/bin/ctfcvtptbl
160CTFFINDMOD=	$(ONBLD_TOOLS)/bin/ctffindmod
161XREF=		$(ONBLD_TOOLS)/bin/xref
162FIND=		/usr/bin/find
163PERL=		/usr/bin/perl
164PYTHON=		/usr/bin/python
165SORT=		/usr/bin/sort
166TOUCH=		/usr/bin/touch
167WC=		/usr/bin/wc
168XARGS=		/usr/bin/xargs
169ELFEDIT=	/usr/bin/elfedit
170ELFSIGN=	/usr/bin/elfsign
171DTRACE=		/usr/sbin/dtrace
172UNIQ=		/usr/bin/uniq
173
174FILEMODE=	644
175DIRMODE=	755
176
177#
178# The version of the patch makeup table optimized for build-time use.  Used
179# during patch builds only.
180$(PATCH_BUILD)PMTMO_FILE=$(SRC)/patch_makeup_table.mo
181
182# Declare that nothing should be built in parallel.
183# Individual Makefiles can use the .PARALLEL target to declare otherwise.
184.NO_PARALLEL:
185
186# For stylistic checks
187#
188# Note that the X and C checks are not used at this time and may need
189# modification when they are actually used.
190#
191CSTYLE=		$(ONBLD_TOOLS)/bin/cstyle
192CSTYLE_TAIL=
193HDRCHK=		$(ONBLD_TOOLS)/bin/hdrchk
194HDRCHK_TAIL=
195JSTYLE=		$(ONBLD_TOOLS)/bin/jstyle
196
197DOT_H_CHECK=	\
198	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
199	$(HDRCHK) $< $(HDRCHK_TAIL)
200
201DOT_X_CHECK=	\
202	@$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
203	$(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
204
205DOT_C_CHECK=	\
206	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
207
208MANIFEST_CHECK=	\
209	@$(ECHO) "checking $<"; \
210	SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
211	SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
212	SVCCFG_CONFIGD_PATH=$(SRC)/cmd/svc/configd/svc.configd-native \
213	$(SRC)/cmd/svc/svccfg/svccfg-native validate $<
214
215INS.file=	$(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
216INS.dir=	$(INS) -s -d -m $(DIRMODE) $@
217# installs and renames at once
218#
219INS.rename=	$(INS.file); $(MV) $(@D)/$(<F) $@
220
221# install a link
222INSLINKTARGET=	$<
223INS.link=	$(RM) $@; $(LN) $(INSLINKTARGET) $@
224#
225# Python bakes the mtime of the .py file into the compiled .pyc and
226# rebuilds if the baked-in mtime != the mtime of the source file
227# (rather than only if it's less than), thus when installing python
228# files we must make certain to not adjust the mtime of the source
229# (.py) file.
230#
231INS.pyfile=	$(INS.file); $(TOUCH) -r $< $@
232
233# MACH must be set in the shell environment per uname -p on the build host
234# More specific architecture variables should be set in lower makefiles.
235#
236# MACH64 is derived from MACH, and BUILD64 is set to `#' for
237# architectures on which we do not build 64-bit versions.
238# (There are no such architectures at the moment.)
239#
240# Set BUILD64=# in the environment to disable 64-bit amd64
241# builds on i386 machines.
242
243MACH64_1=	$(MACH:sparc=sparcv9)
244MACH64=		$(MACH64_1:i386=amd64)
245
246MACH32_1=	$(MACH:sparc=sparcv7)
247MACH32=		$(MACH32_1:i386=i86)
248
249sparc_BUILD64=
250i386_BUILD64=
251BUILD64=	$($(MACH)_BUILD64)
252
253#
254# C compiler mode. Future compilers may change the default on us,
255# so force extended ANSI mode globally. Lower level makefiles can
256# override this by setting CCMODE.
257#
258CCMODE=			-Xa
259CCMODE64=		-Xa
260
261#
262# C compiler verbose mode. This is so we can enable it globally,
263# but turn it off in the lower level makefiles of things we cannot
264# (or aren't going to) fix.
265#
266CCVERBOSE=		-v
267
268# set this to the secret flag "-Wc,-Qiselect-v9abiwarn=1" to get warnings
269# from the compiler about places the -xarch=v9 may differ from -xarch=v9c.
270V9ABIWARN=
271
272# set this to the secret flag "-Wc,-Qiselect-regsym=0" to disable register
273# symbols (used to detect conflicts between objects that use global registers)
274# we disable this now for safety, and because genunix doesn't link with
275# this feature (the v9 default) enabled.
276#
277# REGSYM is separate since the C++ driver syntax is different.
278CCREGSYM=		-Wc,-Qiselect-regsym=0
279CCCREGSYM=		-Qoption cg -Qiselect-regsym=0
280
281# Prevent the removal of static symbols by the SPARC code generator (cg).
282# The x86 code generator (ube) does not remove such symbols and as such
283# using this workaround is not applicable for x86.
284#
285CCSTATICSYM=		-Wc,-Qassembler-ounrefsym=0
286#
287# generate 32-bit addresses in the v9 kernel. Saves memory.
288CCABS32=		-Wc,-xcode=abs32
289
290# One optimization the compiler might perform is to turn this:
291#	#pragma weak foo
292#	extern int foo;
293#	if (&foo)
294#		foo = 5;
295# into
296#	foo = 5;
297# Since we do some of this (foo might be referenced in common kernel code
298# but provided only for some cpu modules or platforms), we disable this
299# optimization.
300#
301sparc_CCUNBOUND	= -Wd,-xsafe=unboundsym
302i386_CCUNBOUND	=
303CCUNBOUND	= $($(MACH)_CCUNBOUND)
304
305#
306# compiler '-xarch' flag. This is here to centralize it and make it
307# overridable for testing.
308sparc_XARCH=	-m32
309sparcv9_XARCH=	-m64
310i386_XARCH=
311amd64_XARCH=	-m64 -Ui386 -U__i386
312
313# assembler '-xarch' flag.  Different from compiler '-xarch' flag.
314sparc_AS_XARCH=		-xarch=v8plus
315sparcv9_AS_XARCH=	-xarch=v9
316i386_AS_XARCH=
317amd64_AS_XARCH=		-xarch=amd64 -P -Ui386 -U__i386
318
319#
320# These flags define what we need to be 'standalone' i.e. -not- part
321# of the rather more cosy userland environment.  This basically means
322# the kernel.
323#
324# XX64	future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
325#
326sparc_STAND_FLAGS=	-_gcc=-ffreestanding
327sparcv9_STAND_FLAGS=	-_gcc=-ffreestanding
328i386_STAND_FLAGS=	-_gcc=-ffreestanding
329amd64_STAND_FLAGS=	-xmodel=kernel
330
331SAVEARGS=		-Wu,-save_args
332amd64_STAND_FLAGS	+= $(SAVEARGS)
333
334STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
335STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
336
337#
338# disable the incremental linker
339ILDOFF=			-xildoff
340#
341XDEPEND=		-xdepend
342XFFLAG=			-xF=%all
343XESS=			-xs
344XSTRCONST=		-xstrconst
345
346#
347# turn warnings into errors (C)
348CERRWARN = -errtags=yes -errwarn=%all
349CERRWARN += -erroff=E_EMPTY_TRANSLATION_UNIT
350CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
351
352#
353# turn warnings into errors (C++)
354CCERRWARN=		-xwe
355
356# C99 mode
357C99_ENABLE=	-xc99=%all
358C99_DISABLE=	-xc99=%none
359C99MODE=	$(C99_DISABLE)
360C99LMODE=	$(C99MODE:-xc99%=-Xc99%)
361
362# In most places, assignments to these macros should be appended with +=
363# (CPPFLAGS.master allows values to be prepended to CPPFLAGS).
364sparc_CFLAGS=	$(sparc_XARCH) $(CCSTATICSYM)
365sparcv9_CFLAGS=	$(sparcv9_XARCH) -dalign $(CCVERBOSE) $(V9ABIWARN) $(CCREGSYM) \
366		$(CCSTATICSYM)
367i386_CFLAGS=	$(i386_XARCH)
368amd64_CFLAGS=	$(amd64_XARCH)
369
370sparc_ASFLAGS=	$(sparc_AS_XARCH)
371sparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
372i386_ASFLAGS=	$(i386_AS_XARCH)
373amd64_ASFLAGS=	$(amd64_AS_XARCH)
374
375#
376sparc_COPTFLAG=		-xO3
377sparcv9_COPTFLAG=	-xO3
378i386_COPTFLAG=		-O
379amd64_COPTFLAG=		-xO3
380
381COPTFLAG= $($(MACH)_COPTFLAG)
382COPTFLAG64= $($(MACH64)_COPTFLAG)
383
384# When -g is used, the compiler globalizes static objects
385# (gives them a unique prefix). Disable that.
386CNOGLOBAL= -W0,-noglobal
387
388# Direct the Sun Studio compiler to use a static globalization prefix based on the
389# name of the module rather than something unique. Otherwise, objects
390# will not build deterministically, as subsequent compilations of identical
391# source will yeild objects that always look different.
392#
393# In the same spirit, this will also remove the date from the N_OPT stab.
394CGLOBALSTATIC= -W0,-xglobalstatic
395
396# Normally, gcc uses indirect DWARF strings to save space.  However,
397# this causes relocations that ctfconvert cannot handle.  Disable this.
398CDWARFSTR=	-_gcc=-fno-dwarf2-indirect-strings
399
400# Sometimes we want all symbols and types in debugging information even
401# if they aren't used.
402CALLSYMS=	-W0,-xdbggen=no%usedonly
403
404#
405# Default debug format for Sun Studio 11 is dwarf, so force it to
406# generate stabs.
407#
408DEBUGFORMAT=	-xdebugformat=stabs
409
410#
411# Flags used to build in debug mode for ctf generation.  Bugs in the Devpro
412# compilers currently prevent us from building with cc-emitted DWARF.
413#
414CTF_FLAGS_sparc	= -g -Wc,-Qiselect-T1 $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
415CTF_FLAGS_i386	= -g $(C99MODE) $(CNOGLOBAL) $(CDWARFSTR)
416CTF_FLAGS	= $(CTF_FLAGS_$(MACH)) $(DEBUGFORMAT)
417
418#
419# Flags used with genoffsets
420#
421GOFLAGS = -_noecho \
422	$(CALLSYMS) \
423	$(CDWARFSTR)
424
425OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
426	$(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
427
428OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
429	$(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
430
431#
432# tradeoff time for space (smaller is better)
433#
434sparc_SPACEFLAG		= -xspace -W0,-Lt
435sparcv9_SPACEFLAG	= -xspace -W0,-Lt
436i386_SPACEFLAG		= -xspace
437amd64_SPACEFLAG		=
438
439SPACEFLAG		= $($(MACH)_SPACEFLAG)
440SPACEFLAG64		= $($(MACH64)_SPACEFLAG)
441
442#
443# The Sun Studio 11 compiler has changed the behaviour of integer
444# wrap arounds and so a flag is needed to use the legacy behaviour
445# (without this flag panics/hangs could be exposed within the source).
446#
447sparc_IROPTFLAG		= -W2,-xwrap_int
448sparcv9_IROPTFLAG	= -W2,-xwrap_int
449i386_IROPTFLAG		=
450amd64_IROPTFLAG		=
451
452IROPTFLAG		= $($(MACH)_IROPTFLAG)
453IROPTFLAG64		= $($(MACH64)_IROPTFLAG)
454
455sparc_XREGSFLAG		= -xregs=no%appl
456sparcv9_XREGSFLAG	= -xregs=no%appl
457i386_XREGSFLAG		=
458amd64_XREGSFLAG		=
459
460XREGSFLAG		= $($(MACH)_XREGSFLAG)
461XREGSFLAG64		= $($(MACH64)_XREGSFLAG)
462
463CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) $(SPACEFLAG) $(CCMODE) \
464		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG) \
465		$(CGLOBALSTATIC)
466CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) $(SPACEFLAG64) $(CCMODE64) \
467		$(ILDOFF) $(CERRWARN) $(C99MODE) $(CCUNBOUND) $(IROPTFLAG64) \
468		$(CGLOBALSTATIC)
469#
470# Flags that are used to build parts of the code that are subsequently
471# run on the build machine (also known as the NATIVE_BUILD).
472#
473NATIVE_CFLAGS=	$(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) $(CCMODE) \
474		$(ILDOFF) $(CERRWARN) $(C99MODE) $($(NATIVE_MACH)_CCUNBOUND) \
475		$(IROPTFLAG) $(CGLOBALSTATIC)
476
477DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"	# For messaging.
478DTS_ERRNO=-D_TS_ERRNO
479CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
480	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
481CPPFLAGS=	$(CPPFLAGS.master)
482AS_CPPFLAGS=	$(CPPFLAGS.master)
483JAVAFLAGS=	-deprecation
484
485#
486# For source message catalogue
487#
488.SUFFIXES: $(SUFFIXES) .i .po
489MSGROOT= $(ROOT)/catalog
490MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
491MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
492DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
493DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
494
495CLOBBERFILES += $(POFILE) $(POFILES)
496COMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
497XGETTEXT= /usr/bin/xgettext
498XGETFLAGS= -c TRANSLATION_NOTE
499GNUXGETTEXT= /usr/gnu/bin/xgettext
500GNUXGETFLAGS= --add-comments=TRANSLATION_NOTE --keyword=_ \
501	--strict --no-location --omit-header
502BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
503	$(RM)	$@ ;\
504	$(SED) "/^domain/d" < $(<F).po > $@ ;\
505	$(RM) $(<F).po $<.i
506
507#
508# This is overwritten by local Makefile when PROG is a list.
509#
510POFILE= $(PROG).po
511
512sparc_CCFLAGS=		-cg92 -compat=4 \
513			-Qoption ccfe -messages=no%anachronism \
514			$(CCERRWARN)
515sparcv9_CCFLAGS=	$(sparcv9_XARCH) -dalign -compat=5 \
516			-Qoption ccfe -messages=no%anachronism \
517			-Qoption ccfe -features=no%conststrings \
518			$(CCCREGSYM) \
519			$(CCERRWARN)
520i386_CCFLAGS=		-compat=4 \
521			-Qoption ccfe -messages=no%anachronism \
522			-Qoption ccfe -features=no%conststrings \
523			$(CCERRWARN)
524amd64_CCFLAGS=		$(amd64_XARCH) -compat=5 \
525			-Qoption ccfe -messages=no%anachronism \
526			-Qoption ccfe -features=no%conststrings \
527			$(CCERRWARN)
528
529sparc_CCOPTFLAG=	-O
530sparcv9_CCOPTFLAG=	-O
531i386_CCOPTFLAG=		-O
532amd64_CCOPTFLAG=	-O
533
534CCOPTFLAG=	$($(MACH)_CCOPTFLAG)
535CCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
536CCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS)
537CCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS)
538
539#
540#
541#
542ELFWRAP_FLAGS	=
543ELFWRAP_FLAGS64	=	-64
544
545#
546# Various mapfiles that are used throughout the build, and delivered to
547# /usr/lib/ld.
548#
549MAPFILE.NED_i386 =	$(SRC)/common/mapfiles/i386/map.noexdata
550MAPFILE.NED_sparc =
551MAPFILE.NED =		$(MAPFILE.NED_$(MACH))
552MAPFILE.PGA =		$(SRC)/common/mapfiles/$(MACH)/map.pagealign
553MAPFILE.NES =		$(SRC)/common/mapfiles/common/map.noexstk
554MAPFILE.FLT =		$(SRC)/common/mapfiles/common/map.filter
555MAPFILE.LEX =		$(SRC)/common/mapfiles/common/map.lex.yy
556
557#
558# Generated mapfiles that are compiler specific, and used throughout the
559# build.  These mapfiles are not delivered in /usr/lib/ld.
560#
561MAPFILE.NGB_sparc=	$(SRC)/common/mapfiles/gen/sparc_cc_map.noexeglobs
562$(__GNUC64)MAPFILE.NGB_sparc= \
563			$(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
564MAPFILE.NGB_sparcv9=	$(SRC)/common/mapfiles/gen/sparcv9_cc_map.noexeglobs
565$(__GNUC64)MAPFILE.NGB_sparcv9= \
566			$(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
567MAPFILE.NGB_i386=	$(SRC)/common/mapfiles/gen/i386_cc_map.noexeglobs
568$(__GNUC64)MAPFILE.NGB_i386= \
569			$(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
570MAPFILE.NGB_amd64=	$(SRC)/common/mapfiles/gen/amd64_cc_map.noexeglobs
571$(__GNUC64)MAPFILE.NGB_amd64= \
572			$(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
573MAPFILE.NGB =		$(MAPFILE.NGB_$(MACH))
574
575#
576# A generic interface mapfile name, used by various dynamic objects to define
577# the interfaces and interposers the object must export.
578#
579MAPFILE.INT =		mapfile-intf
580
581#
582# LDLIBS32 can be set in the environment to override the following assignment.
583# LDLIBS64 can be set to override the assignment made in Makefile.master.64.
584# These environment settings make sure that no libraries are searched outside
585# of the local workspace proto area:
586#	LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
587#	LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
588#
589LDLIBS32 =	$(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
590LDLIBS.cmd = 	$(LDLIBS32)
591LDLIBS.lib =	$(LDLIBS32)
592#
593# Define compilation macros.
594#
595COMPILE.c=	$(CC) $(CFLAGS) $(CPPFLAGS) -c
596COMPILE64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) -c
597COMPILE.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
598COMPILE64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
599COMPILE.s=	$(AS) $(ASFLAGS) $(AS_CPPFLAGS)
600COMPILE64.s=	$(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
601COMPILE.d=	$(DTRACE) -G -32
602COMPILE64.d=	$(DTRACE) -G -64
603COMPILE.b=	$(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
604COMPILE64.b=	$(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
605
606CLASSPATH=	.
607COMPILE.java=	$(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
608
609#
610# Link time macros
611#
612CCNEEDED		= -lC
613$(__GNUC)CCNEEDED	= -L$(SFWLIBDIR) -R$(SFWLIBDIR) -lstdc++ -lgcc_s
614
615LINK.c=		$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
616LINK64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
617NORUNPATH=	-norunpath -nolib
618LINK.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
619		$(LDFLAGS) $(CCNEEDED)
620LINK64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
621		$(LDFLAGS) $(CCNEEDED)
622
623#
624# lint macros
625#
626# Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once
627# ON is built with a version of lint that has the fix for 4484186.
628#
629ALWAYS_LINT_DEFS =	-errtags=yes -s
630ALWAYS_LINT_DEFS +=	-erroff=E_PTRDIFF_OVERFLOW
631ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_NARROW_CONV
632ALWAYS_LINT_DEFS +=	-U__PRAGMA_REDEFINE_EXTNAME
633ALWAYS_LINT_DEFS +=	$(C99LMODE)
634ALWAYS_LINT_DEFS +=	-errsecurity=$(SECLEVEL)
635ALWAYS_LINT_DEFS +=	-erroff=E_SEC_CREAT_WITHOUT_EXCL
636ALWAYS_LINT_DEFS +=	-erroff=E_SEC_FORBIDDEN_WARN_CREAT
637# XX64 -- really only needed for amd64 lint
638ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_INT_TO_SMALL_INT
639ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_CONST_TO_SMALL_INT
640ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_TO_SMALL_INT
641ALWAYS_LINT_DEFS +=	-erroff=E_CAST_TO_PTR_FROM_INT
642ALWAYS_LINT_DEFS +=	-erroff=E_COMP_INT_WITH_LARGE_INT
643ALWAYS_LINT_DEFS +=	-erroff=E_INTEGRAL_CONST_EXP_EXPECTED
644ALWAYS_LINT_DEFS +=	-erroff=E_PASS_INT_TO_SMALL_INT
645ALWAYS_LINT_DEFS +=	-erroff=E_PTR_CONV_LOSES_BITS
646
647# This forces lint to pick up note.h and sys/note.h from Devpro rather than
648# from the proto area.  The note.h that ON delivers would disable NOTE().
649ONLY_LINT_DEFS =	-I$(SPRO_VROOT)/prod/include/lint
650
651SECLEVEL=	core
652LINT.c=		$(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS) $(CPPFLAGS) \
653		$(ALWAYS_LINT_DEFS)
654LINT64.c=	$(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS64) $(CPPFLAGS) \
655		$(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)/SS12
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
764ZNOLDYNSYM=	-znoldynsym
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)
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_SENAME =	SUNWosnetSE
826$(EXPORT_RELEASE_BUILD)ELFSIGN_SEKEY =	\
827			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_SENAME)
828$(EXPORT_RELEASE_BUILD)ELFSIGN_SECERT=	\
829			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_SENAME)
830$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO=	$(ELFSIGN_O) sign \
831			$(ELFSIGN_FORMAT_OPTION) \
832			-k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@
833$(EXPORT_RELEASE_BUILD)ELFSIGN_OBJECT=	$(ELFSIGN_O) sign \
834			$(ELFSIGN_FORMAT_OPTION) \
835			-k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@
836
837# Rules (normally from make.rules) and macros which are used for post
838# processing files. Normally, these do stripping of the comment section
839# automatically.
840#    RELEASE_CM:	Should be editted to reflect the release.
841#    POST_PROCESS_O:	Post-processing for `.o' files.
842#    POST_PROCESS_A:	Post-processing for `.a' files (currently null).
843#    POST_PROCESS_SO:	Post-processing for `.so' files.
844#    POST_PROCESS:	Post-processing for executable files (no suffix).
845# Note that these macros are not completely generalized as they are to be
846# used with the file name to be processed following.
847#
848# It is left as an exercise to Release Engineering to embellish the generation
849# of the release comment string.
850#
851#	If this is a standard development build:
852#		compress the comment section (mcs -c)
853#		add the standard comment (mcs -a $(RELEASE_CM))
854#		add the development specific comment (mcs -a $(DEV_CM))
855#
856#	If this is an installation build:
857#		delete the comment section (mcs -d)
858#		add the standard comment (mcs -a $(RELEASE_CM))
859#		add the development specific comment (mcs -a $(DEV_CM))
860#
861#	If this is an release build:
862#		delete the comment section (mcs -d)
863#		add the standard comment (mcs -a $(RELEASE_CM))
864#
865#	The ONVERS macro sets the default value for the VERSION string
866#	within pkginfo.
867#
868# The following list of macros are used in the definition of RELEASE_CM
869# which is used to label all binaries in the build:
870#
871# 	RELEASE		Specific release of the build, eg: 5.2
872#	RELEASE_MAJOR	Major version number part of $(RELEASE)
873#	RELEASE_MINOR	Minor version number part of $(RELEASE)
874#	VERSION		Version of the build (alpha, beta, Generic)
875#	PATCHID		If this is a patch this value should contain
876#			the patchid value (eg: "Generic 100832-01"), otherwise
877#			it will be set to $(VERSION)
878#	RELEASE_DATE	Date of the Release Build
879#	PATCH_DATE	Date the patch was created, if this is blank it
880#			will default to the RELEASE_DATE
881#
882ONVERS=		"11.11"
883RELEASE_MAJOR=	5
884RELEASE_MINOR=	11
885RELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
886VERSION=	SunOS Development
887PATCHID=	$(VERSION)
888RELEASE_DATE=	October 2007
889PATCH_DATE=	$(RELEASE_DATE)
890RELEASE_CM=	"@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
891DEV_CM=		"@($(POUND_SIGN))SunOS Internal Development: \
892`$(ECHO) $$LOGNAME` `date +%Y-%m-%d` `$(ECHO) [\`basename $$CODEMGR_WS\`]`"
893
894PROCESS_COMMENT=		   @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
895$(STRIP_COMMENTS)PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
896$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
897
898STRIP_STABS=			   :
899$(RELEASE_BUILD)STRIP_STABS=	   $(STRIP) -x $@
900
901POST_PROCESS_O=		$(PROCESS_COMMENT) $@
902POST_PROCESS_A=
903POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
904			$(ELFSIGN_OBJECT)
905POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
906			$(ELFSIGN_OBJECT)
907
908#
909# chk4ubin is a tool that inspects a module for a symbol table
910# ELF section size which can trigger an OBP bug on older platforms.
911# This problem affects only specific sun4u bootable modules.
912#
913CHK4UBIN=	$(ONBLD_TOOLS)/bin/$(MACH)/chk4ubin
914CHK4UBINFLAGS=
915CHK4UBINARY=	$(CHK4UBIN) $(CHK4UBINFLAGS) $@
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.bin.o:
985	$(COMPILE.b) -o $@ $<
986	$(POST_PROCESS_O)
987
988.java.class:
989	$(COMPILE.java) $<
990
991# Bourne and Korn shell script message catalog build rules.
992# We extract all gettext strings with sed(1) (being careful to permit
993# multiple gettext strings on the same line), weed out the dups, and
994# build the catalogue with awk(1).
995
996.sh.po .ksh.po:
997	$(SED) -n -e ":a" 				\
998		  -e "h" 					\
999		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
1000		  -e "x"					\
1001		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
1002		  -e "t a"					\
1003	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1004
1005#
1006# Python and Perl executable and message catalog build rules.
1007#
1008.SUFFIXES: .pl .pm .py .pyc
1009
1010.pl:
1011	$(RM) $@;
1012	$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
1013	$(CHMOD) +x $@
1014
1015.py:
1016	$(RM) $@; $(CAT) $< > $@; $(CHMOD) +x $@
1017
1018.py.pyc:
1019	$(RM) $@
1020	$(PYTHON) -mpy_compile $<
1021	@[ $(<)c = $@ ] || $(MV) $(<)c $@
1022
1023.py.po:
1024	$(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ;
1025
1026.pl.po .pm.po:
1027	$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
1028	$(RM)	$@ ;
1029	$(SED) "/^domain/d" < $(<F).po > $@ ;
1030	$(RM) $(<F).po
1031
1032#
1033# When using xgettext, we want messages to go to the default domain,
1034# rather than the specified one.  This special version of the
1035# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1036# causing xgettext to put all messages into the default domain.
1037#
1038CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1039
1040.c.i:
1041	$(CPPFORPO) $< > $@
1042
1043.h.i:
1044	$(CPPFORPO) $< > $@
1045
1046.y.i:
1047	$(YACC) -d $<
1048	$(CPPFORPO) y.tab.c  > $@
1049	$(RM) y.tab.c
1050
1051.l.i:
1052	$(LEX) $<
1053	$(CPPFORPO) lex.yy.c  > $@
1054	$(RM) lex.yy.c
1055
1056.c.po:
1057	$(CPPFORPO) $< > $<.i
1058	$(BUILD.po)
1059
1060.y.po:
1061	$(YACC) -d $<
1062	$(CPPFORPO) y.tab.c  > $<.i
1063	$(BUILD.po)
1064	$(RM) y.tab.c
1065
1066.l.po:
1067	$(LEX) $<
1068	$(CPPFORPO) lex.yy.c  > $<.i
1069	$(BUILD.po)
1070	$(RM) lex.yy.c
1071
1072#
1073# Rules to perform stylistic checks
1074#
1075.SUFFIXES: .x .xml .check .xmlchk
1076
1077.h.check:
1078	$(DOT_H_CHECK)
1079
1080.x.check:
1081	$(DOT_X_CHECK)
1082
1083.xml.xmlchk:
1084	$(MANIFEST_CHECK)
1085
1086#
1087# Rules to process ONC+ Source partial files
1088#
1089%_onc_plus:	%
1090	@$(ECHO) "extracting code from $< ... "
1091	sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $<  > $@
1092
1093#
1094# Include rules to render automated sccs get rules "safe".
1095#
1096include $(SRC)/Makefile.noget
1097