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