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