xref: /titanic_51/usr/src/Makefile.master (revision f34a71784df3fbc5d1227a7b6201fd318ad1667e)
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
519GNUXGETTEXT= /usr/gnu/bin/xgettext
520GNUXGETFLAGS= --add-comments=TRANSLATION_NOTE --keyword=_ \
521	--strict --no-location --omit-header
522BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
523	$(RM)	$@ ;\
524	$(SED) "/^domain/d" < $(<F).po > $@ ;\
525	$(RM) $(<F).po $<.i
526
527#
528# This is overwritten by local Makefile when PROG is a list.
529#
530POFILE= $(PROG).po
531
532sparc_CCFLAGS=		-cg92 -compat=4 \
533			-Qoption ccfe -messages=no%anachronism \
534			$(CCERRWARN)
535sparcv9_CCFLAGS=	$(sparcv9_XARCH) -dalign -compat=5 \
536			-Qoption ccfe -messages=no%anachronism \
537			-Qoption ccfe -features=no%conststrings \
538			$(CCCREGSYM) \
539			$(CCERRWARN)
540i386_CCFLAGS=		-compat=4 \
541			-Qoption ccfe -messages=no%anachronism \
542			-Qoption ccfe -features=no%conststrings \
543			$(CCERRWARN)
544amd64_CCFLAGS=		$(amd64_XARCH) -compat=5 \
545			-Qoption ccfe -messages=no%anachronism \
546			-Qoption ccfe -features=no%conststrings \
547			$(CCERRWARN)
548
549sparc_CCOPTFLAG=	-O
550sparcv9_CCOPTFLAG=	-O
551i386_CCOPTFLAG=		-O
552amd64_CCOPTFLAG=	-O
553
554CCOPTFLAG=	$($(MACH)_CCOPTFLAG)
555CCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
556CCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS)
557CCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS)
558
559#
560# Various mapfiles that are used throughout the build, and delivered to
561# /usr/lib/ld.
562#
563MAPFILE.NED_i386 =	$(SRC)/common/mapfiles/i386/map.noexdata
564MAPFILE.NED_sparc =
565MAPFILE.NED =		$(MAPFILE.NED_$(MACH))
566MAPFILE.PGA =		$(SRC)/common/mapfiles/$(MACH)/map.pagealign
567MAPFILE.NES =		$(SRC)/common/mapfiles/common/map.noexstk
568MAPFILE.FLT =		$(SRC)/common/mapfiles/common/map.filter
569MAPFILE.LEX =		$(SRC)/common/mapfiles/common/map.lex.yy
570
571#
572# Generated mapfiles that are compiler specific, and used throughout the
573# build.  These mapfiles are not delivered in /usr/lib/ld.
574#
575MAPFILE.NGB_sparc=	$(SRC)/common/mapfiles/gen/sparc_cc_map.noexeglobs
576$(__GNUC64)MAPFILE.NGB_sparc= \
577			$(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
578MAPFILE.NGB_sparcv9=	$(SRC)/common/mapfiles/gen/sparcv9_cc_map.noexeglobs
579$(__GNUC64)MAPFILE.NGB_sparcv9= \
580			$(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
581MAPFILE.NGB_i386=	$(SRC)/common/mapfiles/gen/i386_cc_map.noexeglobs
582$(__GNUC64)MAPFILE.NGB_i386= \
583			$(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
584MAPFILE.NGB_amd64=	$(SRC)/common/mapfiles/gen/amd64_cc_map.noexeglobs
585$(__GNUC64)MAPFILE.NGB_amd64= \
586			$(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
587MAPFILE.NGB =		$(MAPFILE.NGB_$(MACH))
588
589#
590# A generic interface mapfile name, used by various dynamic objects to define
591# the interfaces and interposers the object must export.
592#
593MAPFILE.INT =		mapfile-intf
594
595#
596# LDLIBS32 can be set in the environment to override the following assignment.
597# LDLIBS64 can be set to override the assignment made in Makefile.master.64.
598# These environment settings make sure that no libraries are searched outside
599# of the local workspace proto area:
600#	LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
601#	LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
602#
603LDLIBS32 =	$(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
604LDLIBS.cmd = 	$(LDLIBS32)
605LDLIBS.lib =	$(LDLIBS32)
606#
607# Define compilation macros.
608#
609COMPILE.c=	$(CC) $(CFLAGS) $(CPPFLAGS) -c
610COMPILE64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) -c
611COMPILE.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
612COMPILE64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
613COMPILE.s=	$(AS) $(ASFLAGS) $(AS_CPPFLAGS)
614COMPILE64.s=	$(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
615COMPILE.d=	$(DTRACE) -G -32
616COMPILE64.d=	$(DTRACE) -G -64
617
618CLASSPATH=	.
619COMPILE.java=	$(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
620
621#
622# Link time macros
623#
624CCNEEDED		= -lC
625$(__GNUC)CCNEEDED	= -L$(SFWLIBDIR) -R$(SFWLIBDIR) -lstdc++ -lgcc_s
626
627LINK.c=		$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
628LINK64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
629NORUNPATH=	-norunpath -nolib
630LINK.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
631		$(LDFLAGS) $(CCNEEDED)
632LINK64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
633		$(LDFLAGS) $(CCNEEDED)
634
635#
636# lint macros
637#
638# Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once
639# ON is built with a version of lint that has the fix for 4484186.
640#
641ALWAYS_LINT_DEFS =	-errtags=yes -s
642ALWAYS_LINT_DEFS +=	-erroff=E_PTRDIFF_OVERFLOW
643ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_NARROW_CONV
644ALWAYS_LINT_DEFS +=	-U__PRAGMA_REDEFINE_EXTNAME
645ALWAYS_LINT_DEFS +=	$(C99LMODE)
646ALWAYS_LINT_DEFS +=	-errsecurity=$(SECLEVEL)
647ALWAYS_LINT_DEFS +=	-erroff=E_SEC_CREAT_WITHOUT_EXCL
648ALWAYS_LINT_DEFS +=	-erroff=E_SEC_FORBIDDEN_WARN_CREAT
649# XX64 -- really only needed for amd64 lint
650ALWAYS_LINT_DEFS +=	-erroff=E_ASSIGN_INT_TO_SMALL_INT
651ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_CONST_TO_SMALL_INT
652ALWAYS_LINT_DEFS +=	-erroff=E_CAST_INT_TO_SMALL_INT
653ALWAYS_LINT_DEFS +=	-erroff=E_CAST_TO_PTR_FROM_INT
654ALWAYS_LINT_DEFS +=	-erroff=E_COMP_INT_WITH_LARGE_INT
655ALWAYS_LINT_DEFS +=	-erroff=E_INTEGRAL_CONST_EXP_EXPECTED
656ALWAYS_LINT_DEFS +=	-erroff=E_PASS_INT_TO_SMALL_INT
657ALWAYS_LINT_DEFS +=	-erroff=E_PTR_CONV_LOSES_BITS
658
659# This forces lint to pick up note.h and sys/note.h from Devpro rather than
660# from the proto area.  The note.h that ON delivers would disable NOTE().
661ONLY_LINT_DEFS =	-I$(SPRO_VROOT)/prod/include/lint
662
663SECLEVEL=	core
664LINT.c=		$(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS) $(CPPFLAGS) \
665		$(ALWAYS_LINT_DEFS)
666LINT64.c=	$(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS64) $(CPPFLAGS) \
667		$(ALWAYS_LINT_DEFS)
668LINT.s=		$(LINT.c)
669
670# For some future builds, NATIVE_MACH and MACH might be different.
671# Therefore, NATIVE_MACH needs to be redefined in the
672# environment as `uname -p` to override this macro.
673#
674# For now at least, we cross-compile amd64 on i386 machines.
675NATIVE_MACH=	$(MACH:amd64=i386)
676
677# Define native compilation macros
678#
679
680# Base directory where compilers are loaded.
681# Defined here so it can be overridden by developer.
682#
683SPRO_ROOT=		$(BUILD_TOOLS)/SUNWspro
684SPRO_VROOT=		$(SPRO_ROOT)/SS12
685GNU_ROOT=		$(SFW_ROOT)
686
687# Specify platform compiler versions for languages
688# that we use (currently only c and c++).
689#
690sparc_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
691$(__GNUC)sparc_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
692sparc_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
693$(__GNUC)sparc_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
694sparc_CPP=		/usr/ccs/lib/cpp
695sparc_AS=		/usr/ccs/bin/as -xregsym=no
696sparc_LD=		/usr/ccs/bin/ld
697sparc_LINT=		$(SPRO_VROOT)/bin/lint
698
699sparcv9_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
700$(__GNUC64)sparcv9_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
701sparcv9_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
702$(__GNUC64)sparcv9_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
703sparcv9_CPP=		/usr/ccs/lib/cpp
704sparcv9_AS=		/usr/ccs/bin/as -xregsym=no
705sparcv9_LD=		/usr/ccs/bin/ld
706sparcv9_LINT=		$(SPRO_VROOT)/bin/lint
707
708# We compile 32-bit objects with cc by default
709i386_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
710$(__GNUC)i386_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
711i386_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
712$(__GNUC)i386_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
713i386_CPP=		/usr/ccs/lib/cpp
714i386_AS=		/usr/ccs/bin/as
715$(__GNUC)i386_AS=	$(ONBLD_TOOLS)/bin/$(MACH)/aw
716i386_LD=		/usr/ccs/bin/ld
717i386_LINT=		$(SPRO_VROOT)/bin/lint
718
719# We compile 64-bit objects with gcc
720amd64_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
721$(__GNUC64)amd64_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
722amd64_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
723$(__GNUC64)amd64_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
724amd64_CPP=		/usr/ccs/lib/cpp
725amd64_AS=		$(ONBLD_TOOLS)/bin/$(MACH)/aw
726amd64_LD=		/usr/ccs/bin/ld
727amd64_LINT=		$(SPRO_VROOT)/bin/lint
728
729NATIVECC=		$($(NATIVE_MACH)_CC)
730NATIVECCC=		$($(NATIVE_MACH)_CCC)
731NATIVECPP=		$($(NATIVE_MACH)_CPP)
732NATIVEAS=		$($(NATIVE_MACH)_AS)
733NATIVELD=		$($(NATIVE_MACH)_LD)
734NATIVELINT=		$($(NATIVE_MACH)_LINT)
735
736#
737# Makefile.master.64 overrides these settings
738#
739CC=			$(NATIVECC)
740CCC=			$(NATIVECCC)
741CPP=			$(NATIVECPP)
742AS=			$(NATIVEAS)
743LD=			$(NATIVELD)
744LINT=			$(NATIVELINT)
745
746# The real compilers used for this build
747CW_CC_CMD=		$(CC) -_compiler
748CW_CCC_CMD=		$(CCC) -_compiler
749REAL_CC=		$(CW_CC_CMD:sh)
750REAL_CCC=		$(CW_CCC_CMD:sh)
751
752# Pass -Y flag to cpp (method of which is release-dependent)
753CCYFLAG=		-Y I,
754
755BDIRECT=	-Bdirect
756BDYNAMIC=	-Bdynamic
757BLOCAL=		-Blocal
758BNODIRECT=	-Bnodirect
759BREDUCE=	-Breduce
760BSTATIC=	-Bstatic
761
762ZDEFS=		-zdefs
763ZDIRECT=	-zdirect
764ZIGNORE=	-zignore
765ZINITFIRST=	-zinitfirst
766ZINTERPOSE=	-zinterpose
767ZLAZYLOAD=	-zlazyload
768ZLOADFLTR=	-zloadfltr
769ZMULDEFS=	-zmuldefs
770ZNODEFAULTLIB=	-znodefaultlib
771ZNODEFS=	-znodefs
772ZNODELETE=	-znodelete
773ZNODLOPEN=	-znodlopen
774ZNODUMP=	-znodump
775ZNOLAZYLOAD=	-znolazyload
776ZNORELOC=	-znoreloc
777ZNOVERSION=	-znoversion
778ZRECORD=	-zrecord
779ZREDLOCSYM=	-zredlocsym
780ZTEXT=		-ztext
781ZVERBOSE=	-zverbose
782
783GSHARED=	-G
784CCMT=		-mt
785
786# Handle different PIC models on different ISAs
787# (May be overridden by lower-level Makefiles)
788
789sparc_C_PICFLAGS =	-K pic
790sparcv9_C_PICFLAGS =	-K pic
791i386_C_PICFLAGS =	-K pic
792amd64_C_PICFLAGS =	-K pic
793C_PICFLAGS =		$($(MACH)_C_PICFLAGS)
794C_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
795
796sparc_C_BIGPICFLAGS =	-K PIC
797sparcv9_C_BIGPICFLAGS =	-K PIC
798i386_C_BIGPICFLAGS =	-K PIC
799amd64_C_BIGPICFLAGS =	-K PIC
800C_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
801C_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
802
803# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
804sparc_CC_PICFLAGS =	-Kpic
805sparcv9_CC_PICFLAGS =	-KPIC
806i386_CC_PICFLAGS = 	-Kpic
807amd64_CC_PICFLAGS = 	-Kpic
808CC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
809CC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
810
811AS_PICFLAGS=		$(C_PICFLAGS)
812AS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
813
814#
815# Default label for CTF sections
816#
817CTFCVTFLAGS=		-i -L VERSION
818
819#
820# Override to pass module-specific flags to ctfmerge.  Currently used
821# only by krtld to turn on fuzzy matching.
822#
823CTFMRGFLAGS=
824
825CTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
826
827ELFSIGN_O=	$(TRUE)
828ELFSIGN_CRYPTO=	$(ELFSIGN_O)
829ELFSIGN_OBJECT=	$(ELFSIGN_O)
830ELFSIGN_CRYPTO_LIMITED=	$(ELFSIGN_O)
831$(EXPORT_RELEASE_BUILD)ELFSIGN_O =	$(ELFSIGN)
832$(EXPORT_RELEASE_BUILD)ELFSIGN_CFNAME =	SUNWosnetCF
833$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY =	\
834			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CFNAME)
835$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT=	\
836			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CFNAME)
837$(EXPORT_RELEASE_BUILD)ELFSIGN_CLNAME =	SUNWosnetCFLimited
838$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY_LIMITED =	\
839			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CLNAME)
840$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT_LIMITED=	\
841			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CLNAME)
842$(EXPORT_RELEASE_BUILD)ELFSIGN_SENAME =	SUNWosnetSE
843$(EXPORT_RELEASE_BUILD)ELFSIGN_SEKEY =	\
844			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_SENAME)
845$(EXPORT_RELEASE_BUILD)ELFSIGN_SECERT=	\
846			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_SENAME)
847$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO=	$(ELFSIGN_O) sign \
848			$(ELFSIGN_FORMAT_OPTION) \
849			-k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@
850$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO_LIMITED=	$(ELFSIGN_O) sign \
851			$(ELFSIGN_FORMAT_OPTION) \
852			-k $(ELFSIGN_KEY_LIMITED) -c $(ELFSIGN_CERT_LIMITED) \
853			-e $@
854$(EXPORT_RELEASE_BUILD)ELFSIGN_OBJECT=	$(ELFSIGN_O) sign \
855			$(ELFSIGN_FORMAT_OPTION) \
856			-k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@
857
858# Rules (normally from make.rules) and macros which are used for post
859# processing files. Normally, these do stripping of the comment section
860# automatically.
861#    RELEASE_CM:	Should be editted to reflect the release.
862#    POST_PROCESS_O:	Post-processing for `.o' files.
863#    POST_PROCESS_A:	Post-processing for `.a' files (currently null).
864#    POST_PROCESS_SO:	Post-processing for `.so' files.
865#    POST_PROCESS:	Post-processing for executable files (no suffix).
866# Note that these macros are not completely generalized as they are to be
867# used with the file name to be processed following.
868#
869# It is left as an exercise to Release Engineering to embellish the generation
870# of the release comment string.
871#
872#	If this is a standard development build:
873#		compress the comment section (mcs -c)
874#		add the standard comment (mcs -a $(RELEASE_CM))
875#		add the development specific comment (mcs -a $(DEV_CM))
876#
877#	If this is an installation build:
878#		delete the comment section (mcs -d)
879#		add the standard comment (mcs -a $(RELEASE_CM))
880#		add the development specific comment (mcs -a $(DEV_CM))
881#
882#	If this is an release build:
883#		delete the comment section (mcs -d)
884#		add the standard comment (mcs -a $(RELEASE_CM))
885#
886#	The ONVERS macro sets the default value for the VERSION string
887#	within pkginfo.
888#
889# The following list of macros are used in the definition of RELEASE_CM
890# which is used to label all binaries in the build:
891#
892# 	RELEASE		Specific release of the build, eg: 5.2
893#	RELEASE_MAJOR	Major version number part of $(RELEASE)
894#	RELEASE_MINOR	Minor version number part of $(RELEASE)
895#	VERSION		Version of the build (alpha, beta, Generic)
896#	PATCHID		If this is a patch this value should contain
897#			the patchid value (eg: "Generic 100832-01"), otherwise
898#			it will be set to $(VERSION)
899#	RELEASE_DATE	Date of the Release Build
900#	PATCH_DATE	Date the patch was created, if this is blank it
901#			will default to the RELEASE_DATE
902#
903ONVERS=		"11.11"
904RELEASE_MAJOR=	5
905RELEASE_MINOR=	11
906RELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
907VERSION=	SunOS Development
908PATCHID=	$(VERSION)
909RELEASE_DATE=	October 2007
910PATCH_DATE=	$(RELEASE_DATE)
911RELEASE_CM=	"@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
912DEV_CM=		"@($(POUND_SIGN))SunOS Internal Development: \
913`$(ECHO) $$LOGNAME` `date +%Y-%m-%d` `$(ECHO) [\`basename $$CODEMGR_WS\`]`"
914
915PROCESS_COMMENT=		   @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
916$(STRIP_COMMENTS)PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
917$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
918
919STRIP_STABS=			   :
920$(RELEASE_BUILD)STRIP_STABS=	   $(STRIP) -x $@
921
922POST_PROCESS_O=		$(PROCESS_COMMENT) $@
923POST_PROCESS_A=
924POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
925			$(ELFSIGN_OBJECT)
926POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
927			$(ELFSIGN_OBJECT)
928
929#
930# The PKGDEFS macro points to the source directory containing the majority
931# of ON's package definitions plus Makefiles with general package creation
932# rules.
933#
934# PKGARCHIVE specifies the default location where packages should be
935# placed if built.
936#
937PKGDEFS=$(SRC)/pkgdefs
938$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
939PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
940
941#	Default build rules which perform comment section post-processing.
942#
943.c:
944	$(LINK.c) -o $@ $< $(LDLIBS)
945	$(POST_PROCESS)
946.c.o:
947	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
948	$(POST_PROCESS_O)
949.c.a:
950	$(COMPILE.c) -o $% $<
951	$(PROCESS_COMMENT) $%
952	$(AR) $(ARFLAGS) $@ $%
953	$(RM) $%
954.s.o:
955	$(COMPILE.s) -o $@ $<
956	$(POST_PROCESS_O)
957.s.a:
958	$(COMPILE.s) -o $% $<
959	$(PROCESS_COMMENT) $%
960	$(AR) $(ARFLAGS) $@ $%
961	$(RM) $%
962.cc:
963	$(LINK.cc) -o $@ $< $(LDLIBS)
964	$(POST_PROCESS)
965.cc.o:
966	$(COMPILE.cc) $(OUTPUT_OPTION) $<
967	$(POST_PROCESS_O)
968.cc.a:
969	$(COMPILE.cc) -o $% $<
970	$(AR) $(ARFLAGS) $@ $%
971	$(PROCESS_COMMENT) $%
972	$(RM) $%
973.y:
974	$(YACC.y) $<
975	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
976	$(POST_PROCESS)
977	$(RM) y.tab.c
978.y.o:
979	$(YACC.y) $<
980	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
981	$(POST_PROCESS_O)
982	$(RM) y.tab.c
983.l:
984	$(RM) $*.c
985	$(LEX.l) $< > $*.c
986	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
987	$(POST_PROCESS)
988	$(RM) $*.c
989.l.o:
990	$(RM) $*.c
991	$(LEX.l) $< > $*.c
992	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
993	$(POST_PROCESS_O)
994	$(RM) $*.c
995
996.java.class:
997	$(COMPILE.java) $<
998
999# Bourne and Korn shell script message catalog build rules.
1000# We extract all gettext strings with sed(1) (being careful to permit
1001# multiple gettext strings on the same line), weed out the dups, and
1002# build the catalogue with awk(1).
1003
1004.sh.po .ksh.po:
1005	$(SED) -n -e ":a" 				\
1006		  -e "h" 					\
1007		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
1008		  -e "x"					\
1009		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
1010		  -e "t a"					\
1011	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1012
1013#
1014# Python and Perl executable and message catalog build rules.
1015#
1016.SUFFIXES: .pl .pm .py .pyc
1017
1018.pl:
1019	$(RM) $@;
1020	$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
1021	$(CHMOD) +x $@
1022
1023.py:
1024	$(RM) $@; $(CAT) $< > $@; $(CHMOD) +x $@
1025
1026.py.pyc:
1027	$(RM) $@
1028	$(PYTHON) -mpy_compile $<
1029	@[ $(<)c = $@ ] || $(MV) $(<)c $@
1030
1031.py.po:
1032	$(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ;
1033
1034.pl.po .pm.po:
1035	$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
1036	$(RM)	$@ ;
1037	$(SED) "/^domain/d" < $(<F).po > $@ ;
1038	$(RM) $(<F).po
1039
1040#
1041# When using xgettext, we want messages to go to the default domain,
1042# rather than the specified one.  This special version of the
1043# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1044# causing xgettext to put all messages into the default domain.
1045#
1046CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1047
1048.c.i:
1049	$(CPPFORPO) $< > $@
1050
1051.h.i:
1052	$(CPPFORPO) $< > $@
1053
1054.y.i:
1055	$(YACC) -d $<
1056	$(CPPFORPO) y.tab.c  > $@
1057	$(RM) y.tab.c
1058
1059.l.i:
1060	$(LEX) $<
1061	$(CPPFORPO) lex.yy.c  > $@
1062	$(RM) lex.yy.c
1063
1064.c.po:
1065	$(CPPFORPO) $< > $<.i
1066	$(BUILD.po)
1067
1068.y.po:
1069	$(YACC) -d $<
1070	$(CPPFORPO) y.tab.c  > $<.i
1071	$(BUILD.po)
1072	$(RM) y.tab.c
1073
1074.l.po:
1075	$(LEX) $<
1076	$(CPPFORPO) lex.yy.c  > $<.i
1077	$(BUILD.po)
1078	$(RM) lex.yy.c
1079
1080#
1081# Rules to perform stylistic checks
1082#
1083.SUFFIXES: .x .xml .check .xmlchk
1084
1085.h.check:
1086	$(DOT_H_CHECK)
1087
1088.x.check:
1089	$(DOT_X_CHECK)
1090
1091.xml.xmlchk:
1092	$(MANIFEST_CHECK)
1093
1094#
1095# Rules to process ONC+ Source partial files
1096#
1097%_onc_plus:	%
1098	@$(ECHO) "extracting code from $< ... "
1099	sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $<  > $@
1100
1101#
1102# Include rules to render automated sccs get rules "safe".
1103#
1104include $(SRC)/Makefile.noget
1105