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