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