xref: /illumos-gate/usr/src/Makefile.master (revision c0dd49bdd68c0d758a67d56f07826f3b45cfc664)
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 2010 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/python2.4
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# Till SS12u1 formally becomes the NV CBE, LINT is hard
682# coded to be picked up from the $SPRO_ROOT/sunstudio12.1/
683# location. Impacted variables are sparc_LINT, sparcv9_LINT,
684# i386_LINT, amd64_LINT.
685# Reset them when SS12u1 is rolled out.
686#
687
688# Specify platform compiler versions for languages
689# that we use (currently only c and c++).
690#
691sparc_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
692$(__GNUC)sparc_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
693sparc_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
694$(__GNUC)sparc_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
695sparc_CPP=		/usr/ccs/lib/cpp
696sparc_AS=		/usr/ccs/bin/as -xregsym=no
697sparc_LD=		/usr/ccs/bin/ld
698sparc_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
699
700sparcv9_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
701$(__GNUC64)sparcv9_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
702sparcv9_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
703$(__GNUC64)sparcv9_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
704sparcv9_CPP=		/usr/ccs/lib/cpp
705sparcv9_AS=		/usr/ccs/bin/as -xregsym=no
706sparcv9_LD=		/usr/ccs/bin/ld
707sparcv9_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
708
709# We compile 32-bit objects with cc by default
710i386_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
711$(__GNUC)i386_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
712i386_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
713$(__GNUC)i386_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
714i386_CPP=		/usr/ccs/lib/cpp
715i386_AS=		/usr/ccs/bin/as
716$(__GNUC)i386_AS=	$(ONBLD_TOOLS)/bin/$(MACH)/aw
717i386_LD=		/usr/ccs/bin/ld
718i386_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
719
720# We compile 64-bit objects with gcc
721amd64_CC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
722$(__GNUC64)amd64_CC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
723amd64_CCC=		$(ONBLD_TOOLS)/bin/$(MACH)/cw -_CC
724$(__GNUC64)amd64_CCC=	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_g++
725amd64_CPP=		/usr/ccs/lib/cpp
726amd64_AS=		$(ONBLD_TOOLS)/bin/$(MACH)/aw
727amd64_LD=		/usr/ccs/bin/ld
728amd64_LINT=		$(SPRO_ROOT)/sunstudio12.1/bin/lint
729
730NATIVECC=		$($(NATIVE_MACH)_CC)
731NATIVECCC=		$($(NATIVE_MACH)_CCC)
732NATIVECPP=		$($(NATIVE_MACH)_CPP)
733NATIVEAS=		$($(NATIVE_MACH)_AS)
734NATIVELD=		$($(NATIVE_MACH)_LD)
735NATIVELINT=		$($(NATIVE_MACH)_LINT)
736
737#
738# Makefile.master.64 overrides these settings
739#
740CC=			$(NATIVECC)
741CCC=			$(NATIVECCC)
742CPP=			$(NATIVECPP)
743AS=			$(NATIVEAS)
744LD=			$(NATIVELD)
745LINT=			$(NATIVELINT)
746
747# The real compilers used for this build
748CW_CC_CMD=		$(CC) -_compiler
749CW_CCC_CMD=		$(CCC) -_compiler
750REAL_CC=		$(CW_CC_CMD:sh)
751REAL_CCC=		$(CW_CCC_CMD:sh)
752
753# Pass -Y flag to cpp (method of which is release-dependent)
754CCYFLAG=		-Y I,
755
756BDIRECT=	-Bdirect
757BDYNAMIC=	-Bdynamic
758BLOCAL=		-Blocal
759BNODIRECT=	-Bnodirect
760BREDUCE=	-Breduce
761BSTATIC=	-Bstatic
762
763ZDEFS=		-zdefs
764ZDIRECT=	-zdirect
765ZIGNORE=	-zignore
766ZINITFIRST=	-zinitfirst
767ZINTERPOSE=	-zinterpose
768ZLAZYLOAD=	-zlazyload
769ZLOADFLTR=	-zloadfltr
770ZMULDEFS=	-zmuldefs
771ZNODEFAULTLIB=	-znodefaultlib
772ZNODEFS=	-znodefs
773ZNODELETE=	-znodelete
774ZNODLOPEN=	-znodlopen
775ZNODUMP=	-znodump
776ZNOLAZYLOAD=	-znolazyload
777ZNOLDYNSYM=	-znoldynsym
778ZNORELOC=	-znoreloc
779ZNOVERSION=	-znoversion
780ZRECORD=	-zrecord
781ZREDLOCSYM=	-zredlocsym
782ZTEXT=		-ztext
783ZVERBOSE=	-zverbose
784
785GSHARED=	-G
786CCMT=		-mt
787
788# Handle different PIC models on different ISAs
789# (May be overridden by lower-level Makefiles)
790
791sparc_C_PICFLAGS =	-K pic
792sparcv9_C_PICFLAGS =	-K pic
793i386_C_PICFLAGS =	-K pic
794amd64_C_PICFLAGS =	-K pic
795C_PICFLAGS =		$($(MACH)_C_PICFLAGS)
796C_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
797
798sparc_C_BIGPICFLAGS =	-K PIC
799sparcv9_C_BIGPICFLAGS =	-K PIC
800i386_C_BIGPICFLAGS =	-K PIC
801amd64_C_BIGPICFLAGS =	-K PIC
802C_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
803C_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
804
805# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
806sparc_CC_PICFLAGS =	-Kpic
807sparcv9_CC_PICFLAGS =	-KPIC
808i386_CC_PICFLAGS = 	-Kpic
809amd64_CC_PICFLAGS = 	-Kpic
810CC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
811CC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
812
813AS_PICFLAGS=		$(C_PICFLAGS)
814AS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
815
816#
817# Default label for CTF sections
818#
819CTFCVTFLAGS=		-i -L VERSION
820
821#
822# Override to pass module-specific flags to ctfmerge.  Currently used
823# only by krtld to turn on fuzzy matching.
824#
825CTFMRGFLAGS=
826
827CTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
828
829ELFSIGN_O=	$(TRUE)
830ELFSIGN_CRYPTO=	$(ELFSIGN_O)
831ELFSIGN_OBJECT=	$(ELFSIGN_O)
832$(EXPORT_RELEASE_BUILD)ELFSIGN_O =	$(ELFSIGN)
833$(EXPORT_RELEASE_BUILD)ELFSIGN_CFNAME =	SUNWosnetCF
834$(EXPORT_RELEASE_BUILD)ELFSIGN_KEY =	\
835			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_CFNAME)
836$(EXPORT_RELEASE_BUILD)ELFSIGN_CERT=	\
837			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_CFNAME)
838$(EXPORT_RELEASE_BUILD)ELFSIGN_SENAME =	SUNWosnetSE
839$(EXPORT_RELEASE_BUILD)ELFSIGN_SEKEY =	\
840			$(CLOSED)/cmd/cmd-crypto/etc/keys/$(ELFSIGN_SENAME)
841$(EXPORT_RELEASE_BUILD)ELFSIGN_SECERT=	\
842			$(CLOSED)/cmd/cmd-crypto/etc/certs/$(ELFSIGN_SENAME)
843$(EXPORT_RELEASE_BUILD)ELFSIGN_CRYPTO=	$(ELFSIGN_O) sign \
844			$(ELFSIGN_FORMAT_OPTION) \
845			-k $(ELFSIGN_KEY) -c $(ELFSIGN_CERT) -e $@
846$(EXPORT_RELEASE_BUILD)ELFSIGN_OBJECT=	$(ELFSIGN_O) sign \
847			$(ELFSIGN_FORMAT_OPTION) \
848			-k $(ELFSIGN_SEKEY) -c $(ELFSIGN_SECERT) -e $@
849
850# Rules (normally from make.rules) and macros which are used for post
851# processing files. Normally, these do stripping of the comment section
852# automatically.
853#    RELEASE_CM:	Should be editted to reflect the release.
854#    POST_PROCESS_O:	Post-processing for `.o' files.
855#    POST_PROCESS_A:	Post-processing for `.a' files (currently null).
856#    POST_PROCESS_SO:	Post-processing for `.so' files.
857#    POST_PROCESS:	Post-processing for executable files (no suffix).
858# Note that these macros are not completely generalized as they are to be
859# used with the file name to be processed following.
860#
861# It is left as an exercise to Release Engineering to embellish the generation
862# of the release comment string.
863#
864#	If this is a standard development build:
865#		compress the comment section (mcs -c)
866#		add the standard comment (mcs -a $(RELEASE_CM))
867#		add the development specific comment (mcs -a $(DEV_CM))
868#
869#	If this is an installation build:
870#		delete the comment section (mcs -d)
871#		add the standard comment (mcs -a $(RELEASE_CM))
872#		add the development specific comment (mcs -a $(DEV_CM))
873#
874#	If this is an release build:
875#		delete the comment section (mcs -d)
876#		add the standard comment (mcs -a $(RELEASE_CM))
877#
878# The following list of macros are used in the definition of RELEASE_CM
879# which is used to label all binaries in the build:
880#
881# 	RELEASE		Specific release of the build, eg: 5.2
882#	RELEASE_MAJOR	Major version number part of $(RELEASE)
883#	RELEASE_MINOR	Minor version number part of $(RELEASE)
884#	VERSION		Version of the build (alpha, beta, Generic)
885#	PATCHID		If this is a patch this value should contain
886#			the patchid value (eg: "Generic 100832-01"), otherwise
887#			it will be set to $(VERSION)
888#	RELEASE_DATE	Date of the Release Build
889#	PATCH_DATE	Date the patch was created, if this is blank it
890#			will default to the RELEASE_DATE
891#
892RELEASE_MAJOR=	5
893RELEASE_MINOR=	11
894RELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
895VERSION=	SunOS Development
896PATCHID=	$(VERSION)
897RELEASE_DATE=	release date not set
898PATCH_DATE=	$(RELEASE_DATE)
899RELEASE_CM=	"@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
900DEV_CM=		"@($(POUND_SIGN))SunOS Internal Development: non-nightly build"
901
902PROCESS_COMMENT=		   @?${MCS} -c -a $(RELEASE_CM) -a $(DEV_CM)
903$(STRIP_COMMENTS)PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
904$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
905
906STRIP_STABS=			   :
907$(RELEASE_BUILD)STRIP_STABS=	   $(STRIP) -x $@
908
909POST_PROCESS_O=		$(PROCESS_COMMENT) $@
910POST_PROCESS_A=
911POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
912			$(ELFSIGN_OBJECT)
913POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
914			$(ELFSIGN_OBJECT)
915
916#
917# chk4ubin is a tool that inspects a module for a symbol table
918# ELF section size which can trigger an OBP bug on older platforms.
919# This problem affects only specific sun4u bootable modules.
920#
921CHK4UBIN=	$(ONBLD_TOOLS)/bin/$(MACH)/chk4ubin
922CHK4UBINFLAGS=
923CHK4UBINARY=	$(CHK4UBIN) $(CHK4UBINFLAGS) $@
924
925#
926# PKGARCHIVE specifies the default location where packages should be
927# placed if built.
928#
929$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
930PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
931
932#
933# The repositories will be created with these publisher settings.  To
934# update an image to the resulting repositories, this must match the
935# publisher name provided to "pkg set-publisher."
936#
937PKGPUBLISHER_REDIST=	on-nightly
938PKGPUBLISHER_NONREDIST=	on-extra
939
940#	Default build rules which perform comment section post-processing.
941#
942.c:
943	$(LINK.c) -o $@ $< $(LDLIBS)
944	$(POST_PROCESS)
945.c.o:
946	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
947	$(POST_PROCESS_O)
948.c.a:
949	$(COMPILE.c) -o $% $<
950	$(PROCESS_COMMENT) $%
951	$(AR) $(ARFLAGS) $@ $%
952	$(RM) $%
953.s.o:
954	$(COMPILE.s) -o $@ $<
955	$(POST_PROCESS_O)
956.s.a:
957	$(COMPILE.s) -o $% $<
958	$(PROCESS_COMMENT) $%
959	$(AR) $(ARFLAGS) $@ $%
960	$(RM) $%
961.cc:
962	$(LINK.cc) -o $@ $< $(LDLIBS)
963	$(POST_PROCESS)
964.cc.o:
965	$(COMPILE.cc) $(OUTPUT_OPTION) $<
966	$(POST_PROCESS_O)
967.cc.a:
968	$(COMPILE.cc) -o $% $<
969	$(AR) $(ARFLAGS) $@ $%
970	$(PROCESS_COMMENT) $%
971	$(RM) $%
972.y:
973	$(YACC.y) $<
974	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
975	$(POST_PROCESS)
976	$(RM) y.tab.c
977.y.o:
978	$(YACC.y) $<
979	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
980	$(POST_PROCESS_O)
981	$(RM) y.tab.c
982.l:
983	$(RM) $*.c
984	$(LEX.l) $< > $*.c
985	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
986	$(POST_PROCESS)
987	$(RM) $*.c
988.l.o:
989	$(RM) $*.c
990	$(LEX.l) $< > $*.c
991	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
992	$(POST_PROCESS_O)
993	$(RM) $*.c
994
995.bin.o:
996	$(COMPILE.b) -o $@ $<
997	$(POST_PROCESS_O)
998
999.java.class:
1000	$(COMPILE.java) $<
1001
1002# Bourne and Korn shell script message catalog build rules.
1003# We extract all gettext strings with sed(1) (being careful to permit
1004# multiple gettext strings on the same line), weed out the dups, and
1005# build the catalogue with awk(1).
1006
1007.sh.po .ksh.po:
1008	$(SED) -n -e ":a" 				\
1009		  -e "h" 					\
1010		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
1011		  -e "x"					\
1012		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
1013		  -e "t a"					\
1014	       $< | sort -u | awk '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1015
1016#
1017# Python and Perl executable and message catalog build rules.
1018#
1019.SUFFIXES: .pl .pm .py .pyc
1020
1021.pl:
1022	$(RM) $@;
1023	$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
1024	$(CHMOD) +x $@
1025
1026.py:
1027	$(RM) $@; $(CAT) $< > $@; $(CHMOD) +x $@
1028
1029.py.pyc:
1030	$(RM) $@
1031	$(PYTHON) -mpy_compile $<
1032	@[ $(<)c = $@ ] || $(MV) $(<)c $@
1033
1034.py.po:
1035	$(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ;
1036
1037.pl.po .pm.po:
1038	$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
1039	$(RM)	$@ ;
1040	$(SED) "/^domain/d" < $(<F).po > $@ ;
1041	$(RM) $(<F).po
1042
1043#
1044# When using xgettext, we want messages to go to the default domain,
1045# rather than the specified one.  This special version of the
1046# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1047# causing xgettext to put all messages into the default domain.
1048#
1049CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1050
1051.c.i:
1052	$(CPPFORPO) $< > $@
1053
1054.h.i:
1055	$(CPPFORPO) $< > $@
1056
1057.y.i:
1058	$(YACC) -d $<
1059	$(CPPFORPO) y.tab.c  > $@
1060	$(RM) y.tab.c
1061
1062.l.i:
1063	$(LEX) $<
1064	$(CPPFORPO) lex.yy.c  > $@
1065	$(RM) lex.yy.c
1066
1067.c.po:
1068	$(CPPFORPO) $< > $<.i
1069	$(BUILD.po)
1070
1071.y.po:
1072	$(YACC) -d $<
1073	$(CPPFORPO) y.tab.c  > $<.i
1074	$(BUILD.po)
1075	$(RM) y.tab.c
1076
1077.l.po:
1078	$(LEX) $<
1079	$(CPPFORPO) lex.yy.c  > $<.i
1080	$(BUILD.po)
1081	$(RM) lex.yy.c
1082
1083#
1084# Rules to perform stylistic checks
1085#
1086.SUFFIXES: .x .xml .check .xmlchk
1087
1088.h.check:
1089	$(DOT_H_CHECK)
1090
1091.x.check:
1092	$(DOT_X_CHECK)
1093
1094.xml.xmlchk:
1095	$(MANIFEST_CHECK)
1096
1097#
1098# Rules to process ONC+ Source partial files
1099#
1100%_onc_plus:	%
1101	@$(ECHO) "extracting code from $< ... "
1102	sed -n -e '/ONC_PLUS EXTRACT START/,/ONC_PLUS EXTRACT END/p' $<  > $@
1103
1104#
1105# Include rules to render automated sccs get rules "safe".
1106#
1107include $(SRC)/Makefile.noget
1108