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