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