xref: /illumos-gate/usr/src/Makefile.master (revision 590e0b5da08d7261161e979afc4bf4aa0f543574)
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
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_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.  With Sun Studio this is stabs due to bugs in the Studio
499# compilers.  With GCC this is DWARF v2.
500#
501DEBUGFORMAT=	-_gcc=-gdwarf-2 -_gcc10=-gstrict-dwarf -_gcc14=-gstrict-dwarf
502
503#
504# Ask the compiler to include debugging information
505#
506CCGDEBUG= -g $(DEBUGFORMAT)
507
508#
509# Flags used to build in debug mode for ctf generation.
510#
511CTF_FLAGS_sparc	= $(CCGDEBUG) $(CSTD)
512CTF_FLAGS_i386	= $(CCGDEBUG) $(CSTD)
513
514CTF_FLAGS_sparcv9	= $(CTF_FLAGS_sparc)
515CTF_FLAGS_amd64		= $(CTF_FLAGS_i386) $(SAVEARGS)
516
517CTF_FLAGS_32	= $(CTF_FLAGS_$(MACH))
518CTF_FLAGS_64	= $(CTF_FLAGS_$(MACH64))
519CTF_FLAGS	= $(CTF_FLAGS_32)
520
521#
522# Flags used with genoffsets
523#
524GENOFFSETS_FLAGS = $(CALLSYMS)
525
526OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
527	$(CW) --noecho $(CW_CC_COMPILERS) -- $(GENOFFSETS_FLAGS) \
528	$(CFLAGS) $(CPPFLAGS)
529
530OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
531	$(CW) --noecho $(CW_CC_COMPILERS) -- $(GENOFFSETS_FLAGS) \
532	$(CFLAGS64) $(CPPFLAGS)
533
534# dmake SOURCEDEBUG=yes ... enables source-level debugging information, and
535# avoids stripping it.
536SOURCEDEBUG	= $(POUND_SIGN)
537SRCDBGBLD	= $(SOURCEDEBUG:yes=)
538
539#
540# These variables are intended ONLY for use by developers to safely pass extra
541# flags to the compilers without unintentionally overriding Makefile-set
542# flags.  They should NEVER be set to any value in a Makefile.
543#
544# They come last in the associated FLAGS variable such that they can
545# explicitly override things if necessary, there are gaps in this, but it's
546# the best we can manage.
547#
548CUSERFLAGS		=
549CUSERFLAGS64		= $(CUSERFLAGS)
550CCUSERFLAGS		=
551CCUSERFLAGS64		= $(CCUSERFLAGS)
552
553CSOURCEDEBUGFLAGS	=
554CCSOURCEDEBUGFLAGS	=
555$(SRCDBGBLD)CSOURCEDEBUGFLAGS	= $(CCGDEBUG)
556$(SRCDBGBLD)CCSOURCEDEBUGFLAGS	= $(CCGDEBUG)
557
558CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) \
559		$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) $(CCNOREORDER) \
560		$(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
561		$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
562CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) \
563		$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) $(CCNOREORDER) \
564		$(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
565		$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS64)
566#
567# Flags that are used to build parts of the code that are subsequently
568# run on the build machine (also known as the NATIVE_BUILD).
569#
570NATIVE_CFLAGS=	$(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) \
571		$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) \
572		$(CCNOREORDER) $(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
573		$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
574
575NATIVE_ASFLAGS=	$(NATIVE_CFLAGS)
576
577NATIVE_CCFLAGS=	$(CCOPTFLAG) $($(NATIVE_MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
578		$(CCUSERFLAGS)
579
580NATIVE_CFLAGS64=	$(COPTFLAG64) $($(NATIVE_MACH64)_CFLAGS) \
581		$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) \
582		$(CCNOREORDER) $(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
583		$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS64)
584
585NATIVE_ASFLAGS64=	$(NATIVE_CFLAGS64)
586
587NATIVE_CCFLAGS64=	$(CCOPTFLAG64) $($(NATIVE_MACH64)_CCFLAGS) \
588		$(CCSOURCEDEBUGFLAGS) $(CCUSERFLAGS64)
589
590DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"	# For messaging.
591DTS_ERRNO=-D_TS_ERRNO
592CPPFLAGS.first=	# Please keep empty.  Only lower makefiles should set this.
593CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
594	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
595	$(ADJUNCT_PROTO:%=-I%/usr/include)
596CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
597		$(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
598CPPFLAGS=	$(CPPFLAGS.first) $(CPPFLAGS.master)
599AS_CPPFLAGS=	$(CPPFLAGS.first) $(CPPFLAGS.master)
600JAVAFLAGS=	-source 7 -target 7 -Xlint:deprecation,-options
601$(BLD_JAVA_11)JAVAFLAGS=	-source 7 -target 7 -Xlint:-options
602
603#
604# For source message catalogue
605#
606.SUFFIXES: $(SUFFIXES) .i .po
607MSGROOT= $(ROOT)/catalog
608MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
609MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
610DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
611DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
612
613CLOBBERFILES += $(POFILE) $(POFILES)
614COMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
615XGETTEXT= /usr/bin/xgettext
616XGETFLAGS= -c TRANSLATION_NOTE
617GNUXGETTEXT= /usr/gnu/bin/xgettext
618GNUXGETFLAGS= --add-comments=TRANSLATION_NOTE --keyword=_ \
619	--strict --no-location --omit-header
620BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
621	$(RM)	$@ ;\
622	$(SED) "/^domain/d" < $(<F).po > $@ ;\
623	$(RM) $(<F).po $<.i
624
625#
626# This is overwritten by local Makefile when PROG is a list.
627#
628POFILE= $(PROG).po
629
630sparc_CCFLAGS=		$(sparc_XARCH) $(CCERRWARN)
631sparcv9_CCFLAGS=	$(sparcv9_XARCH) $(CCERRWARN)
632i386_CCFLAGS=		$(i386_XARCH) $(CCERRWARN)
633amd64_CCFLAGS=		$(amd64_XARCH) $(CCERRWARN)
634
635sparc_CCOPTFLAG=	-O
636sparcv9_CCOPTFLAG=	-O
637i386_CCOPTFLAG=		-O
638amd64_CCOPTFLAG=	-O
639
640CCOPTFLAG=	$($(MACH)_CCOPTFLAG)
641CCOPTFLAG64=	$($(MACH64)_CCOPTFLAG)
642CCFLAGS=	$(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
643		$(CCUSERFLAGS)
644CCFLAGS64=	$(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
645		$(CCUSERFLAGS64)
646
647#
648#
649#
650ELFWRAP_FLAGS	=
651ELFWRAP_FLAGS64	=	-64
652
653#
654# Various mapfiles that are used throughout the build, and delivered to
655# /usr/lib/ld.
656#
657MAPFILE.NED_i386 =	$(SRC)/common/mapfiles/common/map.noexdata
658MAPFILE.NED_sparc =
659MAPFILE.NED =		$(MAPFILE.NED_$(MACH))
660MAPFILE.PGA =		$(SRC)/common/mapfiles/common/map.pagealign
661MAPFILE.NES =		$(SRC)/common/mapfiles/common/map.noexstk
662MAPFILE.FLT =		$(SRC)/common/mapfiles/common/map.filter
663MAPFILE.LEX =		$(SRC)/common/mapfiles/common/map.lex.yy
664
665#
666# Generated mapfiles that are compiler specific, and used throughout the
667# build.  These mapfiles are not delivered in /usr/lib/ld.
668#
669MAPFILE.NGB_sparc =	$(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
670MAPFILE.NGB_sparcv9 =	$(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
671MAPFILE.NGB_i386 =	$(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
672MAPFILE.NGB_amd64 =	$(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
673MAPFILE.NGB =		$(MAPFILE.NGB_$(MACH))
674
675#
676# A generic interface mapfile name, used by various dynamic objects to define
677# the interfaces and interposers the object must export.
678#
679MAPFILE.INT =		mapfile-intf
680
681#
682# LDLIBS32 and LDLIBS64 can be set in the environment to override the following
683# assignments.
684#
685LDLIBS32 =	$(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
686LDLIBS32 +=	$(ADJUNCT_PROTO:%=-L%/usr/lib -L%/lib)
687LDLIBS.cmd =	$(LDLIBS32)
688LDLIBS.lib =	$(LDLIBS32)
689
690LDLIBS64 =	$(ENVLDLIBS1:%=%/$(MACH64)) \
691		$(ENVLDLIBS2:%=%/$(MACH64)) \
692		$(ENVLDLIBS3:%=%/$(MACH64))
693LDLIBS64 +=     $(ADJUNCT_PROTO:%=-L%/usr/lib/$(MACH64) -L%/lib/$(MACH64))
694
695#
696# Define compilation macros.
697#
698COMPILE.c=	$(CC) $(CFLAGS) $(CPPFLAGS) -c
699COMPILE64.c=	$(CC) $(CFLAGS64) $(CPPFLAGS) -c
700COMPILE.cc=	$(CCC) $(CCFLAGS) $(CPPFLAGS) -c
701COMPILE64.cc=	$(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
702COMPILE.s=	$(AS) $(ASFLAGS) $(AS_CPPFLAGS) -c
703COMPILE64.s=	$(AS) $(ASFLAGS64) $(AS_CPPFLAGS) -c
704COMPILE.d=	$(DTRACE) -G -32
705COMPILE64.d=	$(DTRACE) -G -64
706COMPILE.b=	$(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
707COMPILE64.b=	$(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
708
709CLASSPATH=	.
710COMPILE.java=	$(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
711
712#
713# Link time macros
714#
715CCNEEDED	= -L$(GCCLIBDIR) -lstdc++ -lgcc_s
716CCEXTNEEDED	= $(CCNEEDED)
717NATIVECCNEEDED	= -R$(NATIVE_GCCLIBDIR) -L$(NATIVE_GCCLIBDIR) -lstdc++ -lgcc_s
718
719CCNEEDED64	= -L$(GCCLIBDIR) -lstdc++ -lgcc_s
720NATIVECCNEEDED64 = -R$(NATIVE_GCCLIBDIR) -L$(NATIVE_GCCLIBDIR) -lstdc++ -lgcc_s
721CCEXTNEEDED	= $(CCNEEDED64)
722
723# Libraries we expect to use natively on the build machine
724NATIVE_LIBS=
725
726LDCHECKS		= $(ZASSERTDEFLIB) $(ZGUIDANCE) $(ZFATALWARNINGS)
727LDCHECKS		+= $(NATIVE_LIBS:%=$(ZASSERTDEFLIB)=%)
728
729LINK.c=			$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LDCHECKS)
730LINK64.c=		$(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS) $(LDCHECKS)
731NORUNPATH=		-nolib
732LINK.cc=		$(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
733			$(LDFLAGS) $(CCNEEDED) $(LDCHECKS)
734LINK64.cc=		$(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
735			$(LDFLAGS) $(CCNEEDED64) $(LDCHECKS)
736
737# For some future builds, NATIVE_MACH and MACH might be different.
738# Therefore, NATIVE_MACH needs to be redefined in the
739# environment as `uname -p` to override this macro.
740#
741# For now at least, we cross-compile amd64 on i386 machines.
742NATIVE_MACH=	$(MACH:amd64=i386)
743NATIVE_MACH64=	$(MACH64)
744
745# Base directory where compilers can be found.  Usually overridden in the
746# environment.
747GNU_ROOT=		/usr
748
749PRIMARY_CC=	gcc10,$(GNUC_ROOT)/bin/gcc,gnu
750PRIMARY_CCC=	gcc10,$(GNUC_ROOT)/bin/g++,gnu
751
752CW_CC_COMPILERS=	$(PRIMARY_CC:%=--primary %) $(SHADOW_CCS:%=--shadow %)
753CW_CCC_COMPILERS=	$(PRIMARY_CCC:%=--primary %) $(SHADOW_CCCS:%=--shadow %)
754
755CW_LINKER=		--linker $(LD)
756
757# Specify platform compiler versions for languages
758# that we use (currently only c and c++).
759#
760CW=			$(ONBLD_TOOLS)/bin/$(MACH)/cw
761NATIVE_CW=		$(ONBLD_TOOLS)/bin/$(MACH)/cw
762
763BUILD_CC=		$(CW) --tag target $(CW_LINKER) $(CW_CC_COMPILERS) --
764BUILD_CCC=		$(CW) --tag target -C $(CW_LINKER) $(CW_CCC_COMPILERS) --
765BUILD_CPP=		/usr/lib/cpp
766BUILD_LD=		$(ONBLD_TOOLS)/bin/$(MACH64)/ld
767BUILD_AS=		$(BUILD_CC)
768
769NATIVEBUILD_CC=		$(NATIVE_CW) --tag native $(CW_LINKER) $(CW_CC_COMPILERS) --
770NATIVEBUILD_CCC=	$(NATIVE_CW) --tag native -C $(CW_LINKER) $(CW_CCC_COMPILERS) --
771NATIVEBUILD_CPP=	/usr/lib/cpp
772NATIVEBUILD_LD=		$(ONBLD_TOOLS)/bin/$(MACH64)/ld
773NATIVEBUILD_AS=		$(NATIVEBUILD_CC)
774
775$(MACH)_CC=		$(BUILD_CC)
776$(MACH)_CCC=		$(BUILD_CCC)
777$(MACH)_CPP=		$(BUILD_CPP)
778$(MACH)_LD=		$(BUILD_LD)
779$(MACH)_AS=		$(BUILD_AS)
780$(MACH64)_CC=		$(BUILD_CC)
781$(MACH64)_CCC=		$(BUILD_CCC)
782$(MACH64)_CPP=		$(BUILD_CPP)
783$(MACH64)_LD=		$(BUILD_LD)
784$(MACH64)_AS=		$(BUILD_AS)
785
786NATIVECC=		$(NATIVEBUILD_CC)
787NATIVECCC=		$(NATIVEBUILD_CCC)
788NATIVECPP=		$(NATIVEBUILD_CPP)
789NATIVEAS=		$(NATIVEBUILD_AS)
790NATIVELD=		$(NATIVEBUILD_LD)
791
792NATIVECC64=		$(NATIVEBUILD_CC)
793NATIVECCC64=		$(NATIVEBUILD_CCC)
794NATIVECPP64=		$(NATIVEBUILD_CPP)
795NATIVEAS64=		$(NATIVEBUILD_AS)
796NATIVELD64=		$(NATIVEBUILD_LD)
797
798#
799# Makefile.master.64 overrides these settings
800#
801CC=			$($(MACH)_CC)
802CCC=			$($(MACH)_CCC)
803CPP=			$($(MACH)_CPP)
804AS=			$($(MACH)_AS)
805LD=			$($(MACH)_LD)
806
807CC64=			$($(MACH64)_CC)
808CCC64=			$($(MACH64)_CCC)
809CPP64=			$($(MACH64)_CPP)
810AS64=			$($(MACH64)_AS)
811LD64=			$($(MACH64)_LD)
812
813# Pass -Y flag to cpp (method of which is release-dependent)
814CCYFLAG=		-Y I,
815
816BDIRECT=	-Wl,-Bdirect
817BDYNAMIC=	-Wl,-Bdynamic
818BLOCAL=		-Wl,-Blocal
819BNODIRECT=	-Wl,-Bnodirect
820BREDUCE=	-Wl,-Breduce
821BSTATIC=	-Wl,-Bstatic
822BSYMBOLIC=	-Wl,-Bsymbolic
823
824ZDEFS=		-Wl,-zdefs
825ZDIRECT=	-Wl,-zdirect
826ZIGNORE=	-Wl,-zignore
827ZINITFIRST=	-Wl,-zinitfirst
828ZINTERPOSE=	-Wl,-zinterpose
829ZLAZYLOAD=	-Wl,-zlazyload
830ZLOADFLTR=	-Wl,-zloadfltr
831ZMULDEFS=	-Wl,-zmuldefs
832ZNODEFAULTLIB=	-Wl,-znodefaultlib
833ZNODEFS=	-Wl,-znodefs
834ZNODELETE=	-Wl,-znodelete
835ZNODLOPEN=	-Wl,-znodlopen
836ZNODUMP=	-Wl,-znodump
837ZNOLAZYLOAD=	-Wl,-znolazyload
838ZNOLDYNSYM=	-Wl,-znoldynsym
839ZNORELOC=	-Wl,-znoreloc
840ZNOVERSION=	-Wl,-znoversion
841ZRECORD=	-Wl,-zrecord
842ZREDLOCSYM=	-Wl,-zredlocsym
843ZTEXT=		-Wl,-ztext
844ZVERBOSE=	-Wl,-zverbose
845ZASSERTDEFLIB=	-Wl,-zassert-deflib
846ZGUIDANCE=	-Wl,-zguidance
847ZFATALWARNINGS=	-Wl,-zfatal-warnings
848ZASLR=		-Wl,-zaslr
849
850GSHARED=	-shared
851CCMT=		-mt
852
853# Handle different PIC models on different ISAs
854# (May be overridden by lower-level Makefiles)
855
856sparc_C_PICFLAGS =	-fpic
857sparcv9_C_PICFLAGS =	-fpic
858i386_C_PICFLAGS =	-fpic
859amd64_C_PICFLAGS =	-fpic
860C_PICFLAGS =		$($(MACH)_C_PICFLAGS)
861C_PICFLAGS64 =		$($(MACH64)_C_PICFLAGS)
862
863sparc_C_BIGPICFLAGS =	-fPIC
864sparcv9_C_BIGPICFLAGS =	-fPIC
865i386_C_BIGPICFLAGS =	-fPIC
866amd64_C_BIGPICFLAGS =	-fPIC
867C_BIGPICFLAGS =		$($(MACH)_C_BIGPICFLAGS)
868C_BIGPICFLAGS64 =	$($(MACH64)_C_BIGPICFLAGS)
869
870# CC requires there to be no space between '-K' and 'pic' or 'PIC'.
871# and does not support -f
872sparc_CC_PICFLAGS =	-_gcc=-fpic
873sparcv9_CC_PICFLAGS =	-_gcc=-fPIC
874i386_CC_PICFLAGS =	-_gcc=-fpic
875amd64_CC_PICFLAGS =	-_gcc=-fpic
876CC_PICFLAGS =		$($(MACH)_CC_PICFLAGS)
877CC_PICFLAGS64 =		$($(MACH64)_CC_PICFLAGS)
878
879AS_PICFLAGS=		$(C_PICFLAGS)
880AS_BIGPICFLAGS=		$(C_BIGPICFLAGS)
881
882#
883# Default label for CTF sections
884#
885CTFCVTFLAGS=		-L VERSION
886
887#
888# Override to pass module-specific flags to ctfmerge.  Currently used only by
889# krtld to turn on fuzzy matching, and source-level debugging to inhibit
890# stripping.
891#
892CTFMRGFLAGS=
893
894CTFCONVERT_O		= $(CTFCONVERT) $(CTFCVTFLAGS) $@
895
896# Rules (normally from make.rules) and macros which are used for post
897# processing files. Normally, these do stripping of the comment section
898# automatically.
899#    RELEASE_CM:	Should be edited to reflect the release.
900#    POST_PROCESS_O:	Post-processing for `.o' files (typically C source)
901#    POST_PROCESS_S_O:	Post-processing for `.o' files built from asssembly
902#    POST_PROCESS_CC_O:	Post-processing for `.o' files built from C++
903#    POST_PROCESS_A:		Post-processing for `.a' files (currently null).
904#    POST_PROCESS_SO:	Post-processing for `.so' files.
905#    POST_PROCESS:	Post-processing for executable files (no suffix).
906#
907# Note that these macros are not completely generalized as they are to be
908# used with the file name to be processed following.
909#
910# It is left as an exercise to Release Engineering to embellish the generation
911# of the release comment string.
912#
913#	If this is a standard development build:
914#		compress the comment section (mcs -c)
915#		add the standard comment (mcs -a $(RELEASE_CM))
916#		add the development specific comment (mcs -a $(DEV_CM))
917#
918#	If this is an installation build:
919#		delete the comment section (mcs -d)
920#		add the standard comment (mcs -a $(RELEASE_CM))
921#		add the development specific comment (mcs -a $(DEV_CM))
922#
923#	If this is an release build:
924#		delete the comment section (mcs -d)
925#		add the standard comment (mcs -a $(RELEASE_CM))
926#
927# The following list of macros are used in the definition of RELEASE_CM
928# which is used to label all binaries in the build:
929#
930#	RELEASE		Specific release of the build, eg: 5.2
931#	RELEASE_MAJOR	Major version number part of $(RELEASE)
932#	RELEASE_MINOR	Minor version number part of $(RELEASE)
933#	VERSION		Version of the build (alpha, beta, Generic)
934#	RELEASE_DATE	Date of the Release Build
935#
936RELEASE_MAJOR=	5
937RELEASE_MINOR=	11
938RELEASE=	$(RELEASE_MAJOR).$(RELEASE_MINOR)
939VERSION=	SunOS Development
940RELEASE_DATE=	release date not set
941RELEASE_CM=	"@($(POUND_SIGN))illumos $(VERSION) $(RELEASE_DATE)"
942DEV_CM_TAIL=	development build: $(LOGNAME)
943DEV_CM=		"@($(POUND_SIGN))illumos $(DEV_CM_TAIL)"
944UTS_LABEL=	$(RELEASE)
945
946#
947# The boot banner may be overridden by distributions.  Up to five lines can be
948# specified by overriding the BOOTBANNER macros, and any line that expands to
949# an empty string will not be printed.  See comments in
950# bootbanner_expand_template() for more details about the template string
951# format.
952#
953BOOTBANNER1=	^o Version ^v ^w-bit
954BOOTBANNER2=
955BOOTBANNER3=
956BOOTBANNER4=
957BOOTBANNER5=
958
959PROCESS_COMMENT=  @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
960$(RELEASE_BUILD)PROCESS_COMMENT=   @?${MCS} -d -a $(RELEASE_CM)
961
962STRIP_STABS=			   $(STRIP) -x $@
963$(SRCDBGBLD)STRIP_STABS=	   :
964PROCESS_CTF=			   :
965
966POST_PROCESS_O=
967POST_PROCESS_S_O=
968POST_PROCESS_CC_O=
969POST_PROCESS_A=
970POST_PROCESS_SO=	$(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
971			$(ELFSIGN_OBJECT)
972POST_PROCESS=		$(PROCESS_COMMENT) $@ ; $(PROCESS_CTF) ; \
973			$(STRIP_STABS) ; $(ELFSIGN_OBJECT)
974
975#
976# PKGARCHIVE specifies the default location where packages should be
977# placed if built.
978#
979$(RELEASE_BUILD)PKGARCHIVESUFFIX=	-nd
980PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
981
982#
983# The repositories will be created with these publisher settings.  To
984# update an image to the resulting repositories, this must match the
985# publisher name provided to "pkg set-publisher."
986#
987PKGPUBLISHER_REDIST=	on-nightly
988PKGPUBLISHER_NONREDIST=	on-extra
989
990# Allow suffix rules like the below for .S as well as .s
991.SUFFIXES: .S
992
993#	Default build rules which perform comment section post-processing.
994#
995.c:
996	$(LINK.c) -o $@ $< $(LDLIBS)
997	$(POST_PROCESS)
998.c.o:
999	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
1000	$(POST_PROCESS_O)
1001.c.a:
1002	$(COMPILE.c) -o $% $<
1003	$(PROCESS_COMMENT) $%
1004	$(AR) $(ARFLAGS) $@ $%
1005	$(RM) $%
1006.s.o:
1007	$(COMPILE.s) -o $@ $<
1008	$(POST_PROCESS_S_O)
1009.s.a:
1010	$(COMPILE.s) -o $% $<
1011	$(PROCESS_COMMENT) $%
1012	$(AR) $(ARFLAGS) $@ $%
1013	$(RM) $%
1014
1015.S.o:
1016	$(COMPILE.s) -o $@ $<
1017	$(POST_PROCESS_S_O)
1018.S.a:
1019	$(COMPILE.s) -o $% $<
1020	$(PROCESS_COMMENT) $%
1021	$(AR) $(ARFLAGS) $@ $%
1022	$(RM) $%
1023.cc:
1024	$(LINK.cc) -o $@ $< $(LDLIBS)
1025	$(POST_PROCESS)
1026.cc.o:
1027	$(COMPILE.cc) $(OUTPUT_OPTION) $<
1028	$(POST_PROCESS_CC_O)
1029.cc.a:
1030	$(COMPILE.cc) -o $% $<
1031	$(AR) $(ARFLAGS) $@ $%
1032	$(PROCESS_COMMENT) $%
1033	$(RM) $%
1034.y:
1035	$(YACC.y) $<
1036	$(LINK.c) -o $@ y.tab.c $(LDLIBS)
1037	$(POST_PROCESS)
1038	$(RM) y.tab.c
1039.y.o:
1040	$(YACC.y) $<
1041	$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
1042	$(POST_PROCESS_O)
1043	$(RM) y.tab.c
1044.l:
1045	$(RM) $*.c
1046	$(LEX.l) $< > $*.c
1047	$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
1048	$(POST_PROCESS)
1049	$(RM) $*.c
1050.l.o:
1051	$(RM) $*.c
1052	$(LEX.l) $< > $*.c
1053	$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
1054	$(POST_PROCESS_O)
1055	$(RM) $*.c
1056
1057.bin.o:
1058	$(COMPILE.b) -o $@ $<
1059	$(POST_PROCESS_O)
1060
1061.java.class:
1062	$(COMPILE.java) $<
1063
1064# Bourne and Korn shell script message catalog build rules.
1065# We extract all gettext strings with sed(1) (being careful to permit
1066# multiple gettext strings on the same line), weed out the dups, and
1067# build the catalogue with awk(1).
1068
1069.sh.po .ksh.po:
1070	$(SED) -n -e ":a"					\
1071		  -e "h"					\
1072		  -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"	\
1073		  -e "x"					\
1074		  -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"	\
1075		  -e "t a"					\
1076	       $< | sort -u | $(AWK) '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
1077
1078#
1079# Python and Perl executable and message catalog build rules.
1080#
1081.SUFFIXES: .pl .pm .py .pyc
1082
1083.pl:
1084	$(RM) $@;
1085	$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
1086	$(CHMOD) +x $@
1087
1088.py:
1089	$(RM) $@; $(SED) \
1090		-e "1s:^\#!@PYTHON@:\#!$(PYSHEBANG):" \
1091		-e "1s:^\#!@TOOLS_PYTHON@:\#!$(TOOLS_PYTHON):" \
1092		< $< > $@; $(CHMOD) +x $@
1093
1094.py.po:
1095	$(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ;
1096
1097.pl.po .pm.po:
1098	$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
1099	$(RM)	$@ ;
1100	$(SED) "/^domain/d" < $(<F).po > $@ ;
1101	$(RM) $(<F).po
1102
1103#
1104# When using xgettext, we want messages to go to the default domain,
1105# rather than the specified one.  This special version of the
1106# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
1107# causing xgettext to put all messages into the default domain.
1108#
1109CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
1110
1111.c.i:
1112	$(CPPFORPO) $< > $@
1113
1114.h.i:
1115	$(CPPFORPO) $< > $@
1116
1117.y.i:
1118	$(YACC) -d $<
1119	$(CPPFORPO) y.tab.c  > $@
1120	$(RM) y.tab.c
1121
1122.l.i:
1123	$(LEX) $<
1124	$(CPPFORPO) lex.yy.c  > $@
1125	$(RM) lex.yy.c
1126
1127.c.po:
1128	$(CPPFORPO) $< > $<.i
1129	$(BUILD.po)
1130
1131.cc.po:
1132	$(CPPFORPO) $< > $<.i
1133	$(BUILD.po)
1134
1135.y.po:
1136	$(YACC) -d $<
1137	$(CPPFORPO) y.tab.c  > $<.i
1138	$(BUILD.po)
1139	$(RM) y.tab.c
1140
1141.l.po:
1142	$(LEX) $<
1143	$(CPPFORPO) lex.yy.c  > $<.i
1144	$(BUILD.po)
1145	$(RM) lex.yy.c
1146
1147#
1148# Rules to perform stylistic checks
1149#
1150.SUFFIXES: .x .xml .check .xmlchk
1151
1152.h.check:
1153	$(DOT_H_CHECK)
1154
1155.x.check:
1156	$(DOT_X_CHECK)
1157
1158.xml.xmlchk:
1159	$(MANIFEST_CHECK)
1160