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