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