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