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