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