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