xref: /illumos-gate/usr/src/Makefile.master (revision 21ca3fa0977dd3ad21d619522ac5e57d35b022b1)
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# Copyright (c) 2012 by Delphix. All rights reserved.
25# Copyright 2014 Garrett D'Amore <garrett@damore.org>
26# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
27# Copyright 2015 Gary Mills
28# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
29# Copyright 2016 Toomas Soome <tsoome@me.com>
30# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
31# Copyright 2021 Joyent, Inc.
32# Copyright 2019 RackTop Systems.
33# Copyright 2020 Oxide Computer Company
34# Copyright 2020 Peter Tribble
35#
36
37#
38# Makefile.master, global definitions for system source
39#
40ROOT=		/proto
41
42#
43# Adjunct root, containing an additional proto area to be used for headers
44# and libraries.
45#
46ADJUNCT_PROTO=
47# HAVE_ADJUNCT_PROTO - ADJUNCT_PROTO is set to a non-default value
48# NO_ADJUNCT_PROTO - ADJUNCT_PROTO is unset
49#
50# This works by replacing any value in ADJUNCT_PROTO with POUND_SIGN, which
51# only happens if it has some value, and then setting HAVE_ADJUNCT_PROTO
52# oppositely.
53NO_ADJUNCT_PROTO=$(ADJUNCT_PROTO:%=$(POUND_SIGN))
54$(NO_ADJUNCT_PROTO)HAVE_ADJUNCT_PROTO=$(POUND_SIGN)
55
56#
57# Adjunct for building things that run on the build machine.
58#
59NATIVE_ADJUNCT=	/usr
60
61#
62# Compatibility code for FreeBSD etc.
63#
64COMPAT=	$(SRC)/compat
65CONTRIB= $(SRC)/contrib
66
67#
68# RELEASE_BUILD should be cleared for final release builds.
69# NOT_RELEASE_BUILD is exactly what the name implies.
70#
71# The declaration POUND_SIGN is always '#'. This is needed to get around the
72# make feature that '#' is always a comment delimiter, even when escaped or
73# quoted. We use this macro expansion method to get POUND_SIGN rather than
74# always breaking out a shell because the general case can cause a noticable
75# slowdown in build times when so many Makefiles include Makefile.master.
76#
77# While the majority of users are expected to override the setting below
78# with an env file (via nightly or bldenv), if you aren't building that way
79# (ie, you're using "ws" or some other bootstrapping method) then you need
80# this definition in order to avoid the subshell invocation mentioned above.
81#
82
83PRE_POUND=				pre\#
84POUND_SIGN=				$(PRE_POUND:pre\%=%)
85
86NOT_RELEASE_BUILD=
87RELEASE_BUILD=				$(POUND_SIGN)
88$(RELEASE_BUILD)NOT_RELEASE_BUILD=	$(POUND_SIGN)
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
97# Allow build-time "configuration" to enable or disable some things.
98# The default is POUND_SIGN, meaning "not enabled". If the environment
99# passes in an override like ENABLE_SMB_PRINTING= (empty) that will
100# uncomment things in the lower Makefiles to enable the feature.
101ENABLE_SMB_PRINTING=	$(POUND_SIGN)
102
103# BUILD_TOOLS is the root of all tools including compilers.
104# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
105
106BUILD_TOOLS=		/ws/onnv-tools
107ONBLD_TOOLS=		$(BUILD_TOOLS)/onbld
108
109# define runtime JAVA_HOME, primarily for cmd/pools/poold
110JAVA_HOME=	/usr/java
111# define buildtime JAVA_ROOT
112JAVA_ROOT=	/usr/java
113# Build uses java8 by default.  Pass the variable below set to empty
114# string in the environment to override.
115BLD_JAVA_11=	$(POUND_SIGN)
116
117GNUC_ROOT=	/usr/gcc/10
118GCCLIBDIR=	$(GNUC_ROOT)/lib
119GCCLIBDIR64=	$(GNUC_ROOT)/lib/$(MACH64)
120
121DOCBOOK_XSL_ROOT=	/usr/share/sgml/docbook/xsl-stylesheets
122
123RPCGEN=		$(ONBLD_TOOLS)/bin/$(MACH)/rpcgen
124ELFEXTRACT=	$(ONBLD_TOOLS)/bin/$(MACH)/elfextract
125MBH_PATCH=	$(ONBLD_TOOLS)/bin/$(MACH)/mbh_patch
126BTXLD=		$(ONBLD_TOOLS)/bin/$(MACH)/btxld
127VTFONTCVT=	$(ONBLD_TOOLS)/bin/$(MACH)/vtfontcvt
128# echo(1) and true(1) are specified without absolute paths, so that the shell
129# spawned by make(1) may use the built-in versions.  This is minimally
130# problematic, as the shell spawned by make(1) is known and under control, the
131# only risk being if the shell falls back to $PATH.
132#
133# We specifically want an echo(1) that does interpolation of escape sequences,
134# which ksh93, /bin/sh, and bash will all provide.
135ECHO=		echo
136TRUE=		true
137INS=		$(ONBLD_TOOLS)/bin/$(MACH)/install
138ED=		/usr/bin/ed
139SYMLINK=	/usr/bin/ln -s
140LN=		/usr/bin/ln
141MKDIR=		/usr/bin/mkdir
142CHMOD=		/usr/bin/chmod
143MV=		/usr/bin/mv -f
144RM=		/usr/bin/rm -f
145CUT=		/usr/bin/cut
146NM=		/usr/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
153AWK=		/usr/bin/nawk
154CP=		/usr/bin/cp -f
155MCS=		/usr/bin/mcs
156CAT=            /usr/bin/cat
157ELFDUMP=	/usr/bin/elfdump
158M4=		/usr/bin/m4
159GM4=		/usr/bin/gm4
160STRIP=		/usr/bin/strip
161LEX=		/usr/bin/lex
162FLEX=		/usr/bin/flex
163YACC=		/usr/bin/yacc
164BISON=		/usr/bin/bison
165CPP=		/usr/lib/cpp
166SH=		/usr/bin/sh
167ANSI_CPP=	$(GNUC_ROOT)/bin/cpp
168JAVAC=		$(JAVA_ROOT)/bin/javac
169JAVADOC=	$(JAVA_ROOT)/bin/javadoc
170JAR=		$(JAVA_ROOT)/bin/jar
171CTFCONVERT=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
172CTFDIFF=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfdiff
173CTFMERGE=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
174CTFSTABS=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
175CTFSTRIP=	$(ONBLD_TOOLS)/bin/$(MACH)/ctfstrip
176NDRGEN=		$(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
177GENOFFSETS=	$(ONBLD_TOOLS)/bin/genoffsets
178XREF=		$(ONBLD_TOOLS)/bin/xref
179FIND=		/usr/bin/find
180PERL=		/usr/bin/perl
181PERL_VERSION=	5.10.0
182PERL_PKGVERS=	-510
183PERL_MACH=	i86pc
184$(SPARC_BLD)PERL_MACH=	sun4
185PERL_VARIANT=
186PERL_ARCH=	$(PERL_MACH)-solaris$(PERL_VARIANT)-64int
187PERL_ARCH64=	$(PERL_MACH)-solaris$(PERL_VARIANT)-64
188PYTHON3_VERSION=	3.9
189PYTHON3_PKGVERS=	-39
190PYTHON3_SUFFIX=
191PYTHON3=		/usr/bin/python$(PYTHON3_VERSION)
192# BUILDPY3b should be overridden in the env file in order to build python
193# modules with a secondary python to aid migration between versions.
194BUILDPY3b=		$(POUND_SIGN)
195PYTHON3b_VERSION=	3.5
196PYTHON3b_PKGVERS=	-35
197PYTHON3b_SUFFIX=	m
198#
199$(BUILDPY3b)PYTHON3b=	/usr/bin/python$(PYTHON3b_VERSION)
200TOOLS_PYTHON=		$(PYTHON3)
201SORT=		/usr/bin/sort
202TR=		/usr/bin/tr
203TOUCH=		/usr/bin/touch
204WC=		/usr/bin/wc
205XARGS=		/usr/bin/xargs
206ELFEDIT=	/usr/bin/elfedit
207DTRACE=		/usr/sbin/dtrace -xnolibs
208UNIQ=		/usr/bin/uniq
209TAR=		/usr/bin/tar
210ASTBINDIR=	/usr/ast/bin
211MSGCC=		$(ASTBINDIR)/msgcc
212MSGFMT=		/usr/bin/msgfmt -s
213LCDEF=		$(ONBLD_TOOLS)/bin/$(MACH)/localedef
214TIC=		$(ONBLD_TOOLS)/bin/$(MACH)/tic
215ZIC=		$(ONBLD_TOOLS)/bin/$(MACH)/zic
216OPENSSL=	/usr/bin/openssl
217CPCGEN=		$(ONBLD_TOOLS)/bin/$(MACH)/cpcgen
218GENICONVTBL=	$(ONBLD_TOOLS)/bin/$(MACH)/geniconvtbl
219
220DEFAULT_CONSOLE_COLOR=					\
221	-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_WHITE	\
222	-DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_BLACK
223
224FILEMODE=	644
225DIRMODE=	755
226
227# Declare that nothing should be built in parallel.
228# Individual Makefiles can use the .PARALLEL target to declare otherwise.
229.NO_PARALLEL:
230
231# For stylistic checks
232#
233# Note that the X and C checks are not used at this time and may need
234# modification when they are actually used.
235#
236CSTYLE=		$(ONBLD_TOOLS)/bin/cstyle
237CSTYLE_TAIL=
238HDRCHK=		$(ONBLD_TOOLS)/bin/hdrchk
239HDRCHK_TAIL=
240JSTYLE=		$(ONBLD_TOOLS)/bin/jstyle
241
242DOT_H_CHECK=	\
243	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
244	$(HDRCHK) $< $(HDRCHK_TAIL)
245
246DOT_X_CHECK=	\
247	@$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
248	$(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
249
250DOT_C_CHECK=	\
251	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
252
253MANIFEST_CHECK=	\
254	@$(ECHO) "checking $<"; \
255	SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
256	SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
257	SVCCFG_CONFIGD_PATH=$(SRC)/cmd/svc/configd/svc.configd-native \
258	$(SRC)/cmd/svc/svccfg/svccfg-native validate $<
259
260INS.file=	$(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
261INS.dir=	$(INS) -s -d -m $(DIRMODE) $@
262# installs and renames at once
263#
264INS.rename=	$(INS.file); $(MV) $(@D)/$(<F) $@
265
266# install a link
267INSLINKTARGET=	$<
268INS.link=	$(RM) $@; $(LN) $(INSLINKTARGET) $@
269INS.symlink=	$(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
270
271# The path to python that will be used for the shebang line when installing
272# python scripts to the proto area. This is overridden by makefiles to
273# select to the correct version.
274PYSHEBANG=	$(PYTHON3)
275
276#
277# Python bakes the mtime of the .py file into the compiled .pyc and
278# rebuilds if the baked-in mtime != the mtime of the source file
279# (rather than only if it's less than), thus when installing python
280# files we must make certain to not adjust the mtime of the source
281# (.py) file.
282#
283INS.pyfile=	$(RM) $@; $(SED) \
284		-e "1s:^\#!@PYTHON@:\#!$(PYSHEBANG):" \
285		-e "1s:^\#!@TOOLS_PYTHON@:\#!$(TOOLS_PYTHON):" \
286		< $< > $@; $(CHMOD) $(FILEMODE) $@; $(TOUCH) -r $< $@
287
288# MACH must be set in the shell environment per uname -p on the build host
289# More specific architecture variables should be set in lower makefiles.
290#
291# MACH64 is derived from MACH, and BUILD64 is set to `#' for
292# architectures on which we do not build 64-bit versions.
293# (There are no such architectures at the moment.)
294#
295# Set BUILD64=# in the environment to disable 64-bit amd64
296# builds on i386 machines.
297
298MACH64_1=	$(MACH:sparc=sparcv9)
299MACH64=		$(MACH64_1:i386=amd64)
300
301MACH32_1=	$(MACH:sparc=sparcv7)
302MACH32=		$(MACH32_1:i386=i86)
303
304sparc_BUILD64=
305i386_BUILD64=
306BUILD64=	$($(MACH)_BUILD64)
307
308#
309# C compiler verbose mode. This is so we can enable it globally,
310# but turn it off in the lower level makefiles of things we cannot
311# (or aren't going to) fix.
312#
313CCVERBOSE=		-v
314
315#
316# generate v9 code which tolerates callers using the v7 ABI, for the sake of
317# system calls.
318CC32BITCALLERS=		-_gcc=-massume-32bit-callers
319
320# GCC, especially, is increasingly beginning to auto-inline functions and
321# sadly does so separately not under the general -fno-inline-functions
322# Additionally, we wish to prevent optimisations which cause GCC to clone
323# functions -- in particular, these may cause unhelpful symbols to be
324# emitted instead of function names
325CCNOAUTOINLINE= \
326	-_gcc=-fno-inline-small-functions \
327	-_gcc=-fno-inline-functions-called-once \
328	-_gcc=-fno-ipa-cp \
329	-_gcc=-fno-ipa-icf \
330	-_gcc=-fno-clone-functions
331
332# GCC may put functions in different named sub-sections of .text based on
333# their presumed calling frequency.  At least in the kernel, where we actually
334# deliver relocatable objects, we don't want this to happen.
335#
336# Since at present we don't benefit from this even in userland, we disable it globally,
337# but the application of this may move into usr/src/uts/ in future.
338CCNOREORDER=	-_gcc=-fno-reorder-functions \
339		-_gcc=-fno-reorder-blocks-and-partition
340
341#
342# gcc has a rather aggressive optimization on by default that infers loop
343# bounds based on undefined behavior (!!).  This can lead to some VERY
344# surprising optimizations -- ones that may be technically correct in the
345# strictest sense but also result in incorrect program behavior.  We turn
346# this optimization off, with extreme prejudice.
347#
348CCNOAGGRESSIVELOOPS= -_gcc=-fno-aggressive-loop-optimizations
349
350#
351# gcc has a limit on the maximum size of a function which will be inlined
352# in the presence of the 'inline' keyword; this limit varies between versions
353# of gcc. For consistent output and to ensure that some of the slightly larger
354# functions are inlined as intended, we specify the limit explicitly.
355#
356CCINLINESIZE= -_gcc=--param=max-inline-insns-single=450
357CCWARNINLINE= -_gcc=-Winline
358
359#
360# Options to control which version of stack-protector we enable. This
361# gives us a bit of flexibility and is unfortunately necessary as some
362# modules do not function correctly with our defaults (qede).
363#
364#  o STACKPROTECT_              Sets the appropriate version for the compiler
365#  o STACKPROTECT_strong        Sets us to use strong on all of the
366#                               compilers it supports. This is the same
367#                               as the default.
368#
369#  o STACKPROTECT_none          Disables the stack protector.
370#
371#  o STACKPROTECT_all           Enables it for everything.
372#
373#  o STACKPROTECT_basic         Enables the basic stack protector.
374#
375# -fstack-protector-strong is not available in gcc4 which is why we
376# have per-compiler versions below. These are not added to the default
377# global CFLAGS at this time as it's being incrementally enabled
378# throughout the build.
379#
380STACKPROTECT_           = -_gcc=-fstack-protector-strong
381
382STACKPROTECT_strong     = $(STACKPROTECT_)
383STACKPROTECT_none       =
384STACKPROTECT_all        = -_gcc=-fstack-protector-all
385STACKPROTECT_basic      = -_gcc=-fstack-protector
386
387STACKPROTECT_LD_	= -lssp_ns
388STACKPROTECT_LD_none	=
389STACKPROTECT_LD_all	= $(STACKPROTECT_LD_)
390STACKPROTECT_LD_basic	= $(STACKPROTECT_LD_)
391
392CCSTACKPROTECT= $(STACKPROTECT_$(STACKPROTECT))
393LDSTACKPROTECT= $(STACKPROTECT_LD_$(STACKPROTECT))
394
395#
396# compiler '-xarch' flag. This is here to centralize it and make it
397# overridable for testing.
398sparc_XARCH=	-m32
399sparcv9_XARCH=	-m64
400i386_XARCH=	-m32
401amd64_XARCH=	-m64 -Ui386 -U__i386
402
403#
404# These flags define what we need to be 'standalone' i.e. -not- part
405# of the rather more cosy userland environment.  This basically means
406# the kernel.
407#
408# XX64	future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
409#
410sparc_STAND_FLAGS=	-_gcc=-ffreestanding
411sparcv9_STAND_FLAGS=	-_gcc=-ffreestanding
412# Disabling MMX also disables 3DNow, disabling SSE also disables all later
413# additions to SSE (SSE2, AVX ,etc.)
414NO_SIMD=		-_gcc=-mno-mmx -_gcc=-mno-sse
415i386_STAND_FLAGS=	-_gcc=-ffreestanding $(NO_SIMD)
416amd64_STAND_FLAGS=	-xmodel=kernel $(NO_SIMD)
417
418SAVEARGS=		-Wu,-save_args
419amd64_STAND_FLAGS	+= $(SAVEARGS)
420
421STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
422STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
423
424#
425# turn warnings into errors (C)
426CERRWARN = -errtags=yes -errwarn=%all
427
428CERRWARN += -_gcc=-Wno-missing-braces
429CERRWARN += -_gcc=-Wno-sign-compare
430CERRWARN += -_gcc=-Wno-unknown-pragmas
431CERRWARN += -_gcc=-Wno-unused-parameter
432CERRWARN += -_gcc=-Wno-missing-field-initializers
433
434# Unfortunately, this option can misfire very easily and unfixably.
435CERRWARN +=	-_gcc=-Wno-array-bounds
436
437CNOWARN_UNINIT = -_gcc=-Wno-maybe-uninitialized
438
439CERRWARN += -_smatch=-p=illumos_user
440include $(SRC)/Makefile.smatch
441
442#
443# turn warnings into errors (C++)
444CCERRWARN = -errtags=yes -errwarn=%all
445
446CCERRWARN += -_gcc=-Wno-missing-braces
447CCERRWARN += -_gcc=-Wno-sign-compare
448CCERRWARN += -_gcc=-Wno-unknown-pragmas
449CCERRWARN += -_gcc=-Wno-unused-parameter
450CCERRWARN += -_gcc=-Wno-missing-field-initializers
451
452# C standard
453CSTD_GNU89=	-xc99=%none
454CSTD_GNU99=	-xc99=%all
455CSTD=		$(CSTD_GNU89)
456
457# In most places, assignments to these macros should be appended with +=
458# (CPPFLAGS.first allows values to be prepended to CPPFLAGS).
459sparc_CFLAGS=	$(sparc_XARCH)
460sparcv9_CFLAGS=	$(sparcv9_XARCH) $(CCVERBOSE)
461i386_CFLAGS=	$(i386_XARCH)
462amd64_CFLAGS=	$(amd64_XARCH)
463
464$(MACH)_ASFLAGS=	$($(MACH)_CFLAGS)
465$(MACH64)_ASFLAGS=	$($(MACH64)_CFLAGS)
466
467ASFLAGS=		$($(MACH)_ASFLAGS)
468ASFLAGS64=		$($(MACH64)_ASFLAGS)
469
470#
471sparc_COPTFLAG=		-xO3
472sparcv9_COPTFLAG=	-xO3
473i386_COPTFLAG=		-O
474amd64_COPTFLAG=		-xO3
475
476COPTFLAG= $($(MACH)_COPTFLAG)
477COPTFLAG64= $($(MACH64)_COPTFLAG)
478
479# Sometimes we want all symbols and types in debugging information even
480# if they aren't used.
481CALLSYMS=	-_gcc=-fno-eliminate-unused-debug-symbols \
482		-_gcc=-fno-eliminate-unused-debug-types
483
484#
485# We force the compilers to generate the debugging information best understood
486# by the CTF tools.  With Sun Studio this is stabs due to bugs in the Studio
487# compilers.  With GCC this is DWARF v2.
488#
489DEBUGFORMAT=	-_gcc=-gdwarf-2 -_gcc10=-gstrict-dwarf -_gcc11=-gstrict-dwarf
490
491#
492# Ask the compiler to include debugging information
493#
494CCGDEBUG= -g $(DEBUGFORMAT)
495
496#
497# Flags used to build in debug mode for ctf generation.
498#
499CTF_FLAGS_sparc	= $(CCGDEBUG) $(CSTD)
500CTF_FLAGS_i386	= $(CCGDEBUG) $(CSTD)
501
502CTF_FLAGS_sparcv9	= $(CTF_FLAGS_sparc)
503CTF_FLAGS_amd64		= $(CTF_FLAGS_i386) $(SAVEARGS)
504
505CTF_FLAGS_32	= $(CTF_FLAGS_$(MACH))
506CTF_FLAGS_64	= $(CTF_FLAGS_$(MACH64))
507CTF_FLAGS	= $(CTF_FLAGS_32)
508
509#
510# Flags used with genoffsets
511#
512GENOFFSETS_FLAGS = $(CALLSYMS)
513
514OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
515	$(CW) --noecho $(CW_CC_COMPILERS) -- $(GENOFFSETS_FLAGS) \
516	$(CFLAGS) $(CPPFLAGS)
517
518OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
519	$(CW) --noecho $(CW_CC_COMPILERS) -- $(GENOFFSETS_FLAGS) \
520	$(CFLAGS64) $(CPPFLAGS)
521
522# dmake SOURCEDEBUG=yes ... enables source-level debugging information, and
523# avoids stripping it.
524SOURCEDEBUG	= $(POUND_SIGN)
525SRCDBGBLD	= $(SOURCEDEBUG:yes=)
526
527#
528# These variables are intended ONLY for use by developers to safely pass extra
529# flags to the compilers without unintentionally overriding Makefile-set
530# flags.  They should NEVER be set to any value in a Makefile.
531#
532# They come last in the associated FLAGS variable such that they can
533# explicitly override things if necessary, there are gaps in this, but it's
534# the best we can manage.
535#
536CUSERFLAGS		=
537CUSERFLAGS64		= $(CUSERFLAGS)
538CCUSERFLAGS		=
539CCUSERFLAGS64		= $(CCUSERFLAGS)
540
541CSOURCEDEBUGFLAGS	=
542CCSOURCEDEBUGFLAGS	=
543$(SRCDBGBLD)CSOURCEDEBUGFLAGS	= $(CCGDEBUG)
544$(SRCDBGBLD)CCSOURCEDEBUGFLAGS	= $(CCGDEBUG)
545
546CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) \
547		$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) $(CCNOREORDER) \
548		$(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
549		$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
550CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) \
551		$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) $(CCNOREORDER) \
552		$(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
553		$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS64)
554#
555# Flags that are used to build parts of the code that are subsequently
556# run on the build machine (also known as the NATIVE_BUILD).
557#
558NATIVE_CFLAGS=	$(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) \
559		$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) \
560		$(CCNOREORDER) $(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
561		$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
562
563NATIVE_CCFLAGS=	$(CCOPTFLAG) $($(NATIVE_MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
564		$(CCUSERFLAGS)
565
566NATIVE_CFLAGS64=	$(COPTFLAG64) $($(NATIVE_MACH64)_CFLAGS) \
567		$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) \
568		$(CCNOREORDER) $(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
569		$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS64)
570
571NATIVE_CCFLAGS64=	$(CCOPTFLAG64) $($(NATIVE_MACH64)_CCFLAGS) \
572		$(CCSOURCEDEBUGFLAGS) $(CCUSERFLAGS64)
573
574DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"	# For messaging.
575DTS_ERRNO=-D_TS_ERRNO
576CPPFLAGS.first=	# Please keep empty.  Only lower makefiles should set this.
577CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
578	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
579	$(ADJUNCT_PROTO:%=-I%/usr/include)
580CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
581		$(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
582CPPFLAGS=	$(CPPFLAGS.first) $(CPPFLAGS.master)
583AS_CPPFLAGS=	$(CPPFLAGS.first) $(CPPFLAGS.master)
584JAVAFLAGS=	-source 7 -target 7 -Xlint:deprecation,-options
585$(BLD_JAVA_11)JAVAFLAGS=	-source 7 -target 7 -Xlint:-options
586
587#
588# For source message catalogue
589#
590.SUFFIXES: $(SUFFIXES) .i .po
591MSGROOT= $(ROOT)/catalog
592MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
593MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
594DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
595DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
596
597CLOBBERFILES += $(POFILE) $(POFILES)
598COMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
599XGETTEXT= /usr/bin/xgettext
600XGETFLAGS= -c TRANSLATION_NOTE
601GNUXGETTEXT= /usr/gnu/bin/xgettext
602GNUXGETFLAGS= --add-comments=TRANSLATION_NOTE --keyword=_ \
603	--strict --no-location --omit-header
604BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
605	$(RM)	$@ ;\
606	$(SED) "/^domain/d" < $(<F).po > $@ ;\
607	$(RM) $(<F).po $<.i
608
609#
610# This is overwritten by local Makefile when PROG is a list.
611#
612POFILE= $(PROG).po
613
614sparc_CCFLAGS=		$(sparc_XARCH) $(CCERRWARN)
615sparcv9_CCFLAGS=	$(sparcv9_XARCH) $(CCERRWARN)
616i386_CCFLAGS=		$(i386_XARCH) $(CCERRWARN)
617amd64_CCFLAGS=		$(amd64_XARCH) $(CCERRWARN)
618
619sparc_CCOPTFLAG=	-O
620sparcv9_CCOPTFLAG=	-O
621i386_CCOPTFLAG=		-O
622amd64_CCOPTFLAG=	-O
623
624CCOPTFLAG=	$($(MACH)_CCOPTFLAG)
625CCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
626CCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
627		$(CCUSERFLAGS)
628CCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
629		$(CCUSERFLAGS64)
630
631#
632#
633#
634ELFWRAP_FLAGS	=
635ELFWRAP_FLAGS64	=	-64
636
637#
638# Various mapfiles that are used throughout the build, and delivered to
639# /usr/lib/ld.
640#
641MAPFILE.NED_i386 =	$(SRC)/common/mapfiles/common/map.noexdata
642MAPFILE.NED_sparc =
643MAPFILE.NED =		$(MAPFILE.NED_$(MACH))
644MAPFILE.PGA =		$(SRC)/common/mapfiles/common/map.pagealign
645MAPFILE.NES =		$(SRC)/common/mapfiles/common/map.noexstk
646MAPFILE.FLT =		$(SRC)/common/mapfiles/common/map.filter
647MAPFILE.LEX =		$(SRC)/common/mapfiles/common/map.lex.yy
648
649#
650# Generated mapfiles that are compiler specific, and used throughout the
651# build.  These mapfiles are not delivered in /usr/lib/ld.
652#
653MAPFILE.NGB_sparc =	$(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
654MAPFILE.NGB_sparcv9 =	$(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
655MAPFILE.NGB_i386 =	$(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
656MAPFILE.NGB_amd64 =	$(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
657MAPFILE.NGB =		$(MAPFILE.NGB_$(MACH))
658
659#
660# A generic interface mapfile name, used by various dynamic objects to define
661# the interfaces and interposers the object must export.
662#
663MAPFILE.INT =		mapfile-intf
664
665#
666# LDLIBS32 and LDLIBS64 can be set in the environment to override the following
667# assignments.
668#
669LDLIBS32 =	$(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
670LDLIBS32 +=	$(ADJUNCT_PROTO:%=-L%/usr/lib -L%/lib)
671LDLIBS.cmd =	$(LDLIBS32)
672LDLIBS.lib =	$(LDLIBS32)
673
674LDLIBS64 =	$(ENVLDLIBS1:%=%/$(MACH64)) \
675		$(ENVLDLIBS2:%=%/$(MACH64)) \
676		$(ENVLDLIBS3:%=%/$(MACH64))
677LDLIBS64 +=     $(ADJUNCT_PROTO:%=-L%/usr/lib/$(MACH64) -L%/lib/$(MACH64))
678
679#
680# Define compilation macros.
681#
682COMPILE.c=	$(CC) $(CFLAGS) $(CPPFLAGS) -c
683COMPILE64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) -c
684COMPILE.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
685COMPILE64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
686COMPILE.s=	$(AS) $(ASFLAGS) $(AS_CPPFLAGS) -c
687COMPILE64.s=	$(AS) $(ASFLAGS64) $(AS_CPPFLAGS) -c
688COMPILE.d=	$(DTRACE) -G -32
689COMPILE64.d=	$(DTRACE) -G -64
690COMPILE.b=	$(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
691COMPILE64.b=	$(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
692
693CLASSPATH=	.
694COMPILE.java=	$(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
695
696#
697# Link time macros
698#
699CCNEEDED	= -L$(GCCLIBDIR) -lstdc++ -lgcc_s
700CCEXTNEEDED	= $(CCNEEDED)
701NATIVECCNEEDED	= -R$(GCCLIBDIR) -L$(GCCLIBDIR) -lstdc++ -lgcc_s
702
703CCNEEDED64	= -L$(GCCLIBDIR) -lstdc++ -lgcc_s
704NATIVECCNEEDED64 = -R$(GCCLIBDIR) -L$(GCCLIBDIR) -lstdc++ -lgcc_s
705CCEXTNEEDED	= $(CCNEEDED64)
706
707# Libraries we expect to use natively on the build machine
708NATIVE_LIBS=
709
710LDCHECKS		= $(ZASSERTDEFLIB) $(ZGUIDANCE) $(ZFATALWARNINGS)
711LDCHECKS		+= $(NATIVE_LIBS:%=$(ZASSERTDEFLIB)=%)
712
713LINK.c=			$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LDCHECKS)
714LINK64.c=		$(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS) $(LDCHECKS)
715NORUNPATH=		-nolib
716LINK.cc=		$(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
717			$(LDFLAGS) $(CCNEEDED) $(LDCHECKS)
718LINK64.cc=		$(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
719			$(LDFLAGS) $(CCNEEDED64) $(LDCHECKS)
720
721# For some future builds, NATIVE_MACH and MACH might be different.
722# Therefore, NATIVE_MACH needs to be redefined in the
723# environment as `uname -p` to override this macro.
724#
725# For now at least, we cross-compile amd64 on i386 machines.
726NATIVE_MACH=	$(MACH:amd64=i386)
727NATIVE_MACH64=	$(MACH64)
728
729# Base directory where compilers can be found.  Usually overridden in the
730# environment.
731GNU_ROOT=		/usr
732
733PRIMARY_CC=	gcc10,$(GNUC_ROOT)/bin/gcc,gnu
734PRIMARY_CCC=	gcc10,$(GNUC_ROOT)/bin/g++,gnu
735
736CW_CC_COMPILERS=	$(PRIMARY_CC:%=--primary %) $(SHADOW_CCS:%=--shadow %)
737CW_CCC_COMPILERS=	$(PRIMARY_CCC:%=--primary %) $(SHADOW_CCCS:%=--shadow %)
738
739CW_LINKER=		--linker $(LD)
740
741# Specify platform compiler versions for languages
742# that we use (currently only c and c++).
743#
744CW=			$(ONBLD_TOOLS)/bin/$(MACH)/cw
745
746BUILD_CC=		$(CW) $(CW_LINKER) $(CW_CC_COMPILERS) --
747BUILD_CCC=		$(CW) -C $(CW_LINKER) $(CW_CCC_COMPILERS) --
748BUILD_CPP=		/usr/lib/cpp
749BUILD_LD=		$(ONBLD_TOOLS)/bin/$(MACH64)/ld
750
751$(MACH)_CC=		$(BUILD_CC)
752$(MACH)_CCC=		$(BUILD_CCC)
753$(MACH)_CPP=		$(BUILD_CPP)
754$(MACH)_LD=		$(BUILD_LD)
755$(MACH)_AS=		$(BUILD_CC)
756$(MACH64)_CC=		$(BUILD_CC)
757$(MACH64)_CCC=		$(BUILD_CCC)
758$(MACH64)_CPP=		$(BUILD_CPP)
759$(MACH64)_LD=		$(BUILD_LD)
760$(MACH64)_AS=		$(BUILD_CC)
761
762NATIVECC=		$($(NATIVE_MACH)_CC)
763NATIVECCC=		$($(NATIVE_MACH)_CCC)
764NATIVECPP=		$($(NATIVE_MACH)_CPP)
765NATIVEAS=		$($(NATIVE_MACH)_AS)
766NATIVELD=		$($(NATIVE_MACH)_LD)
767
768NATIVECC64=		$($(NATIVE_MACH64)_CC)
769NATIVECCC64=		$($(NATIVE_MACH64)_CCC)
770NATIVECPP64=		$($(NATIVE_MACH64)_CPP)
771NATIVEAS64=		$($(NATIVE_MACH64)_AS)
772NATIVELD64=		$($(NATIVE_MACH64)_LD)
773
774#
775# Makefile.master.64 overrides these settings
776#
777CC=			$(NATIVECC)
778CCC=			$(NATIVECCC)
779CPP=			$(NATIVECPP)
780AS=			$(NATIVEAS)
781LD=			$(NATIVELD)
782
783CC64=			$(NATIVECC64)
784CCC64=			$(NATIVECCC64)
785CPP64=			$(NATIVECPP64)
786AS64=			$(NATIVEAS64)
787LD64=			$(NATIVELD64)
788
789# Pass -Y flag to cpp (method of which is release-dependent)
790CCYFLAG=		-Y I,
791
792BDIRECT=	-Wl,-Bdirect
793BDYNAMIC=	-Wl,-Bdynamic
794BLOCAL=		-Wl,-Blocal
795BNODIRECT=	-Wl,-Bnodirect
796BREDUCE=	-Wl,-Breduce
797BSTATIC=	-Wl,-Bstatic
798BSYMBOLIC=	-Wl,-Bsymbolic
799
800ZDEFS=		-Wl,-zdefs
801ZDIRECT=	-Wl,-zdirect
802ZIGNORE=	-Wl,-zignore
803ZINITFIRST=	-Wl,-zinitfirst
804ZINTERPOSE=	-Wl,-zinterpose
805ZLAZYLOAD=	-Wl,-zlazyload
806ZLOADFLTR=	-Wl,-zloadfltr
807ZMULDEFS=	-Wl,-zmuldefs
808ZNODEFAULTLIB=	-Wl,-znodefaultlib
809ZNODEFS=	-Wl,-znodefs
810ZNODELETE=	-Wl,-znodelete
811ZNODLOPEN=	-Wl,-znodlopen
812ZNODUMP=	-Wl,-znodump
813ZNOLAZYLOAD=	-Wl,-znolazyload
814ZNOLDYNSYM=	-Wl,-znoldynsym
815ZNORELOC=	-Wl,-znoreloc
816ZNOVERSION=	-Wl,-znoversion
817ZRECORD=	-Wl,-zrecord
818ZREDLOCSYM=	-Wl,-zredlocsym
819ZTEXT=		-Wl,-ztext
820ZVERBOSE=	-Wl,-zverbose
821ZASSERTDEFLIB=	-Wl,-zassert-deflib
822ZGUIDANCE=	-Wl,-zguidance
823ZFATALWARNINGS=	-Wl,-zfatal-warnings
824ZASLR=		-Wl,-zaslr
825
826GSHARED=	-shared
827CCMT=		-mt
828
829# Handle different PIC models on different ISAs
830# (May be overridden by lower-level Makefiles)
831
832sparc_C_PICFLAGS =	-fpic
833sparcv9_C_PICFLAGS =	-fpic
834i386_C_PICFLAGS =	-fpic
835amd64_C_PICFLAGS =	-fpic
836C_PICFLAGS =		$($(MACH)_C_PICFLAGS)
837C_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
838
839sparc_C_BIGPICFLAGS =	-fPIC
840sparcv9_C_BIGPICFLAGS =	-fPIC
841i386_C_BIGPICFLAGS =	-fPIC
842amd64_C_BIGPICFLAGS =	-fPIC
843C_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
844C_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
845
846# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
847# and does not support -f
848sparc_CC_PICFLAGS =	-_gcc=-fpic
849sparcv9_CC_PICFLAGS =	-_gcc=-fPIC
850i386_CC_PICFLAGS =	-_gcc=-fpic
851amd64_CC_PICFLAGS =	-_gcc=-fpic
852CC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
853CC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
854
855AS_PICFLAGS=		$(C_PICFLAGS)
856AS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
857
858#
859# Default label for CTF sections
860#
861CTFCVTFLAGS=		-L VERSION
862
863#
864# Override to pass module-specific flags to ctfmerge.  Currently used only by
865# krtld to turn on fuzzy matching, and source-level debugging to inhibit
866# stripping.
867#
868CTFMRGFLAGS=
869
870CTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
871
872# Rules (normally from make.rules) and macros which are used for post
873# processing files. Normally, these do stripping of the comment section
874# automatically.
875#    RELEASE_CM:	Should be edited to reflect the release.
876#    POST_PROCESS_O:	Post-processing for `.o' files (typically C source)
877#    POST_PROCESS_S_O:	Post-processing for `.o' files built from asssembly
878#    POST_PROCESS_CC_O:	Post-processing for `.o' files built from C++
879#    POST_PROCESS_A:		Post-processing for `.a' files (currently null).
880#    POST_PROCESS_SO:	Post-processing for `.so' files.
881#    POST_PROCESS:	Post-processing for executable files (no suffix).
882#
883# Note that these macros are not completely generalized as they are to be
884# used with the file name to be processed following.
885#
886# It is left as an exercise to Release Engineering to embellish the generation
887# of the release comment string.
888#
889#	If this is a standard development build:
890#		compress the comment section (mcs -c)
891#		add the standard comment (mcs -a $(RELEASE_CM))
892#		add the development specific comment (mcs -a $(DEV_CM))
893#
894#	If this is an installation build:
895#		delete the comment section (mcs -d)
896#		add the standard comment (mcs -a $(RELEASE_CM))
897#		add the development specific comment (mcs -a $(DEV_CM))
898#
899#	If this is an release build:
900#		delete the comment section (mcs -d)
901#		add the standard comment (mcs -a $(RELEASE_CM))
902#
903# The following list of macros are used in the definition of RELEASE_CM
904# which is used to label all binaries in the build:
905#
906#	RELEASE		Specific release of the build, eg: 5.2
907#	RELEASE_MAJOR	Major version number part of $(RELEASE)
908#	RELEASE_MINOR	Minor version number part of $(RELEASE)
909#	VERSION		Version of the build (alpha, beta, Generic)
910#	RELEASE_DATE	Date of the Release Build
911#
912RELEASE_MAJOR=	5
913RELEASE_MINOR=	11
914RELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
915VERSION=	SunOS Development
916RELEASE_DATE=	release date not set
917RELEASE_CM=	"@($(POUND_SIGN))illumos $(VERSION) $(RELEASE_DATE)"
918DEV_CM_TAIL=	development build: $(LOGNAME)
919DEV_CM=		"@($(POUND_SIGN))illumos $(DEV_CM_TAIL)"
920UTS_LABEL=	$(RELEASE)
921
922#
923# The boot banner may be overridden by distributions.  Up to five lines can be
924# specified by overriding the BOOTBANNER macros, and any line that expands to
925# an empty string will not be printed.  See comments in
926# bootbanner_expand_template() for more details about the template string
927# format.
928#
929BOOTBANNER1=	^o Version ^v ^w-bit
930BOOTBANNER2=
931BOOTBANNER3=
932BOOTBANNER4=
933BOOTBANNER5=
934
935PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
936$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
937
938STRIP_STABS=			   $(STRIP) -x $@
939$(SRCDBGBLD)STRIP_STABS=	   :
940PROCESS_CTF=			   :
941
942POST_PROCESS_O=
943POST_PROCESS_S_O=
944POST_PROCESS_CC_O=
945POST_PROCESS_A=
946POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
947			$(ELFSIGN_OBJECT)
948POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(PROCESS_CTF) ; \
949			$(STRIP_STABS) ; $(ELFSIGN_OBJECT)
950
951#
952# PKGARCHIVE specifies the default location where packages should be
953# placed if built.
954#
955$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
956PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
957
958#
959# The repositories will be created with these publisher settings.  To
960# update an image to the resulting repositories, this must match the
961# publisher name provided to "pkg set-publisher."
962#
963PKGPUBLISHER_REDIST=	on-nightly
964PKGPUBLISHER_NONREDIST=	on-extra
965
966# Allow suffix rules like the below for .S as well as .s
967.SUFFIXES: .S
968
969#	Default build rules which perform comment section post-processing.
970#
971.c:
972	$(LINK.c) -o $@ $< $(LDLIBS)
973	$(POST_PROCESS)
974.c.o:
975	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
976	$(POST_PROCESS_O)
977.c.a:
978	$(COMPILE.c) -o $% $<
979	$(PROCESS_COMMENT) $%
980	$(AR) $(ARFLAGS) $@ $%
981	$(RM) $%
982.s.o:
983	$(COMPILE.s) -o $@ $<
984	$(POST_PROCESS_S_O)
985.s.a:
986	$(COMPILE.s) -o $% $<
987	$(PROCESS_COMMENT) $%
988	$(AR) $(ARFLAGS) $@ $%
989	$(RM) $%
990
991.S.o:
992	$(COMPILE.s) -o $@ $<
993	$(POST_PROCESS_S_O)
994.S.a:
995	$(COMPILE.s) -o $% $<
996	$(PROCESS_COMMENT) $%
997	$(AR) $(ARFLAGS) $@ $%
998	$(RM) $%
999.cc:
1000	$(LINK.cc) -o $@ $< $(LDLIBS)
1001	$(POST_PROCESS)
1002.cc.o:
1003	$(COMPILE.cc) $(OUTPUT_OPTION) $<
1004	$(POST_PROCESS_CC_O)
1005.cc.a:
1006	$(COMPILE.cc) -o $% $<
1007	$(AR) $(ARFLAGS) $@ $%
1008	$(PROCESS_COMMENT) $%
1009	$(RM) $%
1010.y:
1011	$(YACC.y) $<
1012	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
1013	$(POST_PROCESS)
1014	$(RM) y.tab.c
1015.y.o:
1016	$(YACC.y) $<
1017	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
1018	$(POST_PROCESS_O)
1019	$(RM) y.tab.c
1020.l:
1021	$(RM) $*.c
1022	$(LEX.l) $< > $*.c
1023	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
1024	$(POST_PROCESS)
1025	$(RM) $*.c
1026.l.o:
1027	$(RM) $*.c
1028	$(LEX.l) $< > $*.c
1029	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
1030	$(POST_PROCESS_O)
1031	$(RM) $*.c
1032
1033.bin.o:
1034	$(COMPILE.b) -o $@ $<
1035	$(POST_PROCESS_O)
1036
1037.java.class:
1038	$(COMPILE.java) $<
1039
1040# Bourne and Korn shell script message catalog build rules.
1041# We extract all gettext strings with sed(1) (being careful to permit
1042# multiple gettext strings on the same line), weed out the dups, and
1043# build the catalogue with awk(1).
1044
1045.sh.po .ksh.po:
1046	$(SED) -n -e ":a"					\
1047		  -e "h"					\
1048		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
1049		  -e "x"					\
1050		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
1051		  -e "t a"					\
1052	       $< | sort -u | $(AWK) '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1053
1054#
1055# Python and Perl executable and message catalog build rules.
1056#
1057.SUFFIXES: .pl .pm .py .pyc
1058
1059.pl:
1060	$(RM) $@;
1061	$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
1062	$(CHMOD) +x $@
1063
1064.py:
1065	$(RM) $@; $(SED) \
1066		-e "1s:^\#!@PYTHON@:\#!$(PYSHEBANG):" \
1067		-e "1s:^\#!@TOOLS_PYTHON@:\#!$(TOOLS_PYTHON):" \
1068		< $< > $@; $(CHMOD) +x $@
1069
1070.py.po:
1071	$(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ;
1072
1073.pl.po .pm.po:
1074	$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
1075	$(RM)	$@ ;
1076	$(SED) "/^domain/d" < $(<F).po > $@ ;
1077	$(RM) $(<F).po
1078
1079#
1080# When using xgettext, we want messages to go to the default domain,
1081# rather than the specified one.  This special version of the
1082# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1083# causing xgettext to put all messages into the default domain.
1084#
1085CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1086
1087.c.i:
1088	$(CPPFORPO) $< > $@
1089
1090.h.i:
1091	$(CPPFORPO) $< > $@
1092
1093.y.i:
1094	$(YACC) -d $<
1095	$(CPPFORPO) y.tab.c  > $@
1096	$(RM) y.tab.c
1097
1098.l.i:
1099	$(LEX) $<
1100	$(CPPFORPO) lex.yy.c  > $@
1101	$(RM) lex.yy.c
1102
1103.c.po:
1104	$(CPPFORPO) $< > $<.i
1105	$(BUILD.po)
1106
1107.cc.po:
1108	$(CPPFORPO) $< > $<.i
1109	$(BUILD.po)
1110
1111.y.po:
1112	$(YACC) -d $<
1113	$(CPPFORPO) y.tab.c  > $<.i
1114	$(BUILD.po)
1115	$(RM) y.tab.c
1116
1117.l.po:
1118	$(LEX) $<
1119	$(CPPFORPO) lex.yy.c  > $<.i
1120	$(BUILD.po)
1121	$(RM) lex.yy.c
1122
1123#
1124# Rules to perform stylistic checks
1125#
1126.SUFFIXES: .x .xml .check .xmlchk
1127
1128.h.check:
1129	$(DOT_H_CHECK)
1130
1131.x.check:
1132	$(DOT_X_CHECK)
1133
1134.xml.xmlchk:
1135	$(MANIFEST_CHECK)
1136