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.
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.
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]
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>
32 include $(SRC)/Makefile.cfgparam
35 # Makefile.master, global definitions for system source
40 # Adjunct root, containing an additional proto area to be used for headers
46 # Adjunct for building things that run on the build machine.
51 # RELEASE_BUILD should be cleared for final release builds.
52 # NOT_RELEASE_BUILD is exactly what the name implies.
56 RELEASE_BUILD= $(POUND_SIGN)
57 $(RELEASE_BUILD)NOT_RELEASE_BUILD= $(POUND_SIGN)
58 PATCH_BUILD= $(POUND_SIGN)
60 # SPARC_BLD is '#' for an Intel build.
61 # INTEL_BLD is '#' for a Sparc build.
62 SPARC_BLD_1= $(MACH:i386=$(POUND_SIGN))
63 SPARC_BLD= $(SPARC_BLD_1:sparc=)
64 INTEL_BLD_1= $(MACH:sparc=$(POUND_SIGN))
65 INTEL_BLD= $(INTEL_BLD_1:i386=)
67 # Allow build-time "configuration" to enable or disable some things.
68 # The default is POUND_SIGN, meaning "not enabled".
69 ENABLE_PERL64= $(POUND_SIGN)
71 # BUILD_TOOLS is the root of all tools including compilers.
72 # ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
75 ONBLD_TOOLS= $(BUILD_TOOLS)/onbld
77 GCC_ROOT= /opt/gcc/4.4.4
78 GCCLIBDIR= $(GCC_ROOT)/lib
79 GCCLIBDIR64= $(GCC_ROOT)/lib/$(MACH64)
81 DOCBOOK_XSL_ROOT= /usr/share/sgml/docbook/xsl-stylesheets
83 RPCGEN= /usr/bin/rpcgen
84 STABS= $(ONBLD_TOOLS)/bin/$(MACH)/stabs
85 ELFEXTRACT= $(ONBLD_TOOLS)/bin/$(MACH)/elfextract
86 MBH_PATCH= $(SRCTOP)/tools/mbh_patch/obj/mbh_patch
87 BTXLD= $(ONBLD_TOOLS)/bin/$(MACH)/btxld
88 # echo(1) and true(1) are specified without absolute paths, so that the shell
89 # spawned by make(1) may use the built-in versions. This is minimally
90 # problematic, as the shell spawned by make(1) is known and under control, the
91 # only risk being if the shell falls back to $PATH.
93 # We specifically want an echo(1) that does interpolation of escape sequences,
94 # which ksh93, /bin/sh, and bash will all provide.
98 SYMLINK= /usr/bin/ln -s
100 MKDIR= /usr/bin/mkdir
101 CHMOD= /usr/bin/chmod
108 EGREP= /usr/bin/egrep
109 ELFWRAP= /usr/bin/elfwrap
110 KSH93= /usr/bin/ksh93
116 ELFDUMP= /usr/bin/elfdump
118 STRIP= /usr/bin/strip
124 CTFCONVERT= $(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
125 CTFDIFF= $(ONBLD_TOOLS)/bin/$(MACH)/ctfdiff
126 CTFMERGE= $(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
127 CTFSTABS= $(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
128 CTFSTRIP= $(ONBLD_TOOLS)/bin/$(MACH)/ctfstrip
129 NDRGEN= $(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
130 GENOFFSETS= $(ONBLD_TOOLS)/bin/genoffsets
135 PERL_ARCH= i86pc-solaris-64int
136 PERL_ARCH64= i86pc-solaris-64
137 $(SPARC_BLD)PERL_ARCH= sun4-solaris-64int
138 $(SPARC_BLD)PERL_ARCH64= sun4-solaris-64
141 PYTHON= /usr/bin/python$(PYTHON_VERSION)
143 TOUCH= /usr/bin/touch
145 XARGS= /usr/bin/xargs
146 ELFEDIT= /usr/bin/elfedit
147 DTRACE= /usr/sbin/dtrace -xnolibs
150 ASTBINDIR= /usr/ast/bin
151 MSGCC= $(ASTBINDIR)/msgcc
152 MSGFMT= /usr/bin/msgfmt -s
157 # Declare that nothing should be built in parallel.
158 # Individual Makefiles can use the .PARALLEL target to declare otherwise.
161 # For stylistic checks
163 # Note that the X and C checks are not used at this time and may need
164 # modification when they are actually used.
166 CSTYLE= $(ONBLD_TOOLS)/bin/cstyle
168 HDRCHK= $(ONBLD_TOOLS)/bin/hdrchk
172 @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
173 $(HDRCHK) $< $(HDRCHK_TAIL)
176 @$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
177 $(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
180 @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
183 @$(ECHO) "checking $<"; \
184 SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
185 SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
186 SVCCFG_CONFIGD_PATH=$(SRC)/cmd/svc/configd/svc.configd-native \
187 $(SRC)/cmd/svc/svccfg/svccfg-native validate $<
189 INS.file= $(INS) -m $(FILEMODE) $< $@
190 INS.dir= $(INS) -d -m $(DIRMODE) $@
191 # installs and renames at once
193 INS.rename= $(INS.file)
197 INS.link= $(RM) $@; $(LN) $(INSLINKTARGET) $@
198 INS.symlink= $(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
201 # Python bakes the mtime of the .py file into the compiled .pyc and
202 # rebuilds if the baked-in mtime != the mtime of the source file
203 # (rather than only if it's less than), thus when installing python
204 # files we must make certain to not adjust the mtime of the source
207 INS.pyfile= $(RM) $@; $(SED) -e "1s:^\#!@PYTHON@:\#!$(PYTHON):" < $< > $@; $(CHMOD) $(FILEMODE) $@; $(TOUCH) -r $< $@
209 # MACH must be set in the shell environment per uname -p on the build host
210 # More specific architecture variables should be set in lower makefiles.
212 # MACH64 is derived from MACH, and BUILD64 is set to `#' for
213 # architectures on which we do not build 64-bit versions.
214 # (There are no such architectures at the moment.)
216 # Set BUILD64=# in the environment to disable 64-bit amd64
217 # builds on i386 machines.
219 MACH64_1= $(MACH:sparc=sparcv9)
220 MACH64= $(MACH64_1:i386=amd64)
222 MACH32_1= $(MACH:sparc=sparcv7)
223 MACH32= $(MACH32_1:i386=i86)
227 BUILD64= $($(MACH)_BUILD64)
230 # generate 32-bit addresses in the v9 kernel. Saves memory.
231 CCABS32= -fno-pic -mcmodel=medlow
233 # generate v9 code which tolerates callers using the v7 ABI, for the sake of
235 CC32BITCALLERS= -massume-32bit-callers
237 # GCC, especially, is increasingly beginning to auto-inline functions and
238 # sadly does so separately not under the general -fno-inline-functions
239 # Additionally, we wish to prevent optimisations which cause GCC to clone
240 # functions -- in particular, these may cause unhelpful symbols to be
241 # emitted instead of function names
242 CCNOAUTOINLINE= -fno-inline-small-functions \
243 -fno-inline-functions-called-once \
247 # compiler architecture flags.
249 sparc_XARCH= -m32 -mcpu=v8 -mno-v8plus
250 sparcv9_XARCH= -m64 -mcpu=v9
251 i386_XARCH= -m32 -march=pentiumpro
252 amd64_XARCH= -m64 -Ui386 -U__i386 -mtune=opteron
254 # assembler architecture flags. Different from compiler architecture flags.
255 sparc_AS_XARCH= -xarch=v8plus -Dsparc -D__sparc -D__sparcv8
256 sparcv9_AS_XARCH= -xarch=v9 -Dsparc -D__sparc -D__sparcv9
257 i386_AS_XARCH= -m32 -Di386 -D__i386
258 amd64_AS_XARCH= -m64 -Ui386 -U__i386 -D__x86_64 -D__amd64
261 # These flags define what we need to be 'standalone' i.e. -not- part
262 # of the rather more cosy userland environment. This basically means
265 # XX64 future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
267 sparc_STAND_FLAGS= -ffreestanding
268 sparcv9_STAND_FLAGS= -ffreestanding
269 # Disabling MMX also disables 3DNow, disabling SSE also disables all later
270 # additions to SSE (SSE2, AVX ,etc.)
271 NO_SIMD= -mno-mmx -mno-sse
272 i386_STAND_FLAGS= -ffreestanding $(NO_SIMD)
273 amd64_STAND_FLAGS= -ffreestanding -mno-red-zone \
274 -mcmodel=kernel $(NO_SIMD)
276 SAVEARGS= -msave-args
277 amd64_STAND_FLAGS += $(SAVEARGS)
279 STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
280 STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
283 # turn warnings into errors (C)
284 CERRWARN = -Wall -Wextra -Werror
286 CERRWARN += -Wno-missing-braces
287 CERRWARN += -Wno-sign-compare
288 CERRWARN += -Wno-unknown-pragmas
289 CERRWARN += -Wno-unused-parameter
290 CERRWARN += -Wno-missing-field-initializers
292 # Unfortunately, this option can misfire very easily and unfixably.
293 CERRWARN += -Wno-array-bounds
295 # DEBUG v. -nd make for frequent unused variables, empty conditions, etc. in
297 $(RELEASE_BUILD)CERRWARN += -Wno-unused
298 $(RELEASE_BUILD)CERRWARN += -Wno-empty-body
301 # turn warnings into errors (C++)
305 C99_ENABLE= -std=gnu99
306 C99_DISABLE= -std=gnu89
307 C99MODE= $(C99_DISABLE)
309 # In most places, assignments to these macros should be appended with +=
310 # (CPPFLAGS.first allows values to be prepended to CPPFLAGS).
311 sparc_CFLAGS= $(sparc_XARCH)
312 sparcv9_CFLAGS= $(sparcv9_XARCH)
313 i386_CFLAGS= $(i386_XARCH)
314 amd64_CFLAGS= $(amd64_XARCH)
316 sparc_ASFLAGS= $(sparc_AS_XARCH)
317 sparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
318 i386_ASFLAGS= $(i386_AS_XARCH)
319 amd64_ASFLAGS= $(amd64_AS_XARCH)
322 sparc_COPTFLAG= -fno-strict-aliasing \
323 -fno-unit-at-a-time \
324 -fno-optimize-sibling-calls \
326 sparcv9_COPTFLAG= -fno-strict-aliasing \
327 -fno-unit-at-a-time \
328 -fno-optimize-sibling-calls \
331 amd64_COPTFLAG= -fno-strict-aliasing \
332 -fno-unit-at-a-time \
333 -fno-optimize-sibling-calls \
336 COPTFLAG= $($(MACH)_COPTFLAG)
337 COPTFLAG64= $($(MACH64)_COPTFLAG)
339 # Sometimes we want all symbols and types in debugging information even
340 # if they aren't used.
341 CALLSYMS= -fno-eliminate-unused-debug-symbols \
342 -fno-eliminate-unused-debug-types
345 # Flags used to build in debug mode for ctf generation. Bugs in the Devpro
346 # compilers currently prevent us from building with cc-emitted DWARF.
348 CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(C99MODE) $(CDWARFSTR)
349 CTF_FLAGS_i386 = -g $(C99MODE) $(CDWARFSTR)
351 CTF_FLAGS_sparcv9 = $(CTF_FLAGS_sparc)
352 CTF_FLAGS_amd64 = $(CTF_FLAGS_i386)
354 CTF_FLAGS_amd64 += $(SAVEARGS)
356 CTF_FLAGS_32 = $(CTF_FLAGS_$(MACH))
357 CTF_FLAGS_64 = $(CTF_FLAGS_$(MACH64))
358 CTF_FLAGS = $(CTF_FLAGS_32)
361 # Flags used with genoffsets
363 GOFLAGS = $(CALLSYMS) \
366 OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
367 $(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
369 OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
370 $(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
372 sparc_XREGSFLAG = -mno-app-regs
373 sparcv9_XREGSFLAG = -mno-app-regs
377 XREGSFLAG = $($(MACH)_XREGSFLAG)
378 XREGSFLAG64 = $($(MACH64)_XREGSFLAG)
380 # dmake SOURCEDEBUG=yes ... enables source-level debugging information, and
381 # avoids stripping it.
382 SOURCEDEBUG = $(POUND_SIGN)
383 SRCDBGBLD = $(SOURCEDEBUG:yes=)
386 # These variables are intended ONLY for use by developers to safely pass extra
387 # flags to the compilers without unintentionally overriding Makefile-set
388 # flags. They should NEVER be set to any value in a Makefile.
390 # They come last in the associated FLAGS variable such that they can
391 # explicitly override things if necessary, there are gaps in this, but it's
392 # the best we can manage.
395 CUSERFLAGS64 = $(CUSERFLAGS)
397 CCUSERFLAGS64 = $(CCUSERFLAGS)
401 $(SRCDBGBLD)CSOURCEDEBUGFLAGS = -g
402 $(SRCDBGBLD)CCSOURCEDEBUGFLAGS = -g
404 CFLAGS= $(COPTFLAG) $($(MACH)_CFLAGS) \
405 $(CERRWARN) $(C99MODE) \
406 $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
408 CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) \
409 $(CERRWARN) $(C99MODE) \
410 $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
414 # Flags that are used to build parts of the code that are subsequently
415 # run on the build machine (also known as the NATIVE_BUILD).
417 NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) \
418 $(CERRWARN) $(C99MODE) \
420 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
422 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" # For messaging.
423 CPPFLAGS.first= # Please keep empty. Only lower makefiles should set this.
424 CPPFLAGS.master=$(DTEXTDOM) \
425 $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
426 $(ADJUNCT_PROTO:%=-I%/usr/include)
427 CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
428 $(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
429 CPPFLAGS= $(CPPFLAGS.first) $(CPPFLAGS.master)
430 AS_CPPFLAGS= $(CPPFLAGS.first) $(CPPFLAGS.master)
433 # For source message catalogue
435 .SUFFIXES: $(SUFFIXES) .i .po
436 MSGROOT= $(ROOT)/catalog
437 MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
438 MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
439 DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
440 DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
442 CLOBBERFILES += $(POFILE) $(POFILES)
443 COMPILE.cpp= $(CC) -xc -E -C $(CFLAGS) $(CPPFLAGS)
444 XGETTEXT= /usr/bin/xgettext
445 XGETFLAGS= -c TRANSLATION_NOTE
446 BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
448 $(SED) "/^domain/d" < $(<F).po > $@ ;\
452 # This is overwritten by local Makefile when PROG is a list.
456 sparc_CCFLAGS= -m32 mcpu=v8 mno-v8plus \
459 sparcv9_CCFLAGS= $(sparcv9_XARCH) \
461 i386_CCFLAGS= $(CCERRWARN)
462 amd64_CCFLAGS= $(amd64_XARCH) \
466 sparcv9_CCOPTFLAG= -O
470 CCOPTFLAG= $($(MACH)_CCOPTFLAG)
471 CCOPTFLAG64= $($(MACH64)_CCOPTFLAG)
472 CCFLAGS= $(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
474 CCFLAGS64= $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
481 ELFWRAP_FLAGS64 = -64
484 # Various mapfiles that are used throughout the build, and delivered to
487 MAPFILE.PGA = $(SRC)/common/mapfiles/common/map.pagealign
488 MAPFILE.FLT = $(SRC)/common/mapfiles/common/map.filter
489 MAPFILE.LEX = $(SRC)/common/mapfiles/common/map.lex.yy
492 # Generated mapfiles that are compiler specific, and used throughout the
493 # build. These mapfiles are not delivered in /usr/lib/ld.
495 MAPFILE.NGB_sparc= $(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
496 MAPFILE.NGB_sparcv9= $(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
497 MAPFILE.NGB_i386= $(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
498 MAPFILE.NGB_amd64= $(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
499 MAPFILE.NGB = $(MAPFILE.NGB_$(MACH))
502 # A generic interface mapfile name, used by various dynamic objects to define
503 # the interfaces and interposers the object must export.
505 MAPFILE.INT = mapfile-intf
508 # LDLIBS32 and LDLIBS64 can be set in the environment to override the following
511 LDLIBS32 = $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
512 LDLIBS32 += $(ADJUNCT_PROTO:%=-L%/usr/lib -L%/lib)
513 LDLIBS.cmd = $(LDLIBS32)
514 LDLIBS.lib = $(LDLIBS32)
516 LDLIBS64 = $(ENVLDLIBS1:%=%/$(MACH64)) \
517 $(ENVLDLIBS2:%=%/$(MACH64)) \
518 $(ENVLDLIBS3:%=%/$(MACH64))
519 LDLIBS64 += $(ADJUNCT_PROTO:%=-L%/usr/lib/$(MACH64) -L%/lib/$(MACH64))
522 # Define compilation macros.
524 COMPILE.c= $(CC) $(CFLAGS) $(CPPFLAGS) -c
525 COMPILE64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) -c
526 COMPILE.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) -c
527 COMPILE64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
528 COMPILE.s= $(AS) $(ASFLAGS) $(AS_CPPFLAGS)
529 COMPILE64.s= $(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
530 COMPILE.d= $(DTRACE) -G -32
531 COMPILE64.d= $(DTRACE) -G -64
532 COMPILE.b= $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
533 COMPILE64.b= $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
538 CCNEEDED = -L$(GCCLIBDIR) -lstdc++ -lgcc_s
539 CCEXTNEEDED = $(CCNEEDED)
541 LINK.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
542 LINK64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
543 LINK.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) \
544 $(LDFLAGS) $(CCNEEDED)
545 LINK64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) \
546 $(LDFLAGS) $(CCNEEDED)
550 # For some future builds, NATIVE_MACH and MACH might be different.
551 # Therefore, NATIVE_MACH needs to be redefined in the
552 # environment as `uname -p` to override this macro.
554 # For now at least, we cross-compile amd64 on i386 machines.
555 NATIVE_MACH= $(MACH:amd64=i386)
557 # Define native compilation macros
560 # Base directory where compilers are located.
561 # Defined here so it can be overridden by developers.
565 BASIC_CC_ARGS= -fident \
567 -fno-inline-functions \
570 -fdiagnostics-show-option \
573 # The SPARC ldd and std instructions require 8-byte alignment of their
574 # address operand. gcc correctly uses them only when the ABI requires
575 # 8-byte alignment; unfortunately we have a number of pieces of buggy code
576 # that does not conform to the ABI. This flag makes gcc work more like
577 # Studio with -xmemalign=4.
578 $(SPARC_BLD)BASIC_CC_ARGS += mno-integer-ldd-std
580 BASIC_CC_ARGS += -D__sun
582 BASIC_AS_ARGS= -x assembler-with-cpp \
585 -Wa,--fatal-warnings \
586 -Wa,--traditional-format \
589 # Specify platform compiler versions for languages
590 # that we use (currently only c and c++).
592 sparc_CC= $(SRC)/tools/scripts/gcc-wrap.sh $(GCC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
593 sparc_CCC= $(SRC)/tools/scripts/gcc-wrap.sh $(GCC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
594 sparc_CPP= $(GCC_ROOT)/bin/cpp
595 sparc_AS= /usr/bin/as -xregsym=no
596 sparc_LD= /usr/bin/ld
598 sparcv9_CC= $(SRC)/tools/scripts/gcc-wrap.sh $(GCC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
599 sparcv9_CCC= $(SRC)/tools/scripts/gcc-wrap.sh $(GCC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
600 sparcv9_CPP= $(GCC_ROOT)/bin/cpp
601 sparcv9_AS= /usr/bin/as -xregsym=no
602 sparcv9_LD= /usr/bin/ld
604 i386_CC= $(SRC)/tools/scripts/gcc-wrap.sh $(GCC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
605 i386_CCC= $(SRC)/tools/scripts/gcc-wrap.sh $(GCC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
606 i386_CPP= $(GCC_ROOT)/bin/cpp
607 i386_AS= $(GCC_ROOT)/bin/gcc $(BASIC_AS_ARGS)
610 amd64_CC= $(SRC)/tools/scripts/gcc-wrap.sh $(GCC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
611 amd64_CCC= $(SRC)/tools/scripts/gcc-wrap.sh $(GCC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
612 amd64_CPP= $(GCC_ROOT)/bin/cpp
613 amd64_AS= $(GCC_ROOT)/bin/gcc $(BASIC_AS_ARGS)
614 amd64_LD= /usr/bin/ld
616 NATIVECC= $($(NATIVE_MACH)_CC)
617 NATIVECCC= $($(NATIVE_MACH)_CCC)
618 NATIVECPP= $($(NATIVE_MACH)_CPP)
619 NATIVEAS= $($(NATIVE_MACH)_AS)
620 NATIVELD= $($(NATIVE_MACH)_LD)
623 # Makefile.master.64 overrides these settings
634 LD_BDYNAMIC= -Bdynamic
636 LD_BNODIRECT= -Bnodirect
640 BDIRECT= $(LD_BDIRECT:%=-Wl,%)
641 BDYNAMIC= $(LD_BDYNAMIC:%=-Wl,%)
642 BLOCAL= $(LD_BLOCAL:%=-Wl,%)
643 BNODIRECT= $(LD_BNODIRECT:%=-Wl,%)
644 BREDUCE= $(LD_BREDUCE:%=-Wl,%)
645 BSTATIC= $(LD_BSTATIC:%=-Wl,%)
650 LD_ZINITFIRST= -zinitfirst
651 LD_ZINTERPOSE= -zinterpose
652 LD_ZLAZYLOAD= -zlazyload
653 LD_ZLOADFLTR= -zloadfltr
655 LD_ZNODELETE= -znodelete
656 LD_ZNODLOPEN= -znodlopen
658 LD_ZNOLAZYLOAD= -znolazyload
659 LD_ZNOLDYNSYM= -znoldynsym
660 LD_ZNORELOC= -znoreloc
661 LD_ZNOVERSION= -znoversion
665 ZDEFS= $(LD_ZDEFS:%=-Wl,%)
666 ZDIRECT= $(LD_ZDIRECT:%=-Wl,%)
667 ZIGNORE= $(LD_ZIGNORE:%=-Wl,%)
668 ZINITFIRST= $(LD_ZINITFIRST:%=-Wl,%)
669 ZINTERPOSE= $(LD_ZINTERPOSE:%=-Wl,%)
670 ZLAZYLOAD= $(LD_ZLAZYLOAD:%=-Wl,%)
671 ZLOADFLTR= $(LD_ZLOADFLTR:%=-Wl,%)
672 ZNODEFS= $(LD_ZNODEFS:%=-Wl,%)
673 ZNODELETE= $(LD_ZNODELETE:%=-Wl,%)
674 ZNODLOPEN= $(LD_ZNODLOPEN:%=-Wl,%)
675 ZNODUMP= $(LD_ZNODUMP:%=-Wl,%)
676 ZNOLAZYLOAD= $(LD_ZNOLAZYLOAD:%=-Wl,%)
677 ZNOLDYNSYM= $(LD_ZNOLDYNSYM:%=-Wl,%)
678 NORELOC= $(LD_ZNORELOC:%=-Wl,%)
679 ZNOVERSION= $(LD_ZNOVERSION:%=-Wl,%)
680 ZRECORD= $(LD_ZRECORD:%=-Wl,%)
681 ZTEXT= $(LD_ZTEXT:%=-Wl,%)
685 # Handle different PIC models on different ISAs
686 # (May be overridden by lower-level Makefiles)
688 sparc_C_PICFLAGS = -fpic
689 sparcv9_C_PICFLAGS = -fpic
690 i386_C_PICFLAGS = -fpic
691 amd64_C_PICFLAGS = -fpic
692 C_PICFLAGS = $($(MACH)_C_PICFLAGS)
693 C_PICFLAGS64 = $($(MACH64)_C_PICFLAGS)
695 sparc_C_BIGPICFLAGS = -fPIC
696 sparcv9_C_BIGPICFLAGS = -fPIC
697 i386_C_BIGPICFLAGS = -fPIC
698 amd64_C_BIGPICFLAGS = -fPIC
699 C_BIGPICFLAGS = $($(MACH)_C_BIGPICFLAGS)
700 C_BIGPICFLAGS64 = $($(MACH64)_C_BIGPICFLAGS)
702 # CC requires there to be no space between '-K' and 'pic' or 'PIC'.
703 sparc_CC_PICFLAGS = -fpic
704 sparcv9_CC_PICFLAGS = -fPIC
705 i386_CC_PICFLAGS = -fpic
706 amd64_CC_PICFLAGS = -fpic
707 CC_PICFLAGS = $($(MACH)_CC_PICFLAGS)
708 CC_PICFLAGS64 = $($(MACH64)_CC_PICFLAGS)
714 # Default label for CTF sections
716 CTFCVTFLAGS= -i -L VERSION
719 # Override to pass module-specific flags to ctfmerge. Currently used only by
720 # krtld to turn on fuzzy matching, and source-level debugging to inhibit
725 CTFCONVERT_O = $(CTFCONVERT) $(CTFCVTFLAGS) $@
727 # Rules (normally from make.rules) and macros which are used for post
728 # processing files. Normally, these do stripping of the comment section
730 # RELEASE_CM: Should be editted to reflect the release.
731 # POST_PROCESS_O: Post-processing for `.o' files.
732 # POST_PROCESS_A: Post-processing for `.a' files (currently null).
733 # POST_PROCESS_SO: Post-processing for `.so' files.
734 # POST_PROCESS: Post-processing for executable files (no suffix).
735 # Note that these macros are not completely generalized as they are to be
736 # used with the file name to be processed following.
738 # It is left as an exercise to Release Engineering to embellish the generation
739 # of the release comment string.
741 # If this is a standard development build:
742 # compress the comment section (mcs -c)
743 # add the standard comment (mcs -a $(RELEASE_CM))
744 # add the development specific comment (mcs -a $(DEV_CM))
746 # If this is an installation build:
747 # delete the comment section (mcs -d)
748 # add the standard comment (mcs -a $(RELEASE_CM))
749 # add the development specific comment (mcs -a $(DEV_CM))
751 # If this is an release build:
752 # delete the comment section (mcs -d)
753 # add the standard comment (mcs -a $(RELEASE_CM))
755 # The following list of macros are used in the definition of RELEASE_CM
756 # which is used to label all binaries in the build:
758 # RELEASE Specific release of the build, eg: 5.2
759 # RELEASE_MAJOR Major version number part of $(RELEASE)
760 # RELEASE_MINOR Minor version number part of $(RELEASE)
761 # VERSION Version of the build (alpha, beta, Generic)
762 # PATCHID If this is a patch this value should contain
763 # the patchid value (eg: "Generic 100832-01"), otherwise
764 # it will be set to $(VERSION)
765 # RELEASE_DATE Date of the Release Build
766 # PATCH_DATE Date the patch was created, if this is blank it
767 # will default to the RELEASE_DATE
772 RELEASE= $(RELEASE_MAJOR).$(RELEASE_MINOR)
773 VERSION= $(SYSNAME) Development
775 RELEASE_DATE= release date not set
776 PATCH_DATE= $(RELEASE_DATE)
777 RELEASE_CM= "$(SYSNAME) $(RELEASE) $(PATCHID) $(PATCH_DATE)"
778 DEV_CM= "$(SYSNAME) Development: non-nightly build"
780 PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
781 $(RELEASE_BUILD)PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM)
783 STRIP_STABS= $(STRIP) -x $@
784 $(SRCDBGBLD)STRIP_STABS= :
788 POST_PROCESS_SO= $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
790 POST_PROCESS= $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
794 # chk4ubin is a tool that inspects a module for a symbol table
795 # ELF section size which can trigger an OBP bug on older platforms.
796 # This problem affects only specific sun4u bootable modules.
798 CHK4UBIN= $(ONBLD_TOOLS)/bin/$(MACH)/chk4ubin
800 CHK4UBINARY= $(CHK4UBIN) $(CHK4UBINFLAGS) $@
803 # PKGARCHIVE specifies the default location where packages should be
806 PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly
809 # The repositories will be created with these publisher settings. To
810 # update an image to the resulting repositories, this must match the
811 # publisher name provided to "pkg set-publisher."
813 PKGPUBLISHER= unleashed
815 # Default build rules which perform comment section post-processing.
818 $(LINK.c) -o $@ $< $(LDLIBS)
821 $(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
824 $(COMPILE.c) -o $% $<
825 $(PROCESS_COMMENT) $%
826 $(AR) $(ARFLAGS) $@ $%
829 $(COMPILE.s) -o $@ $<
832 $(COMPILE.s) -o $% $<
833 $(PROCESS_COMMENT) $%
834 $(AR) $(ARFLAGS) $@ $%
837 $(LINK.cc) -o $@ $< $(LDLIBS)
840 $(COMPILE.cc) $(OUTPUT_OPTION) $<
843 $(COMPILE.cc) -o $% $<
844 $(AR) $(ARFLAGS) $@ $%
845 $(PROCESS_COMMENT) $%
849 $(LINK.c) -o $@ y.tab.c $(LDLIBS)
854 $(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
860 $(LINK.c) -o $@ $*.c -ll $(LDLIBS)
866 $(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
871 $(COMPILE.b) -o $@ $<
877 # Bourne and Korn shell script message catalog build rules.
878 # We extract all gettext strings with sed(1) (being careful to permit
879 # multiple gettext strings on the same line), weed out the dups, and
880 # build the catalogue with awk(1).
885 -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p" \
887 -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/" \
889 $< | sort -u | $(AWK) '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
892 # Python and Perl executable and message catalog build rules.
894 .SUFFIXES: .pl .pm .py .pyc
898 $(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
902 $(RM) $@; $(SED) -e "1s:^\#!@PYTHON@:\#!$(PYTHON):" < $< > $@; $(CHMOD) +x $@
906 $(PYTHON) -mpy_compile $<
907 @[ $(<)c = $@ ] || $(MV) $(<)c $@
910 $(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
912 $(SED) "/^domain/d" < $(<F).po > $@ ;
916 # When using xgettext, we want messages to go to the default domain,
917 # rather than the specified one. This special version of the
918 # COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
919 # causing xgettext to put all messages into the default domain.
921 CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
931 $(CPPFORPO) y.tab.c > $@
936 $(CPPFORPO) lex.yy.c > $@
940 $(CPPFORPO) $< > $<.i
944 $(CPPFORPO) $< > $<.i
949 $(CPPFORPO) y.tab.c > $<.i
955 $(CPPFORPO) lex.yy.c > $<.i
960 # Rules to perform stylistic checks
962 .SUFFIXES: .x .xml .check .xmlchk