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