nightly: print bmake -C include and lib into mail_msg
[unleashed.git] / usr / src / Makefile.master
blob0614347ebf381df05ff08429b1eb940b34ebeaa7
2 # CDDL HEADER START
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]
19 # CDDL HEADER END
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
37 ROOT=           /proto
40 # Adjunct root, containing an additional proto area to be used for headers
41 # and libraries.
43 ADJUNCT_PROTO=
46 # Adjunct for building things that run on the build machine.
48 NATIVE_ADJUNCT= /usr
51 # RELEASE_BUILD should be cleared for final release builds.
52 # NOT_RELEASE_BUILD is exactly what the name implies.
55 NOT_RELEASE_BUILD=
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.
74 BUILD_TOOLS=            /opt
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.
95 ECHO=           echo
96 TRUE=           true
97 INS=            /usr/bin/install
98 SYMLINK=        /usr/bin/ln -s
99 LN=             /usr/bin/ln
100 MKDIR=          /usr/bin/mkdir
101 CHMOD=          /usr/bin/chmod
102 MV=             /usr/bin/mv -f
103 RM=             /usr/bin/rm -f
104 CUT=            /usr/bin/cut
105 NM=             /usr/bin/nm
106 DIFF=           /usr/bin/diff
107 GREP=           /usr/bin/grep
108 EGREP=          /usr/bin/egrep
109 ELFWRAP=        /usr/bin/elfwrap
110 KSH93=          /usr/bin/ksh93
111 SED=            /usr/bin/sed
112 AWK=            /usr/bin/nawk
113 CP=             /usr/bin/cp -f
114 MCS=            /usr/bin/mcs
115 CAT=            /usr/bin/cat
116 ELFDUMP=        /usr/bin/elfdump
117 M4=             /usr/bin/m4
118 STRIP=          /usr/bin/strip
119 LEX=            /usr/bin/lex
120 LFLAGS=         -n
121 FLEX=           /usr/bin/flex
122 YACC=           /usr/bin/yacc
123 CPP=            $(GCC_ROOT)/cpp
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
131 FIND=           /usr/bin/find
132 PERL=           /usr/bin/perl
133 PERL_VERSION=   5.22
134 PERL_PKGVERS=   -522
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
139 PYTHON_VERSION= 2.7
140 PYTHON_PKGVERS= -27
141 PYTHON=         /usr/bin/python$(PYTHON_VERSION)
142 SORT=           /usr/bin/sort
143 TOUCH=          /usr/bin/touch
144 WC=             /usr/bin/wc
145 XARGS=          /usr/bin/xargs
146 ELFEDIT=        /usr/bin/elfedit
147 DTRACE=         /usr/sbin/dtrace -xnolibs
148 UNIQ=           /usr/bin/uniq
149 TAR=            /usr/bin/tar
150 ASTBINDIR=      /usr/ast/bin
151 MSGCC=          $(ASTBINDIR)/msgcc
152 MSGFMT=         /usr/bin/msgfmt -s
154 FILEMODE=       644
155 DIRMODE=        755
157 # Declare that nothing should be built in parallel.
158 # Individual Makefiles can use the .PARALLEL target to declare otherwise.
159 .NO_PARALLEL:
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
167 CSTYLE_TAIL=
168 HDRCHK=         $(ONBLD_TOOLS)/bin/hdrchk
169 HDRCHK_TAIL=
171 DOT_H_CHECK=    \
172         @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
173         $(HDRCHK) $< $(HDRCHK_TAIL)
175 DOT_X_CHECK=    \
176         @$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
177         $(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
179 DOT_C_CHECK=    \
180         @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
182 MANIFEST_CHECK= \
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)
195 # install a link
196 INSLINKTARGET=  $<
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
205 # (.py) file.
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)
225 sparc_BUILD64=
226 i386_BUILD64=
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
234 # system calls.
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 \
244         -fno-ipa-cp
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
263 # the kernel.
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
296 # -nd builds
297 $(RELEASE_BUILD)CERRWARN += -Wno-unused
298 $(RELEASE_BUILD)CERRWARN += -Wno-empty-body
301 # turn warnings into errors (C++)
302 CCERRWARN=              -Werror
304 # C99 mode
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 \
325         -O2
326 sparcv9_COPTFLAG=       -fno-strict-aliasing \
327         -fno-unit-at-a-time \
328         -fno-optimize-sibling-calls \
329         -O2
330 i386_COPTFLAG=          -O
331 amd64_COPTFLAG=         -fno-strict-aliasing \
332         -fno-unit-at-a-time \
333         -fno-optimize-sibling-calls \
334         -O2
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) \
364         $(CDWARFSTR)
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
374 i386_XREGSFLAG          =
375 amd64_XREGSFLAG         =
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.
394 CUSERFLAGS              =
395 CUSERFLAGS64            = $(CUSERFLAGS)
396 CCUSERFLAGS             =
397 CCUSERFLAGS64           = $(CCUSERFLAGS)
399 CSOURCEDEBUGFLAGS       =
400 CCSOURCEDEBUGFLAGS      =
401 $(SRCDBGBLD)CSOURCEDEBUGFLAGS   = -g
402 $(SRCDBGBLD)CCSOURCEDEBUGFLAGS  = -g
404 CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) \
405                 $(CERRWARN) $(C99MODE) \
406                 $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
407                 $(CUSERFLAGS)
408 CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) \
409                 $(CERRWARN) $(C99MODE) \
410                 $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
411                 $(CUSERFLAGS64)
412 ARFLAGS=        rc
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) \
419                 $(CCNOAUTOINLINE) \
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 ;\
447         $(RM)   $@ ;\
448         $(SED) "/^domain/d" < $(<F).po > $@ ;\
449         $(RM) $(<F).po $<.i
452 # This is overwritten by local Makefile when PROG is a list.
454 POFILE= $(PROG).po
456 sparc_CCFLAGS=          -m32 mcpu=v8 mno-v8plus \
457                         -mtunesupersparc \
458                         $(CCERRWARN)
459 sparcv9_CCFLAGS=        $(sparcv9_XARCH) \
460                         $(CCERRWARN)
461 i386_CCFLAGS=           $(CCERRWARN)
462 amd64_CCFLAGS=          $(amd64_XARCH) \
463                         $(CCERRWARN)
465 sparc_CCOPTFLAG=        -O
466 sparcv9_CCOPTFLAG=      -O
467 i386_CCOPTFLAG=         -O
468 amd64_CCOPTFLAG=        -O
470 CCOPTFLAG=      $($(MACH)_CCOPTFLAG)
471 CCOPTFLAG64=    $($(MACH64)_CCOPTFLAG)
472 CCFLAGS=        $(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
473                 $(CCUSERFLAGS)
474 CCFLAGS64=      $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
475                 $(CCUSERFLAGS64)
480 ELFWRAP_FLAGS   =
481 ELFWRAP_FLAGS64 =       -64
484 # Various mapfiles that are used throughout the build, and delivered to
485 # /usr/lib/ld.
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
509 # assignments.
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))
536 # Link time macros
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)
548 SECLEVEL=       core
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.
563 GNU_ROOT=               /usr
565 BASIC_CC_ARGS=  -fident \
566                 -finline \
567                 -fno-inline-functions \
568                 -fno-builtin \
569                 -fno-asm \
570                 -fdiagnostics-show-option \
571                 -nodefaultlibs
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 \
583                 -c \
584                 -Wa,--warn \
585                 -Wa,--fatal-warnings \
586                 -Wa,--traditional-format \
587                 -D__GNUC_AS__
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)
608 i386_LD=                /usr/bin/ld
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
625 CC=                     $(NATIVECC)
626 CCC=                    $(NATIVECCC)
627 CPP=                    $(NATIVECPP)
628 AS=                     $(NATIVEAS)
629 LD=                     $(NATIVELD)
631 CCYFLAG=        -nostdinc
633 LD_BDIRECT=     -Bdirect
634 LD_BDYNAMIC=    -Bdynamic
635 LD_BLOCAL=      -Blocal
636 LD_BNODIRECT=   -Bnodirect
637 LD_BREDUCE=     -Breduce
638 LD_BSTATIC=     -Bstatic
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,%)
647 LD_ZDEFS=               -zdefs
648 LD_ZDIRECT=             -zdirect
649 LD_ZIGNORE=             -zignore
650 LD_ZINITFIRST=          -zinitfirst
651 LD_ZINTERPOSE=          -zinterpose
652 LD_ZLAZYLOAD=           -zlazyload
653 LD_ZLOADFLTR=           -zloadfltr
654 LD_ZNODEFS=             -znodefs
655 LD_ZNODELETE=           -znodelete
656 LD_ZNODLOPEN=           -znodlopen
657 LD_ZNODUMP=             -znodump
658 LD_ZNOLAZYLOAD=         -znolazyload
659 LD_ZNOLDYNSYM=          -znoldynsym
660 LD_ZNORELOC=            -znoreloc
661 LD_ZNOVERSION=          -znoversion
662 LD_ZRECORD=             -zrecord
663 LD_ZTEXT=               -ztext
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,%)
683 GSHARED=        -shared
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)
710 AS_PICFLAGS=
711 AS_BIGPICFLAGS=
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
721 # stripping.
723 CTFMRGFLAGS=
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
729 # automatically.
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
769 SYSNAME=        SunOS
770 RELEASE_MAJOR=  5
771 RELEASE_MINOR=  11
772 RELEASE=        $(RELEASE_MAJOR).$(RELEASE_MINOR)
773 VERSION=        $(SYSNAME) Development
774 PATCHID=        $(VERSION)
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=           :
786 POST_PROCESS_O=         :
787 POST_PROCESS_A=         :
788 POST_PROCESS_SO=        $(PROCESS_COMMENT) $@ ; $(STRIP_STABS)
789 POST_PROCESS=           $(PROCESS_COMMENT) $@ ; $(STRIP_STABS)
792 # chk4ubin is a tool that inspects a module for a symbol table
793 # ELF section size which can trigger an OBP bug on older platforms.
794 # This problem affects only specific sun4u bootable modules.
796 CHK4UBIN=       $(ONBLD_TOOLS)/bin/$(MACH)/chk4ubin
797 CHK4UBINFLAGS=
798 CHK4UBINARY=    $(CHK4UBIN) $(CHK4UBINFLAGS) $@
801 # PKGARCHIVE specifies the default location where packages should be
802 # placed if built.
804 PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly
807 # The repositories will be created with these publisher settings.  To
808 # update an image to the resulting repositories, this must match the
809 # publisher name provided to "pkg set-publisher."
811 PKGPUBLISHER=   unleashed
813 #       Default build rules which perform comment section post-processing.
816         $(LINK.c) -o $@ $< $(LDLIBS)
817         $(POST_PROCESS)
818 .c.o:
819         $(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
820         $(POST_PROCESS_O)
821 .c.a:
822         $(COMPILE.c) -o $% $<
823         $(PROCESS_COMMENT) $%
824         $(AR) $(ARFLAGS) $@ $%
825         $(RM) $%
826 .s.o:
827         $(COMPILE.s) -o $@ $<
828         $(POST_PROCESS_O)
829 .s.a:
830         $(COMPILE.s) -o $% $<
831         $(PROCESS_COMMENT) $%
832         $(AR) $(ARFLAGS) $@ $%
833         $(RM) $%
834 .cc:
835         $(LINK.cc) -o $@ $< $(LDLIBS)
836         $(POST_PROCESS)
837 .cc.o:
838         $(COMPILE.cc) $(OUTPUT_OPTION) $<
839         $(POST_PROCESS_O)
840 .cc.a:
841         $(COMPILE.cc) -o $% $<
842         $(AR) $(ARFLAGS) $@ $%
843         $(PROCESS_COMMENT) $%
844         $(RM) $%
846         $(YACC.y) $<
847         $(LINK.c) -o $@ y.tab.c $(LDLIBS)
848         $(POST_PROCESS)
849         $(RM) y.tab.c
850 .y.o:
851         $(YACC.y) $<
852         $(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
853         $(POST_PROCESS_O)
854         $(RM) y.tab.c
856         $(RM) $*.c
857         $(LEX.l) $< > $*.c
858         $(LINK.c) -o $@ $*.c -ll $(LDLIBS)
859         $(POST_PROCESS)
860         $(RM) $*.c
861 .l.o:
862         $(RM) $*.c
863         $(LEX.l) $< > $*.c
864         $(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
865         $(POST_PROCESS_O)
866         $(RM) $*.c
868 .bin.o:
869         $(COMPILE.b) -o $@ $<
870         $(POST_PROCESS_O)
872 .java.class:
873         $(COMPILE.java) $<
875 # Bourne and Korn shell script message catalog build rules.
876 # We extract all gettext strings with sed(1) (being careful to permit
877 # multiple gettext strings on the same line), weed out the dups, and
878 # build the catalogue with awk(1).
880 .sh.po .ksh.po:
881         $(SED) -n -e ":a"                               \
882                   -e "h"                                        \
883                   -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"       \
884                   -e "x"                                        \
885                   -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"  \
886                   -e "t a"                                      \
887                $< | sort -u | $(AWK) '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
890 # Python and Perl executable and message catalog build rules.
892 .SUFFIXES: .pl .pm .py .pyc
894 .pl:
895         $(RM) $@;
896         $(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
897         $(CHMOD) +x $@
899 .py:
900         $(RM) $@; $(SED) -e "1s:^\#!@PYTHON@:\#!$(PYTHON):" < $< > $@; $(CHMOD) +x $@
902 .py.pyc:
903         $(RM) $@
904         $(PYTHON) -mpy_compile $<
905         @[ $(<)c = $@ ] || $(MV) $(<)c $@
907 .pl.po .pm.po:
908         $(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
909         $(RM)   $@ ;
910         $(SED) "/^domain/d" < $(<F).po > $@ ;
911         $(RM) $(<F).po
914 # When using xgettext, we want messages to go to the default domain,
915 # rather than the specified one.  This special version of the
916 # COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
917 # causing xgettext to put all messages into the default domain.
919 CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
921 .c.i:
922         $(CPPFORPO) $< > $@
924 .h.i:
925         $(CPPFORPO) $< > $@
927 .y.i:
928         $(YACC) -d $<
929         $(CPPFORPO) y.tab.c  > $@
930         $(RM) y.tab.c
932 .l.i:
933         $(LEX) $<
934         $(CPPFORPO) lex.yy.c  > $@
935         $(RM) lex.yy.c
937 .c.po:
938         $(CPPFORPO) $< > $<.i
939         $(BUILD.po)
941 .cc.po:
942         $(CPPFORPO) $< > $<.i
943         $(BUILD.po)
945 .y.po:
946         $(YACC) -d $<
947         $(CPPFORPO) y.tab.c  > $<.i
948         $(BUILD.po)
949         $(RM) y.tab.c
951 .l.po:
952         $(LEX) $<
953         $(CPPFORPO) lex.yy.c  > $<.i
954         $(BUILD.po)
955         $(RM) lex.yy.c
958 # Rules to perform stylistic checks
960 .SUFFIXES: .x .xml .check .xmlchk
962 .h.check:
963         $(DOT_H_CHECK)
965 .x.check:
966         $(DOT_X_CHECK)
968 .xml.xmlchk:
969         $(MANIFEST_CHECK)