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