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