xref: /illumos-gate/usr/src/Makefile.master (revision 7c34a79b137bcbd26ee8292e08e8bf031e93089f)
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 2025 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
185CHECK_TEST_RUNFILES=	$(ONBLD_TOOLS)/bin/check_test_runfiles
186MANLINK=	$(ONBLD_TOOLS)/bin/$(MACH)/manlink
187NDRGEN=		$(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
188GENOFFSETS=	$(ONBLD_TOOLS)/bin/genoffsets
189XREF=		$(ONBLD_TOOLS)/bin/xref
190FIND=		/usr/bin/find
191PERL=		/usr/bin/perl
192PERL_VERSION=	5.10.0
193PERL_PKGVERS=	-510
194PERL_MACH=	i86pc
195$(SPARC_BLD)PERL_MACH=	sun4
196PERL_VARIANT=
197PERL_ARCH=	$(PERL_MACH)-solaris$(PERL_VARIANT)-64int
198PERL_ARCH64=	$(PERL_MACH)-solaris$(PERL_VARIANT)-64
199PYTHON3_VERSION=	3.9
200PYTHON3_PKGVERS=	-39
201PYTHON3_SUFFIX=
202PYTHON3=		/usr/bin/python$(PYTHON3_VERSION)
203# BUILDPY3b should be overridden in the env file in order to build python
204# modules with a secondary python to aid migration between versions.
205BUILDPY3b=		$(POUND_SIGN)
206PYTHON3b_VERSION=	3.5
207PYTHON3b_PKGVERS=	-35
208PYTHON3b_SUFFIX=	m
209#
210$(BUILDPY3b)PYTHON3b=	/usr/bin/python$(PYTHON3b_VERSION)
211TOOLS_PYTHON=		$(PYTHON3)
212SORT=		/usr/bin/sort
213TR=		/usr/bin/tr
214TOUCH=		/usr/bin/touch
215WC=		/usr/bin/wc
216XARGS=		/usr/bin/xargs
217ELFEDIT=	/usr/bin/elfedit
218DTRACE=		/usr/sbin/dtrace -xnolibs
219UNIQ=		/usr/bin/uniq
220TAR=		/usr/bin/tar
221ASTBINDIR=	/usr/ast/bin
222MSGCC=		$(ASTBINDIR)/msgcc
223MSGFMT=		/usr/bin/msgfmt -s
224LCDEF=		$(ONBLD_TOOLS)/bin/$(MACH)/localedef
225TIC=		$(ONBLD_TOOLS)/bin/$(MACH)/tic
226ZIC=		$(ONBLD_TOOLS)/bin/$(MACH)/zic
227OPENSSL=	/usr/bin/openssl
228CPCGEN=		$(ONBLD_TOOLS)/bin/$(MACH)/cpcgen
229GENICONVTBL=	$(ONBLD_TOOLS)/bin/$(MACH)/geniconvtbl
230SVCCONFIGD=	$(ONBLD_TOOLS)/bin/$(MACH)/svc.configd
231SVCCFG=		$(ONBLD_TOOLS)/bin/$(MACH)/svccfg
232
233DEFAULT_CONSOLE_COLOR=					\
234	-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_WHITE	\
235	-DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_BLACK
236
237FILEMODE=	644
238DIRMODE=	755
239
240# Declare that nothing should be built in parallel.
241# Individual Makefiles can use the .PARALLEL target to declare otherwise.
242.NO_PARALLEL:
243
244# For stylistic checks
245#
246# Note that the X and C checks are not used at this time and may need
247# modification when they are actually used.
248#
249CSTYLE=		$(ONBLD_TOOLS)/bin/cstyle
250CSTYLE_TAIL=
251HDRCHK=		$(ONBLD_TOOLS)/bin/hdrchk
252HDRCHK_TAIL=
253JSTYLE=		$(ONBLD_TOOLS)/bin/jstyle
254
255DOT_H_CHECK=	\
256	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
257	$(HDRCHK) $< $(HDRCHK_TAIL)
258
259DOT_X_CHECK=	\
260	@$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
261	$(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
262
263DOT_C_CHECK=	\
264	@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
265
266MANIFEST_CHECK=	\
267	@$(ECHO) "checking $<"; \
268	SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
269	SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
270	SVCCFG_CONFIGD_PATH=$(SVCCONFIGD) \
271	$(SVCCFG) validate $<
272
273INS.file=	$(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
274INS.dir=	$(INS) -s -d -m $(DIRMODE) $@
275# installs and renames at once
276#
277INS.rename=	$(INS.file); $(MV) $(@D)/$(<F) $@
278
279# install a link
280INSLINKTARGET=	$<
281INS.link=	$(RM) $@; $(LN) $(INSLINKTARGET) $@
282INS.symlink=	$(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
283
284# The path to python that will be used for the shebang line when installing
285# python scripts to the proto area. This is overridden by makefiles to
286# select to the correct version.
287PYSHEBANG=	$(PYTHON3)
288
289#
290# Python bakes the mtime of the .py file into the compiled .pyc and
291# rebuilds if the baked-in mtime != the mtime of the source file
292# (rather than only if it's less than), thus when installing python
293# files we must make certain to not adjust the mtime of the source
294# (.py) file.
295#
296INS.pyfile=	$(RM) $@; $(SED) \
297		-e "1s:^\#!@PYTHON@:\#!$(PYSHEBANG):" \
298		-e "1s:^\#!@TOOLS_PYTHON@:\#!$(TOOLS_PYTHON):" \
299		< $< > $@; $(CHMOD) $(FILEMODE) $@; $(TOUCH) -r $< $@
300
301# MACH must be set in the shell environment per uname -p on the build host
302# More specific architecture variables should be set in lower makefiles.
303#
304# MACH64 is derived from MACH, and BUILD64 is set to `#' for
305# architectures on which we do not build 64-bit versions.
306# (There are no such architectures at the moment.)
307#
308# Set BUILD64=# in the environment to disable 64-bit amd64
309# builds on i386 machines.
310
311MACH64_1=	$(MACH:sparc=sparcv9)
312MACH64=		$(MACH64_1:i386=amd64)
313
314MACH32_1=	$(MACH:sparc=sparcv7)
315MACH32=		$(MACH32_1:i386=i86)
316
317sparc_BUILD64=
318i386_BUILD64=
319BUILD64=	$($(MACH)_BUILD64)
320
321#
322# C compiler verbose mode. This is so we can enable it globally,
323# but turn it off in the lower level makefiles of things we cannot
324# (or aren't going to) fix.
325#
326CCVERBOSE=		-v
327
328#
329# generate v9 code which tolerates callers using the v7 ABI, for the sake of
330# system calls.
331CC32BITCALLERS=		-_gcc=-massume-32bit-callers
332
333# GCC, especially, is increasingly beginning to auto-inline functions and
334# sadly does so separately not under the general -fno-inline-functions
335# Additionally, we wish to prevent optimisations which cause GCC to clone
336# functions -- in particular, these may cause unhelpful symbols to be
337# emitted instead of function names
338CCNOAUTOINLINE= \
339	-_gcc=-fno-inline-small-functions \
340	-_gcc=-fno-inline-functions-called-once \
341	-_gcc=-fno-ipa-cp \
342	-_gcc=-fno-ipa-icf \
343	-_gcc=-fno-clone-functions
344
345# GCC may put functions in different named sub-sections of .text based on
346# their presumed calling frequency.  At least in the kernel, where we actually
347# deliver relocatable objects, we don't want this to happen.
348#
349# Since at present we don't benefit from this even in userland, we disable it globally,
350# but the application of this may move into usr/src/uts/ in future.
351CCNOREORDER=	-_gcc=-fno-reorder-functions \
352		-_gcc=-fno-reorder-blocks-and-partition
353
354#
355# gcc has a rather aggressive optimization on by default that infers loop
356# bounds based on undefined behavior (!!).  This can lead to some VERY
357# surprising optimizations -- ones that may be technically correct in the
358# strictest sense but also result in incorrect program behavior.  We turn
359# this optimization off, with extreme prejudice.
360#
361CCNOAGGRESSIVELOOPS= -_gcc=-fno-aggressive-loop-optimizations
362
363#
364# gcc has a limit on the maximum size of a function which will be inlined
365# in the presence of the 'inline' keyword; this limit varies between versions
366# of gcc. For consistent output and to ensure that some of the slightly larger
367# functions are inlined as intended, we specify the limit explicitly.
368#
369CCINLINESIZE= -_gcc=--param=max-inline-insns-single=450
370CCWARNINLINE= -_gcc=-Winline
371
372#
373# Options to control which version of stack-protector we enable. This
374# gives us a bit of flexibility and is unfortunately necessary as some
375# modules do not function correctly with our defaults (qede).
376#
377#  o STACKPROTECT_              Sets the appropriate version for the compiler
378#  o STACKPROTECT_strong        Sets us to use strong on all of the
379#                               compilers it supports. This is the same
380#                               as the default.
381#
382#  o STACKPROTECT_none          Disables the stack protector.
383#
384#  o STACKPROTECT_all           Enables it for everything.
385#
386#  o STACKPROTECT_basic         Enables the basic stack protector.
387#
388# -fstack-protector-strong is not available in gcc4 which is why we
389# have per-compiler versions below. These are not added to the default
390# global CFLAGS at this time as it's being incrementally enabled
391# throughout the build.
392#
393STACKPROTECT_           = -_gcc=-fstack-protector-strong
394
395STACKPROTECT_strong     = $(STACKPROTECT_)
396STACKPROTECT_none       =
397STACKPROTECT_all        = -_gcc=-fstack-protector-all
398STACKPROTECT_basic      = -_gcc=-fstack-protector
399
400STACKPROTECT_LD_	= -lssp_ns
401STACKPROTECT_LD_none	=
402STACKPROTECT_LD_all	= $(STACKPROTECT_LD_)
403STACKPROTECT_LD_basic	= $(STACKPROTECT_LD_)
404
405CCSTACKPROTECT= $(STACKPROTECT_$(STACKPROTECT))
406LDSTACKPROTECT= $(STACKPROTECT_LD_$(STACKPROTECT))
407
408#
409# compiler '-xarch' flag. This is here to centralize it and make it
410# overridable for testing.
411sparc_XARCH=	-m32
412sparcv9_XARCH=	-m64
413i386_XARCH=	-m32
414amd64_XARCH=	-m64 -Ui386 -U__i386
415
416#
417# These flags define what we need to be 'standalone' i.e. -not- part
418# of the rather more cosy userland environment.  This basically means
419# the kernel.
420#
421# XX64	future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
422#
423sparc_STAND_FLAGS=	-_gcc=-ffreestanding
424sparcv9_STAND_FLAGS=	-_gcc=-ffreestanding
425# Disabling MMX also disables 3DNow, disabling SSE also disables all later
426# additions to SSE (SSE2, AVX ,etc.)
427NO_SIMD=		-_gcc=-mno-mmx -_gcc=-mno-sse
428i386_STAND_FLAGS=	-_gcc=-ffreestanding $(NO_SIMD)
429amd64_STAND_FLAGS=	-xmodel=kernel $(NO_SIMD)
430
431SAVEARGS=		-Wu,-save_args
432amd64_STAND_FLAGS	+= $(SAVEARGS)
433
434STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
435STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
436
437#
438# turn warnings into errors (C)
439CERRWARN = -errtags=yes -errwarn=%all
440
441CERRWARN += -_gcc=-Wno-missing-braces
442CERRWARN += -_gcc=-Wno-sign-compare
443CERRWARN += -_gcc=-Wno-unused-parameter
444CERRWARN += -_gcc=-Wno-missing-field-initializers
445
446# Unfortunately, this option can misfire very easily and unfixably.
447CERRWARN +=	-_gcc=-Wno-array-bounds
448
449CNOWARN_UNINIT = -_gcc=-Wno-maybe-uninitialized
450
451CERRWARN += -_smatch=-p=illumos_user
452include $(SRC)/Makefile.smatch
453
454#
455# turn warnings into errors (C++)
456CCERRWARN = -errtags=yes -errwarn=%all
457
458CCERRWARN += -_gcc=-Wno-missing-braces
459CCERRWARN += -_gcc=-Wno-sign-compare
460CCERRWARN += -_gcc=-Wno-unused-parameter
461CCERRWARN += -_gcc=-Wno-missing-field-initializers
462
463# C standard
464CSTD_GNU89=	-xc99=%none
465CSTD_GNU99=	-xc99=%all
466CSTD_GNU17=	-std=gnu17
467CSTD=		$(CSTD_GNU89)
468
469# In most places, assignments to these macros should be appended with +=
470# (CPPFLAGS.first allows values to be prepended to CPPFLAGS).
471sparc_CFLAGS=	$(sparc_XARCH)
472sparcv9_CFLAGS=	$(sparcv9_XARCH) $(CCVERBOSE)
473i386_CFLAGS=	$(i386_XARCH)
474amd64_CFLAGS=	$(amd64_XARCH)
475
476$(MACH)_ASFLAGS=	$($(MACH)_CFLAGS)
477$(MACH64)_ASFLAGS=	$($(MACH64)_CFLAGS)
478
479ASFLAGS=		$($(MACH)_ASFLAGS)
480ASFLAGS64=		$($(MACH64)_ASFLAGS)
481
482#
483sparc_COPTFLAG=		-xO3
484sparcv9_COPTFLAG=	-xO3
485i386_COPTFLAG=		-O
486amd64_COPTFLAG=		-xO3
487
488COPTFLAG= $($(MACH)_COPTFLAG)
489COPTFLAG64= $($(MACH64)_COPTFLAG)
490
491# Sometimes we want all symbols and types in debugging information even
492# if they aren't used.
493CALLSYMS=	-_gcc=-fno-eliminate-unused-debug-symbols \
494		-_gcc=-fno-eliminate-unused-debug-types
495
496#
497# We force the compilers to generate the debugging information best understood
498# by the CTF tools.  Currently this is DWARFv4.
499#
500DEBUGFORMAT=	-_gcc=-gdwarf-4 -_gcc=-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) $(CWOPTS) --tag target $(CW_LINKER) \
763	$(CW_CC_COMPILERS) --
764BUILD_CCC=		$(CW) $(CWOPTS) --tag target -C $(CW_LINKER) \
765	$(CW_CCC_COMPILERS) --
766BUILD_CPP=		/usr/lib/cpp
767BUILD_LD=		$(ONBLD_TOOLS)/bin/$(MACH64)/ld
768BUILD_AS=		$(BUILD_CC)
769
770NATIVEBUILD_CC=		$(NATIVE_CW) $(CWOPTS) --tag native $(CW_LINKER) \
771	$(CW_CC_COMPILERS) --
772NATIVEBUILD_CCC=	$(NATIVE_CW) $(CWOPTS) --tag native -C $(CW_LINKER) \
773	$(CW_CCC_COMPILERS) --
774NATIVEBUILD_CPP=	/usr/lib/cpp
775NATIVEBUILD_LD=		$(ONBLD_TOOLS)/bin/$(MACH64)/ld
776NATIVEBUILD_AS=		$(NATIVEBUILD_CC)
777
778$(MACH)_CC=		$(BUILD_CC)
779$(MACH)_CCC=		$(BUILD_CCC)
780$(MACH)_CPP=		$(BUILD_CPP)
781$(MACH)_LD=		$(BUILD_LD)
782$(MACH)_AS=		$(BUILD_AS)
783$(MACH64)_CC=		$(BUILD_CC)
784$(MACH64)_CCC=		$(BUILD_CCC)
785$(MACH64)_CPP=		$(BUILD_CPP)
786$(MACH64)_LD=		$(BUILD_LD)
787$(MACH64)_AS=		$(BUILD_AS)
788
789NATIVECC=		$(NATIVEBUILD_CC)
790NATIVECCC=		$(NATIVEBUILD_CCC)
791NATIVECPP=		$(NATIVEBUILD_CPP)
792NATIVEAS=		$(NATIVEBUILD_AS)
793NATIVELD=		$(NATIVEBUILD_LD)
794
795NATIVECC64=		$(NATIVEBUILD_CC)
796NATIVECCC64=		$(NATIVEBUILD_CCC)
797NATIVECPP64=		$(NATIVEBUILD_CPP)
798NATIVEAS64=		$(NATIVEBUILD_AS)
799NATIVELD64=		$(NATIVEBUILD_LD)
800
801#
802# Makefile.master.64 overrides these settings
803#
804CC=			$($(MACH)_CC)
805CCC=			$($(MACH)_CCC)
806CPP=			$($(MACH)_CPP)
807AS=			$($(MACH)_AS)
808LD=			$($(MACH)_LD)
809
810CC64=			$($(MACH64)_CC)
811CCC64=			$($(MACH64)_CCC)
812CPP64=			$($(MACH64)_CPP)
813AS64=			$($(MACH64)_AS)
814LD64=			$($(MACH64)_LD)
815
816# Pass -Y flag to cpp (method of which is release-dependent)
817CCYFLAG=		-Y I,
818
819BDIRECT=	-Wl,-Bdirect
820BDYNAMIC=	-Wl,-Bdynamic
821BLOCAL=		-Wl,-Blocal
822BNODIRECT=	-Wl,-Bnodirect
823BREDUCE=	-Wl,-Breduce
824BSTATIC=	-Wl,-Bstatic
825BSYMBOLIC=	-Wl,-Bsymbolic
826
827ZDEFS=		-Wl,-zdefs
828ZDIRECT=	-Wl,-zdirect
829ZIGNORE=	-Wl,-zignore
830ZINITFIRST=	-Wl,-zinitfirst
831ZINTERPOSE=	-Wl,-zinterpose
832ZLAZYLOAD=	-Wl,-zlazyload
833ZLOADFLTR=	-Wl,-zloadfltr
834ZMULDEFS=	-Wl,-zmuldefs
835ZNODEFAULTLIB=	-Wl,-znodefaultlib
836ZNODEFS=	-Wl,-znodefs
837ZNODELETE=	-Wl,-znodelete
838ZNODLOPEN=	-Wl,-znodlopen
839ZNODUMP=	-Wl,-znodump
840ZNOLAZYLOAD=	-Wl,-znolazyload
841ZNOLDYNSYM=	-Wl,-znoldynsym
842ZNORELOC=	-Wl,-znoreloc
843ZNOVERSION=	-Wl,-znoversion
844ZRECORD=	-Wl,-zrecord
845ZREDLOCSYM=	-Wl,-zredlocsym
846ZTEXT=		-Wl,-ztext
847ZVERBOSE=	-Wl,-zverbose
848ZASSERTDEFLIB=	-Wl,-zassert-deflib
849ZGUIDANCE=	-Wl,-zguidance
850ZFATALWARNINGS=	-Wl,-zfatal-warnings
851ZASLR=		-Wl,-zaslr
852
853GSHARED=	-shared
854CCMT=		-mt
855
856# Handle different PIC models on different ISAs
857# (May be overridden by lower-level Makefiles)
858
859sparc_C_PICFLAGS =	-fpic
860sparcv9_C_PICFLAGS =	-fpic
861i386_C_PICFLAGS =	-fpic
862amd64_C_PICFLAGS =	-fpic
863C_PICFLAGS =		$($(MACH)_C_PICFLAGS)
864C_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
865
866sparc_C_BIGPICFLAGS =	-fPIC
867sparcv9_C_BIGPICFLAGS =	-fPIC
868i386_C_BIGPICFLAGS =	-fPIC
869amd64_C_BIGPICFLAGS =	-fPIC
870C_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
871C_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
872
873# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
874# and does not support -f
875sparc_CC_PICFLAGS =	-_gcc=-fpic
876sparcv9_CC_PICFLAGS =	-_gcc=-fPIC
877i386_CC_PICFLAGS =	-_gcc=-fpic
878amd64_CC_PICFLAGS =	-_gcc=-fpic
879CC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
880CC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
881
882AS_PICFLAGS=		$(C_PICFLAGS)
883AS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
884
885#
886# Default label for CTF sections
887#
888CTFCVTFLAGS=		-L VERSION
889
890#
891# Override to pass module-specific flags to ctfmerge.  Currently used only by
892# krtld to turn on fuzzy matching, and source-level debugging to inhibit
893# stripping.
894#
895CTFMRGFLAGS=
896
897CTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
898
899# Rules (normally from make.rules) and macros which are used for post
900# processing files. Normally, these do stripping of the comment section
901# automatically.
902#    RELEASE_CM:	Should be edited to reflect the release.
903#    POST_PROCESS_O:	Post-processing for `.o' files (typically C source)
904#    POST_PROCESS_S_O:	Post-processing for `.o' files built from asssembly
905#    POST_PROCESS_CC_O:	Post-processing for `.o' files built from C++
906#    POST_PROCESS_A:		Post-processing for `.a' files (currently null).
907#    POST_PROCESS_SO:	Post-processing for `.so' files.
908#    POST_PROCESS:	Post-processing for executable files (no suffix).
909#
910# Note that these macros are not completely generalized as they are to be
911# used with the file name to be processed following.
912#
913# It is left as an exercise to Release Engineering to embellish the generation
914# of the release comment string.
915#
916#	If this is a standard development build:
917#		compress the comment section (mcs -c)
918#		add the standard comment (mcs -a $(RELEASE_CM))
919#		add the development specific comment (mcs -a $(DEV_CM))
920#
921#	If this is an installation build:
922#		delete the comment section (mcs -d)
923#		add the standard comment (mcs -a $(RELEASE_CM))
924#		add the development specific comment (mcs -a $(DEV_CM))
925#
926#	If this is an release build:
927#		delete the comment section (mcs -d)
928#		add the standard comment (mcs -a $(RELEASE_CM))
929#
930# The following list of macros are used in the definition of RELEASE_CM
931# which is used to label all binaries in the build:
932#
933#	RELEASE		Specific release of the build, eg: 5.2
934#	RELEASE_MAJOR	Major version number part of $(RELEASE)
935#	RELEASE_MINOR	Minor version number part of $(RELEASE)
936#	VERSION		Version of the build (alpha, beta, Generic)
937#	RELEASE_DATE	Date of the Release Build
938#
939RELEASE_MAJOR=	5
940RELEASE_MINOR=	11
941RELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
942VERSION=	SunOS Development
943RELEASE_DATE=	release date not set
944RELEASE_CM=	"@($(POUND_SIGN))illumos $(VERSION) $(RELEASE_DATE)"
945DEV_CM_TAIL=	development build: $(LOGNAME)
946DEV_CM=		"@($(POUND_SIGN))illumos $(DEV_CM_TAIL)"
947UTS_LABEL=	$(RELEASE)
948
949#
950# The boot banner may be overridden by distributions.  Up to five lines can be
951# specified by overriding the BOOTBANNER macros, and any line that expands to
952# an empty string will not be printed.  See comments in
953# bootbanner_expand_template() for more details about the template string
954# format.
955#
956BOOTBANNER1=	^o Version ^v ^w-bit
957BOOTBANNER2=
958BOOTBANNER3=
959BOOTBANNER4=
960BOOTBANNER5=
961
962PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
963$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
964
965STRIP_STABS=			   $(STRIP) -x $@
966$(SRCDBGBLD)STRIP_STABS=	   :
967PROCESS_CTF=			   :
968
969POST_PROCESS_O=
970POST_PROCESS_S_O=
971POST_PROCESS_CC_O=
972POST_PROCESS_A=
973POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
974			$(ELFSIGN_OBJECT)
975POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(PROCESS_CTF) ; \
976			$(STRIP_STABS) ; $(ELFSIGN_OBJECT)
977
978#
979# PKGARCHIVE specifies the default location where packages should be
980# placed if built.
981#
982$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
983PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
984
985#
986# The repositories will be created with these publisher settings.  To
987# update an image to the resulting repositories, this must match the
988# publisher name provided to "pkg set-publisher."
989#
990PKGPUBLISHER_REDIST=	on-nightly
991PKGPUBLISHER_NONREDIST=	on-extra
992
993# Allow suffix rules like the below for .S as well as .s
994.SUFFIXES: .S
995
996#	Default build rules which perform comment section post-processing.
997#
998.c:
999	$(LINK.c) -o $@ $< $(LDLIBS)
1000	$(POST_PROCESS)
1001.c.o:
1002	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
1003	$(POST_PROCESS_O)
1004.c.a:
1005	$(COMPILE.c) -o $% $<
1006	$(PROCESS_COMMENT) $%
1007	$(AR) $(ARFLAGS) $@ $%
1008	$(RM) $%
1009.s.o:
1010	$(COMPILE.s) -o $@ $<
1011	$(POST_PROCESS_S_O)
1012.s.a:
1013	$(COMPILE.s) -o $% $<
1014	$(PROCESS_COMMENT) $%
1015	$(AR) $(ARFLAGS) $@ $%
1016	$(RM) $%
1017
1018.S.o:
1019	$(COMPILE.s) -o $@ $<
1020	$(POST_PROCESS_S_O)
1021.S.a:
1022	$(COMPILE.s) -o $% $<
1023	$(PROCESS_COMMENT) $%
1024	$(AR) $(ARFLAGS) $@ $%
1025	$(RM) $%
1026.cc:
1027	$(LINK.cc) -o $@ $< $(LDLIBS)
1028	$(POST_PROCESS)
1029.cc.o:
1030	$(COMPILE.cc) $(OUTPUT_OPTION) $<
1031	$(POST_PROCESS_CC_O)
1032.cc.a:
1033	$(COMPILE.cc) -o $% $<
1034	$(AR) $(ARFLAGS) $@ $%
1035	$(PROCESS_COMMENT) $%
1036	$(RM) $%
1037.y:
1038	$(YACC.y) $<
1039	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
1040	$(POST_PROCESS)
1041	$(RM) y.tab.c
1042.y.o:
1043	$(YACC.y) $<
1044	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
1045	$(POST_PROCESS_O)
1046	$(RM) y.tab.c
1047.l:
1048	$(RM) $*.c
1049	$(LEX.l) $< > $*.c
1050	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
1051	$(POST_PROCESS)
1052	$(RM) $*.c
1053.l.o:
1054	$(RM) $*.c
1055	$(LEX.l) $< > $*.c
1056	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
1057	$(POST_PROCESS_O)
1058	$(RM) $*.c
1059
1060.bin.o:
1061	$(COMPILE.b) -o $@ $<
1062	$(POST_PROCESS_O)
1063
1064.java.class:
1065	$(COMPILE.java) $<
1066
1067# Bourne and Korn shell script message catalog build rules.
1068# We extract all gettext strings with sed(1) (being careful to permit
1069# multiple gettext strings on the same line), weed out the dups, and
1070# build the catalogue with awk(1).
1071
1072.sh.po .ksh.po:
1073	$(SED) -n -e ":a"					\
1074		  -e "h"					\
1075		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
1076		  -e "x"					\
1077		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
1078		  -e "t a"					\
1079	       $< | sort -u | $(AWK) '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1080
1081#
1082# Python and Perl executable and message catalog build rules.
1083#
1084.SUFFIXES: .pl .pm .py .pyc
1085
1086.pl:
1087	$(RM) $@;
1088	$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
1089	$(CHMOD) +x $@
1090
1091.py:
1092	$(RM) $@; $(SED) \
1093		-e "1s:^\#!@PYTHON@:\#!$(PYSHEBANG):" \
1094		-e "1s:^\#!@TOOLS_PYTHON@:\#!$(TOOLS_PYTHON):" \
1095		< $< > $@; $(CHMOD) +x $@
1096
1097.py.po:
1098	$(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ;
1099
1100.pl.po .pm.po:
1101	$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
1102	$(RM)	$@ ;
1103	$(SED) "/^domain/d" < $(<F).po > $@ ;
1104	$(RM) $(<F).po
1105
1106#
1107# When using xgettext, we want messages to go to the default domain,
1108# rather than the specified one.  This special version of the
1109# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1110# causing xgettext to put all messages into the default domain.
1111#
1112CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1113
1114.c.i:
1115	$(CPPFORPO) $< > $@
1116
1117.h.i:
1118	$(CPPFORPO) $< > $@
1119
1120.y.i:
1121	$(YACC) -d $<
1122	$(CPPFORPO) y.tab.c  > $@
1123	$(RM) y.tab.c
1124
1125.l.i:
1126	$(LEX) $<
1127	$(CPPFORPO) lex.yy.c  > $@
1128	$(RM) lex.yy.c
1129
1130.c.po:
1131	$(CPPFORPO) $< > $<.i
1132	$(BUILD.po)
1133
1134.cc.po:
1135	$(CPPFORPO) $< > $<.i
1136	$(BUILD.po)
1137
1138.y.po:
1139	$(YACC) -d $<
1140	$(CPPFORPO) y.tab.c  > $<.i
1141	$(BUILD.po)
1142	$(RM) y.tab.c
1143
1144.l.po:
1145	$(LEX) $<
1146	$(CPPFORPO) lex.yy.c  > $<.i
1147	$(BUILD.po)
1148	$(RM) lex.yy.c
1149
1150#
1151# Rules to perform stylistic checks
1152#
1153.SUFFIXES: .x .xml .check .xmlchk
1154
1155.h.check:
1156	$(DOT_H_CHECK)
1157
1158.x.check:
1159	$(DOT_X_CHECK)
1160
1161.xml.xmlchk:
1162	$(MANIFEST_CHECK)
1163