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