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