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