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