xref: /illumos-gate/usr/src/Makefile.master (revision 6d1d45ee7157107ef92303ea769d6d3fcf5dfcc8)
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# This is overwritten by local Makefile when PROG is a list.
521#
522POFILE= $(PROG).po
523
524sparc_CCFLAGS=		-cg92 -compat=4 \
525			-Qoption ccfe -messages=no%anachronism \
526			$(CCERRWARN)
527sparcv9_CCFLAGS=	$(sparcv9_XARCH) -dalign -compat=5 \
528			-Qoption ccfe -messages=no%anachronism \
529			-Qoption ccfe -features=no%conststrings \
530			$(CCCREGSYM) \
531			$(CCERRWARN)
532i386_CCFLAGS=		-compat=4 \
533			-Qoption ccfe -messages=no%anachronism \
534			-Qoption ccfe -features=no%conststrings \
535			$(CCERRWARN)
536amd64_CCFLAGS=		$(amd64_XARCH) -compat=5 \
537			-Qoption ccfe -messages=no%anachronism \
538			-Qoption ccfe -features=no%conststrings \
539			$(CCERRWARN)
540
541sparc_CCOPTFLAG=	-O
542sparcv9_CCOPTFLAG=	-O
543i386_CCOPTFLAG=		-O
544amd64_CCOPTFLAG=	-O
545
546CCOPTFLAG=	$($(MACH)_CCOPTFLAG)
547CCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
548CCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS)
549CCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS)
550
551#
552# Various mapfiles that are used throughout the build, and delivered to
553# /usr/lib/ld.
554#
555MAPFILE.NED_i386 =	$(SRC)/common/mapfiles/i386/map.noexdata
556MAPFILE.NED_sparc =
557MAPFILE.NED =		$(MAPFILE.NED_$(MACH))
558MAPFILE.PGA =		$(SRC)/common/mapfiles/$(MACH)/map.pagealign
559MAPFILE.NES =		$(SRC)/common/mapfiles/common/map.noexstk
560MAPFILE.FLT =		$(SRC)/common/mapfiles/common/map.filter
561MAPFILE.LEX =		$(SRC)/common/mapfiles/common/map.lex.yy
562
563#
564# Generated mapfiles that are compiler specific, and used throughout the
565# build.  These mapfiles are not delivered in /usr/lib/ld.
566#
567MAPFILE.NGB_sparc=	$(SRC)/common/mapfiles/gen/sparc_cc_map.noexeglobs
568$(__GNUC64)MAPFILE.NGB_sparc= \
569			$(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
570MAPFILE.NGB_sparcv9=	$(SRC)/common/mapfiles/gen/sparcv9_cc_map.noexeglobs
571$(__GNUC64)MAPFILE.NGB_sparcv9= \
572			$(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
573MAPFILE.NGB_i386=	$(SRC)/common/mapfiles/gen/i386_cc_map.noexeglobs
574$(__GNUC64)MAPFILE.NGB_i386= \
575			$(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
576MAPFILE.NGB_amd64=	$(SRC)/common/mapfiles/gen/amd64_cc_map.noexeglobs
577$(__GNUC64)MAPFILE.NGB_amd64= \
578			$(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
579MAPFILE.NGB =		$(MAPFILE.NGB_$(MACH))
580
581#
582# A generic interface mapfile name, used by various dynamic objects to define
583# the interfaces and interposers the object must export.
584#
585MAPFILE.INT =		mapfile-intf
586
587#
588# LDLIBS32 can be set in the environment to override the following assignment.
589# LDLIBS64 can be set to override the assignment made in Makefile.master.64.
590# These environment settings make sure that no libraries are searched outside
591# of the local workspace proto area:
592#	LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
593#	LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
594#
595LDLIBS32 =	$(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
596LDLIBS.cmd = 	$(LDLIBS32)
597LDLIBS.lib =	$(LDLIBS32)
598#
599# Define compilation macros.
600#
601COMPILE.c=	$(CC) $(CFLAGS) $(CPPFLAGS) -c
602COMPILE64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) -c
603COMPILE.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
604COMPILE64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
605COMPILE.s=	$(AS) $(ASFLAGS) $(AS_CPPFLAGS)
606COMPILE64.s=	$(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
607COMPILE.d=	$(DTRACE) -G -32
608COMPILE64.d=	$(DTRACE) -G -64
609
610CLASSPATH=	.
611COMPILE.java=	$(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
612
613#
614# Link time macros
615#
616CCNEEDED		= -lC
617$(__GNUC)CCNEEDED	= -L$(SFWLIBDIR) -R$(SFWLIBDIR) -lstdc++ -lgcc_s
618
619LINK.c=		$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
620LINK64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
621NORUNPATH=	-norunpath -nolib
622LINK.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
623		$(LDFLAGS) $(CCNEEDED)
624LINK64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
625		$(LDFLAGS) $(CCNEEDED)
626
627#
628# lint macros
629#
630# Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once
631# ON is built with a version of lint that has the fix for 4484186.
632#
633ALWAYS_LINT_DEFS =	-errtags=yes -s
634ALWAYS_LINT_DEFS +=	-erroff=E_PTRDIFF_OVERFLOW
635ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_NARROW_CONV
636ALWAYS_LINT_DEFS +=	-U__PRAGMA_REDEFINE_EXTNAME
637ALWAYS_LINT_DEFS +=	$(C99LMODE)
638ALWAYS_LINT_DEFS +=	-errsecurity=$(SECLEVEL)
639ALWAYS_LINT_DEFS +=	-erroff=E_SEC_CREAT_WITHOUT_EXCL
640ALWAYS_LINT_DEFS +=	-erroff=E_SEC_FORBIDDEN_WARN_CREAT
641# XX64 -- really only needed for amd64 lint
642ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_INT_TO_SMALL_INT
643ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_CONST_TO_SMALL_INT
644ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_TO_SMALL_INT
645ALWAYS_LINT_DEFS +=	-erroff=E_CAST_TO_PTR_FROM_INT
646ALWAYS_LINT_DEFS +=	-erroff=E_COMP_INT_WITH_LARGE_INT
647ALWAYS_LINT_DEFS +=	-erroff=E_INTEGRAL_CONST_EXP_EXPECTED
648ALWAYS_LINT_DEFS +=	-erroff=E_PASS_INT_TO_SMALL_INT
649ALWAYS_LINT_DEFS +=	-erroff=E_PTR_CONV_LOSES_BITS
650
651SECLEVEL=	core
652LINT.c=		$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(ALWAYS_LINT_DEFS)
653LINT64.c=	$(LINT) $(LINTFLAGS64) $(CPPFLAGS) $(ALWAYS_LINT_DEFS)
654LINT.s=		$(LINT.c)
655
656# For some future builds, NATIVE_MACH and MACH might be different.
657# Therefore, NATIVE_MACH needs to be redefined in the
658# environment as `uname -p` to override this macro.
659#
660# For now at least, we cross-compile amd64 on i386 machines.
661NATIVE_MACH=	$(MACH:amd64=i386)
662
663# Define native compilation macros
664#
665
666# Base directory where compilers are loaded.
667# Defined here so it can be overridden by developer.
668#
669SPRO_ROOT=		$(BUILD_TOOLS)/SUNWspro
670SPRO_VROOT=		$(SPRO_ROOT)/SS11
671GNU_ROOT=		$(SFW_ROOT)
672
673# Specify platform compiler versions for languages
674# that we use (currently only c and c++).
675#
676sparc_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
677$(__GNUC)sparc_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
678sparc_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
679$(__GNUC)sparc_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
680sparc_CPP=		/usr/ccs/lib/cpp
681sparc_AS=		/usr/ccs/bin/as -xregsym=no
682sparc_LD=		/usr/ccs/bin/ld
683sparc_LINT=		$(SPRO_VROOT)/bin/lint
684
685sparcv9_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
686$(__GNUC64)sparcv9_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
687sparcv9_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
688$(__GNUC64)sparcv9_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
689sparcv9_CPP=		/usr/ccs/lib/cpp
690sparcv9_AS=		/usr/ccs/bin/as -xregsym=no
691sparcv9_LD=		/usr/ccs/bin/ld
692sparcv9_LINT=		$(SPRO_VROOT)/bin/lint
693
694# We compile 32-bit objects with cc by default
695i386_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
696$(__GNUC)i386_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
697i386_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
698$(__GNUC)i386_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
699i386_CPP=		/usr/ccs/lib/cpp
700i386_AS=		/usr/ccs/bin/as
701$(__GNUC)i386_AS=	$(ONBLD_TOOLS)/bin/$(MACH)/aw
702i386_LD=		/usr/ccs/bin/ld
703i386_LINT=		$(SPRO_VROOT)/bin/lint
704
705# We compile 64-bit objects with gcc
706amd64_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
707$(__GNUC64)amd64_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
708amd64_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
709$(__GNUC64)amd64_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
710amd64_CPP=		/usr/ccs/lib/cpp
711amd64_AS=		$(ONBLD_TOOLS)/bin/$(MACH)/aw
712amd64_LD=		/usr/ccs/bin/ld
713amd64_LINT=		$(SPRO_VROOT)/bin/lint
714
715NATIVECC=		$($(NATIVE_MACH)_CC)
716NATIVECCC=		$($(NATIVE_MACH)_CCC)
717NATIVECPP=		$($(NATIVE_MACH)_CPP)
718NATIVEAS=		$($(NATIVE_MACH)_AS)
719NATIVELD=		$($(NATIVE_MACH)_LD)
720NATIVELINT=		$($(NATIVE_MACH)_LINT)
721
722#
723# Makefile.master.64 overrides these settings
724#
725CC=			$(NATIVECC)
726CCC=			$(NATIVECCC)
727CPP=			$(NATIVECPP)
728AS=			$(NATIVEAS)
729LD=			$(NATIVELD)
730LINT=			$(NATIVELINT)
731
732# The real compilers used for this build
733CW_CC_CMD=		$(CC) -_compiler
734CW_CCC_CMD=		$(CCC) -_compiler
735REAL_CC=		$(CW_CC_CMD:sh)
736REAL_CCC=		$(CW_CCC_CMD:sh)
737
738# Pass -Y flag to cpp (method of which is release-dependent)
739CCYFLAG=		-Y I,
740
741BDIRECT=	-Bdirect
742BDYNAMIC=	-Bdynamic
743BLOCAL=		-Blocal
744BNODIRECT=	-Bnodirect
745BREDUCE=	-Breduce
746BSTATIC=	-Bstatic
747
748ZCOMBRELOC=	-zcombreloc
749ZDEFS=		-zdefs
750ZDIRECT=	-zdirect
751ZIGNORE=	-zignore
752ZINITFIRST=	-zinitfirst
753ZINTERPOSE=	-zinterpose
754ZLAZYLOAD=	-zlazyload
755ZLOADFLTR=	-zloadfltr
756ZMULDEFS=	-zmuldefs
757ZNODEFAULTLIB=	-znodefaultlib
758ZNODEFS=	-znodefs
759ZNODELETE=	-znodelete
760ZNODLOPEN=	-znodlopen
761ZNODUMP=	-znodump
762ZNOLAZYLOAD=	-znolazyload
763ZNORELOC=	-znoreloc
764ZNOVERSION=	-znoversion
765ZRECORD=	-zrecord
766ZREDLOCSYM=	-zredlocsym
767ZTEXT=		-ztext
768ZVERBOSE=	-zverbose
769
770GSHARED=	-G
771CCMT=		-mt
772
773# Handle different PIC models on different ISAs
774# (May be overridden by lower-level Makefiles)
775
776sparc_C_PICFLAGS =	-K pic
777sparcv9_C_PICFLAGS =	-K pic
778i386_C_PICFLAGS =	-K pic
779amd64_C_PICFLAGS =	-K pic
780C_PICFLAGS =		$($(MACH)_C_PICFLAGS)
781C_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
782
783sparc_C_BIGPICFLAGS =	-K PIC
784sparcv9_C_BIGPICFLAGS =	-K PIC
785i386_C_BIGPICFLAGS =	-K PIC
786amd64_C_BIGPICFLAGS =	-K PIC
787C_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
788C_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
789
790# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
791sparc_CC_PICFLAGS =	-Kpic
792sparcv9_CC_PICFLAGS =	-KPIC
793i386_CC_PICFLAGS = 	-Kpic
794amd64_CC_PICFLAGS = 	-Kpic
795CC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
796CC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
797
798AS_PICFLAGS=		$(C_PICFLAGS)
799AS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
800
801#
802# Default label for CTF sections
803#
804CTFCVTFLAGS=		-i -L VERSION
805
806#
807# Override to pass module-specific flags to ctfmerge.  Currently used
808# only by krtld to turn on fuzzy matching.
809#
810CTFMRGFLAGS=
811
812CTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
813
814ELFSIGN_O=	$(TRUE)
815ELFSIGN_CRYPTO=	$(ELFSIGN_O)
816ELFSIGN_OBJECT=	$(ELFSIGN_O)
817ELFSIGN_CRYPTO_LIMITED=	$(ELFSIGN_O)
818$(EXPORT_RELEASE_BUILD)ELFSIGN_O =	$(ELFSIGN)
819$(EXPORT_RELEASE_BUILD)ELFSIGN_CFNAME =	SUNWosnetCF
820$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY =	\
821			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CFNAME)
822$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT=	\
823			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CFNAME)
824$(EXPORT_RELEASE_BUILD)ELFSIGN_CLNAME =	SUNWosnetCFLimited
825$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY_LIMITED =	\
826			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CLNAME)
827$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT_LIMITED=	\
828			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CLNAME)
829$(EXPORT_RELEASE_BUILD)ELFSIGN_SENAME =	SUNWosnetSE
830$(EXPORT_RELEASE_BUILD)ELFSIGN_SEKEY =	\
831			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_SENAME)
832$(EXPORT_RELEASE_BUILD)ELFSIGN_SECERT=	\
833			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_SENAME)
834$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO=	$(ELFSIGN_O) sign \
835			$(ELFSIGN_FORMAT_OPTION) \
836			-k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@
837$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO_LIMITED=	$(ELFSIGN_O) sign \
838			$(ELFSIGN_FORMAT_OPTION) \
839			-k $(ELFSIGN_KEY_LIMITED) -c $(ELFSIGN_CERT_LIMITED) \
840			-e $@
841$(EXPORT_RELEASE_BUILD)ELFSIGN_OBJECT=	$(ELFSIGN_O) sign \
842			$(ELFSIGN_FORMAT_OPTION) \
843			-k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@
844
845# Rules (normally from make.rules) and macros which are used for post
846# processing files. Normally, these do stripping of the comment section
847# automatically.
848#    RELEASE_CM:	Should be editted to reflect the release.
849#    POST_PROCESS_O:	Post-processing for `.o' files.
850#    POST_PROCESS_A:	Post-processing for `.a' files (currently null).
851#    POST_PROCESS_SO:	Post-processing for `.so' files.
852#    POST_PROCESS:	Post-processing for executable files (no suffix).
853# Note that these macros are not completely generalized as they are to be
854# used with the file name to be processed following.
855#
856# It is left as an exercise to Release Engineering to embellish the generation
857# of the release comment string.
858#
859#	If this is a standard development build:
860#		compress the comment section (mcs -c)
861#		add the standard comment (mcs -a $(RELEASE_CM))
862#		add the development specific comment (mcs -a $(DEV_CM))
863#
864#	If this is an installation build:
865#		delete the comment section (mcs -d)
866#		add the standard comment (mcs -a $(RELEASE_CM))
867#		add the development specific comment (mcs -a $(DEV_CM))
868#
869#	If this is an release build:
870#		delete the comment section (mcs -d)
871#		add the standard comment (mcs -a $(RELEASE_CM))
872#
873#	The ONVERS macro sets the default value for the VERSION string
874#	within pkginfo.
875#
876# The following list of macros are used in the definition of RELEASE_CM
877# which is used to label all binaries in the build:
878#
879# 	RELEASE		Specific release of the build, eg: 5.2
880#	RELEASE_MAJOR	Major version number part of $(RELEASE)
881#	RELEASE_MINOR	Minor version number part of $(RELEASE)
882#	VERSION		Version of the build (alpha, beta, Generic)
883#	PATCHID		If this is a patch this value should contain
884#			the patchid value (eg: "Generic 100832-01"), otherwise
885#			it will be set to $(VERSION)
886#	RELEASE_DATE	Date of the Release Build
887#	PATCH_DATE	Date the patch was created, if this is blank it
888#			will default to the RELEASE_DATE
889#
890ONVERS=		"11.11"
891RELEASE_MAJOR=	5
892RELEASE_MINOR=	11
893RELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
894VERSION=	SunOS Development
895PATCHID=	$(VERSION)
896RELEASE_DATE=	October 2007
897PATCH_DATE=	$(RELEASE_DATE)
898RELEASE_CM=	"@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
899DEV_CM=		"@($(POUND_SIGN))SunOS Internal Development: \
900`$(ECHO) $$LOGNAME` `date +%Y-%m-%d` `$(ECHO) [\`basename $$CODEMGR_WS\`]`"
901
902PROCESS_COMMENT=		   @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
903$(STRIP_COMMENTS)PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
904$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
905
906STRIP_STABS=			   :
907$(RELEASE_BUILD)STRIP_STABS=	   $(STRIP) -x $@
908
909POST_PROCESS_O=		$(PROCESS_COMMENT) $@
910POST_PROCESS_A=
911POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
912			$(ELFSIGN_OBJECT)
913POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
914			$(ELFSIGN_OBJECT)
915
916#
917# The PKGDEFS macro points to the source directory containing the majority
918# of ON's package definitions plus Makefiles with general package creation
919# rules.
920#
921# PKGARCHIVE specifies the default location where packages should be
922# placed if built.
923#
924PKGDEFS=$(SRC)/pkgdefs
925$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
926PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
927
928#	Default build rules which perform comment section post-processing.
929#
930.c:
931	$(LINK.c) -o $@ $< $(LDLIBS)
932	$(POST_PROCESS)
933.c.o:
934	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
935	$(POST_PROCESS_O)
936.c.a:
937	$(COMPILE.c) -o $% $<
938	$(PROCESS_COMMENT) $%
939	$(AR) $(ARFLAGS) $@ $%
940	$(RM) $%
941.s.o:
942	$(COMPILE.s) -o $@ $<
943	$(POST_PROCESS_O)
944.s.a:
945	$(COMPILE.s) -o $% $<
946	$(PROCESS_COMMENT) $%
947	$(AR) $(ARFLAGS) $@ $%
948	$(RM) $%
949.cc:
950	$(LINK.cc) -o $@ $< $(LDLIBS)
951	$(POST_PROCESS)
952.cc.o:
953	$(COMPILE.cc) $(OUTPUT_OPTION) $<
954	$(POST_PROCESS_O)
955.cc.a:
956	$(COMPILE.cc) -o $% $<
957	$(AR) $(ARFLAGS) $@ $%
958	$(PROCESS_COMMENT) $%
959	$(RM) $%
960.y:
961	$(YACC.y) $<
962	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
963	$(POST_PROCESS)
964	$(RM) y.tab.c
965.y.o:
966	$(YACC.y) $<
967	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
968	$(POST_PROCESS_O)
969	$(RM) y.tab.c
970.l:
971	$(RM) $*.c
972	$(LEX.l) $< > $*.c
973	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
974	$(POST_PROCESS)
975	$(RM) $*.c
976.l.o:
977	$(RM) $*.c
978	$(LEX.l) $< > $*.c
979	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
980	$(POST_PROCESS_O)
981	$(RM) $*.c
982
983.java.class:
984	$(COMPILE.java) $<
985
986#
987# Rules to create message catalogue files from .sh, .ksh, .c, .y, and .l
988# files.  For .sh and .ksh files, we extract all gettext strings with
989# sed(1) (being careful to permit multiple gettext strings on the same
990# line), weed out the dups, and build the catalogue with awk(1).
991#
992
993.sh.po:
994	$(SED) -n -e ":a" 					\
995		  -e "h" 					\
996		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
997		  -e "x"					\
998		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
999		  -e "t a"					\
1000	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1001
1002.ksh.po:
1003	$(SED) -n -e ":a" 					\
1004		  -e "h" 					\
1005		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
1006		  -e "x"					\
1007		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
1008		  -e "t a"					\
1009	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1010
1011#
1012# When using xgettext, we want messages to go to the default domain,
1013# rather than the specified one.  This special version of the
1014# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1015# causing xgettext to put all messages into the default domain.
1016#
1017CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1018
1019.c.i:
1020	$(CPPFORPO) $< > $@
1021
1022.h.i:
1023	$(CPPFORPO) $< > $@
1024
1025.y.i:
1026	$(YACC) -d $<
1027	$(CPPFORPO) y.tab.c  > $@
1028	$(RM) y.tab.c
1029
1030.l.i:
1031	$(LEX) $<
1032	$(CPPFORPO) lex.yy.c  > $@
1033	$(RM) lex.yy.c
1034
1035.c.po:
1036	$(CPPFORPO) $< > $<.i
1037	$(BUILD.po)
1038
1039.y.po:
1040	$(YACC) -d $<
1041	$(CPPFORPO) y.tab.c  > $<.i
1042	$(BUILD.po)
1043	$(RM) y.tab.c
1044
1045.l.po:
1046	$(LEX) $<
1047	$(CPPFORPO) lex.yy.c  > $<.i
1048	$(BUILD.po)
1049	$(RM) lex.yy.c
1050
1051#
1052# Rules to perform stylistic checks
1053#
1054.SUFFIXES: $(SUFFIXES) .x .xml .check .xmlchk
1055
1056.h.check:
1057	$(DOT_H_CHECK)
1058
1059.x.check:
1060	$(DOT_X_CHECK)
1061
1062.xml.xmlchk:
1063	$(MANIFEST_CHECK)
1064
1065#
1066# Rules to process ONC+ Source partial files
1067#
1068%_onc_plus:	%
1069	@$(ECHO) "extracting code from $< ... "
1070	sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $<  > $@
1071
1072#
1073# Include rules to render automated sccs get rules "safe".
1074#
1075include $(SRC)/Makefile.noget
1076