Merge commit 'e8921a52c53ee69f7b65f054d9b2e886139daa59'
[unleashed.git] / usr / src / Makefile.master
blobd896bb0afc3dc0ecb66694ba2036e2ed2485aae8
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 GNUC_ROOT=      /opt/gcc/4.4.4
78 GCCLIBDIR=      $(GNUC_ROOT)/lib
79 GCCLIBDIR64=    $(GNUC_ROOT)/lib/$(MACH64)
81 DOCBOOK_XSL_ROOT=       /usr/share/sgml/docbook/xsl-stylesheets
83 RPCGEN=         /usr/bin/rpcgen
84 ELFEXTRACT=     $(ONBLD_TOOLS)/bin/$(MACH)/elfextract
85 MBH_PATCH=      $(SRCTOP)/tools/mbh_patch/obj/mbh_patch
86 BTXLD=          $(ONBLD_TOOLS)/bin/$(MACH)/btxld
87 # echo(1) and true(1) are specified without absolute paths, so that the shell
88 # spawned by make(1) may use the built-in versions.  This is minimally
89 # problematic, as the shell spawned by make(1) is known and under control, the
90 # only risk being if the shell falls back to $PATH.
92 # We specifically want an echo(1) that does interpolation of escape sequences,
93 # which ksh93, /bin/sh, and bash will all provide.
94 ECHO=           echo
95 TRUE=           true
96 INS=            /usr/bin/install
97 SYMLINK=        /usr/bin/ln -s
98 LN=             /usr/bin/ln
99 MKDIR=          /usr/bin/mkdir
100 CHMOD=          /usr/bin/chmod
101 MV=             /usr/bin/mv -f
102 RM=             /usr/bin/rm -f
103 CUT=            /usr/bin/cut
104 NM=             /usr/bin/nm
105 DIFF=           /usr/bin/diff
106 GREP=           /usr/bin/grep
107 EGREP=          /usr/bin/egrep
108 ELFWRAP=        /usr/bin/elfwrap
109 KSH93=          /usr/bin/ksh93
110 SED=            /usr/bin/sed
111 AWK=            /usr/bin/nawk
112 CP=             /usr/bin/cp -f
113 MCS=            /usr/bin/mcs
114 CAT=            /usr/bin/cat
115 ELFDUMP=        /usr/bin/elfdump
116 M4=             /usr/bin/m4
117 STRIP=          /usr/bin/strip
118 LEX=            /usr/bin/lex
119 LFLAGS=         -n
120 FLEX=           /usr/bin/flex
121 YACC=           /usr/bin/yacc
122 CPP=            $(GNUC_ROOT)/cpp
123 ANSI_CPP=       $(GNUC_ROOT)/bin/cpp
124 CTFCONVERT=     /usr/bin/ctfconvert
125 CTFDIFF=        /usr/bin/ctfdiff
126 CTFMERGE=       /usr/bin/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_SUFFIX=
142 PYTHON=         /usr/bin/python$(PYTHON_VERSION)
143 PYTHON3_VERSION=        3.5
144 PYTHON3_PKGVERS=        -35
145 PYTHON3_SUFFIX=         m
146 PYTHON3=                /usr/bin/python$(PYTHON3_VERSION)
147 SORT=           /usr/bin/sort
148 TOUCH=          /usr/bin/touch
149 WC=             /usr/bin/wc
150 XARGS=          /usr/bin/xargs
151 ELFEDIT=        /usr/bin/elfedit
152 DTRACE=         /usr/sbin/dtrace -xnolibs
153 UNIQ=           /usr/bin/uniq
154 TAR=            /usr/bin/tar
155 ASTBINDIR=      /usr/ast/bin
156 MSGCC=          $(ASTBINDIR)/msgcc
157 MSGFMT=         /usr/bin/msgfmt -s
159 FILEMODE=       644
160 DIRMODE=        755
162 # Declare that nothing should be built in parallel.
163 # Individual Makefiles can use the .PARALLEL target to declare otherwise.
164 .NO_PARALLEL:
166 # For stylistic checks
168 # Note that the X and C checks are not used at this time and may need
169 # modification when they are actually used.
171 CSTYLE=         $(ONBLD_TOOLS)/bin/cstyle
172 CSTYLE_TAIL=
173 HDRCHK=         $(ONBLD_TOOLS)/bin/hdrchk
174 HDRCHK_TAIL=
176 DOT_H_CHECK=    \
177         @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
178         $(HDRCHK) $< $(HDRCHK_TAIL)
180 DOT_X_CHECK=    \
181         @$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
182         $(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
184 DOT_C_CHECK=    \
185         @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
187 MANIFEST_CHECK= \
188         @$(ECHO) "checking $<"; \
189         SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
190         SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
191         SVCCFG_CONFIGD_PATH=$(SRC)/cmd/svc/configd/svc.configd-native \
192         $(SRC)/cmd/svc/svccfg/svccfg-native validate $<
194 INS.file=       $(INS) -m $(FILEMODE) $< $@
195 INS.dir=        $(INS) -d -m $(DIRMODE) $@
196 # installs and renames at once
198 INS.rename=     $(INS.file)
200 # install a link
201 INSLINKTARGET=  $<
202 INS.link=       $(RM) $@; $(LN) $(INSLINKTARGET) $@
203 INS.symlink=    $(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
206 # Python bakes the mtime of the .py file into the compiled .pyc and
207 # rebuilds if the baked-in mtime != the mtime of the source file
208 # (rather than only if it's less than), thus when installing python
209 # files we must make certain to not adjust the mtime of the source
210 # (.py) file.
212 INS.pyfile=     $(RM) $@; $(SED) -e "1s:^\#!@PYTHON@:\#!$(PYTHON):" < $< > $@; $(CHMOD) $(FILEMODE) $@; $(TOUCH) -r $< $@
214 # MACH must be set in the shell environment per uname -p on the build host
215 # More specific architecture variables should be set in lower makefiles.
217 # MACH64 is derived from MACH, and BUILD64 is set to `#' for
218 # architectures on which we do not build 64-bit versions.
219 # (There are no such architectures at the moment.)
221 # Set BUILD64=# in the environment to disable 64-bit amd64
222 # builds on i386 machines.
224 MACH64_1=       $(MACH:sparc=sparcv9)
225 MACH64=         $(MACH64_1:i386=amd64)
227 MACH32_1=       $(MACH:sparc=sparcv7)
228 MACH32=         $(MACH32_1:i386=i386)
230 sparc_BUILD64=
231 i386_BUILD64=
232 BUILD64=        $($(MACH)_BUILD64)
235 # generate 32-bit addresses in the v9 kernel. Saves memory.
236 CCABS32=                -fno-pic -mcmodel=medlow
238 # generate v9 code which tolerates callers using the v7 ABI, for the sake of
239 # system calls.
240 CC32BITCALLERS=         -massume-32bit-callers
242 # GCC, especially, is increasingly beginning to auto-inline functions and
243 # sadly does so separately not under the general -fno-inline-functions
244 # Additionally, we wish to prevent optimisations which cause GCC to clone
245 # functions -- in particular, these may cause unhelpful symbols to be
246 # emitted instead of function names
247 CCNOAUTOINLINE= -fno-inline-small-functions \
248         -fno-inline-functions-called-once \
249         -fno-ipa-cp
252 # compiler architecture flags.
254 sparc_XARCH=    -m32 -mcpu=v8 -mno-v8plus
255 sparcv9_XARCH=  -m64 -mcpu=v9
256 i386_XARCH=     -m32 -march=pentiumpro
257 amd64_XARCH=    -m64 -Ui386 -U__i386 -mtune=opteron
259 # assembler architecture flags.  Different from compiler architecture flags.
260 sparc_AS_XARCH=         -xarch=v8plus -Dsparc -D__sparc -D__sparcv8
261 sparcv9_AS_XARCH=       -xarch=v9 -Dsparc -D__sparc -D__sparcv9
262 i386_AS_XARCH=          -m32 -Di386 -D__i386
263 amd64_AS_XARCH=         -m64 -Ui386 -U__i386 -D__x86_64 -D__amd64
266 # These flags define what we need to be 'standalone' i.e. -not- part
267 # of the rather more cosy userland environment.  This basically means
268 # the kernel.
270 # XX64  future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
272 sparc_STAND_FLAGS=      -ffreestanding
273 sparcv9_STAND_FLAGS=    -ffreestanding
274 # Disabling MMX also disables 3DNow, disabling SSE also disables all later
275 # additions to SSE (SSE2, AVX ,etc.)
276 NO_SIMD=                -mno-mmx -mno-sse
277 i386_STAND_FLAGS=       -ffreestanding $(NO_SIMD)
278 amd64_STAND_FLAGS=      -ffreestanding -mno-red-zone \
279                         -mcmodel=kernel $(NO_SIMD)
281 SAVEARGS=               -msave-args
282 amd64_STAND_FLAGS       += $(SAVEARGS)
284 STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
285 STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
288 # turn warnings into errors (C)
289 CERRWARN = -Wall -Wextra -Werror
291 CERRWARN += -Wno-missing-braces
292 CERRWARN += -Wno-sign-compare
293 CERRWARN += -Wno-unknown-pragmas
294 CERRWARN += -Wno-unused-parameter
295 CERRWARN += -Wno-missing-field-initializers
297 # Unfortunately, this option can misfire very easily and unfixably.
298 CERRWARN +=     -Wno-array-bounds
300 # DEBUG v. -nd make for frequent unused variables, empty conditions, etc. in
301 # -nd builds
302 $(RELEASE_BUILD)CERRWARN += -Wno-unused
303 $(RELEASE_BUILD)CERRWARN += -Wno-empty-body
306 # turn warnings into errors (C++)
307 CCERRWARN=              -Werror
309 # C99 mode
310 C99_ENABLE=     -std=gnu99
311 C99_DISABLE=    -std=gnu89
312 C99MODE=        $(C99_DISABLE)
314 # In most places, assignments to these macros should be appended with +=
315 # (CPPFLAGS.first allows values to be prepended to CPPFLAGS).
316 sparc_CFLAGS=   $(sparc_XARCH)
317 sparcv9_CFLAGS= $(sparcv9_XARCH)
318 i386_CFLAGS=    $(i386_XARCH)
319 amd64_CFLAGS=   $(amd64_XARCH)
321 sparc_ASFLAGS=  $(sparc_AS_XARCH)
322 sparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
323 i386_ASFLAGS=   $(i386_AS_XARCH)
324 amd64_ASFLAGS=  $(amd64_AS_XARCH)
327 sparc_COPTFLAG=         -fno-strict-aliasing \
328         -fno-unit-at-a-time \
329         -fno-optimize-sibling-calls \
330         -O2
331 sparcv9_COPTFLAG=       -fno-strict-aliasing \
332         -fno-unit-at-a-time \
333         -fno-optimize-sibling-calls \
334         -O2
335 i386_COPTFLAG=          -O
336 amd64_COPTFLAG=         -fno-strict-aliasing \
337         -fno-unit-at-a-time \
338         -fno-optimize-sibling-calls \
339         -O2
341 COPTFLAG= $($(MACH)_COPTFLAG)
342 COPTFLAG64= $($(MACH64)_COPTFLAG)
344 # Sometimes we want all symbols and types in debugging information even
345 # if they aren't used.
346 CALLSYMS=       -fno-eliminate-unused-debug-symbols \
347                 -fno-eliminate-unused-debug-types
350 # Flags used to build in debug mode for ctf generation.  Bugs in the Devpro
351 # compilers currently prevent us from building with cc-emitted DWARF.
353 CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(C99MODE) $(CDWARFSTR)
354 CTF_FLAGS_i386  = -g $(C99MODE) $(CDWARFSTR)
356 CTF_FLAGS_sparcv9       = $(CTF_FLAGS_sparc)
357 CTF_FLAGS_amd64         = $(CTF_FLAGS_i386)
359 CTF_FLAGS_amd64 += $(SAVEARGS)
361 CTF_FLAGS_32    = $(CTF_FLAGS_$(MACH))
362 CTF_FLAGS_64    = $(CTF_FLAGS_$(MACH64))
363 CTF_FLAGS       = $(CTF_FLAGS_32)
366 # Flags used with genoffsets
368 GOFLAGS = $(CALLSYMS) \
369         $(CDWARFSTR)
371 OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
372         $(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
374 OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
375         $(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
377 sparc_XREGSFLAG         = -mno-app-regs
378 sparcv9_XREGSFLAG       = -mno-app-regs
379 i386_XREGSFLAG          =
380 amd64_XREGSFLAG         =
382 XREGSFLAG               = $($(MACH)_XREGSFLAG)
383 XREGSFLAG64             = $($(MACH64)_XREGSFLAG)
385 # dmake SOURCEDEBUG=yes ... enables source-level debugging information, and
386 # avoids stripping it.
387 SOURCEDEBUG     = $(POUND_SIGN)
388 SRCDBGBLD       = $(SOURCEDEBUG:yes=)
391 # These variables are intended ONLY for use by developers to safely pass extra
392 # flags to the compilers without unintentionally overriding Makefile-set
393 # flags.  They should NEVER be set to any value in a Makefile.
395 # They come last in the associated FLAGS variable such that they can
396 # explicitly override things if necessary, there are gaps in this, but it's
397 # the best we can manage.
399 CUSERFLAGS              =
400 CUSERFLAGS64            = $(CUSERFLAGS)
401 CCUSERFLAGS             =
402 CCUSERFLAGS64           = $(CCUSERFLAGS)
404 CSOURCEDEBUGFLAGS       =
405 CCSOURCEDEBUGFLAGS      =
406 $(SRCDBGBLD)CSOURCEDEBUGFLAGS   = -g
407 $(SRCDBGBLD)CCSOURCEDEBUGFLAGS  = -g
409 CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) \
410                 $(CERRWARN) $(C99MODE) \
411                 $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
412                 $(CUSERFLAGS)
413 CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) \
414                 $(CERRWARN) $(C99MODE) \
415                 $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
416                 $(CUSERFLAGS64)
417 ARFLAGS=        rc
419 # Flags that are used to build parts of the code that are subsequently
420 # run on the build machine (also known as the NATIVE_BUILD).
422 NATIVE_CFLAGS=  $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) \
423                 $(CERRWARN) $(C99MODE) \
424                 $(CCNOAUTOINLINE) \
425                 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
427 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"       # For messaging.
428 CPPFLAGS.first= # Please keep empty.  Only lower makefiles should set this.
429 CPPFLAGS.master=$(DTEXTDOM) \
430         $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
431         $(ADJUNCT_PROTO:%=-I%/usr/include)
432 CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
433                 $(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
434 CPPFLAGS=       $(CPPFLAGS.first) $(CPPFLAGS.master)
435 AS_CPPFLAGS=    $(CPPFLAGS.first) $(CPPFLAGS.master)
438 # For source message catalogue
440 .SUFFIXES: $(SUFFIXES) .i .po
441 MSGROOT= $(ROOT)/catalog
442 MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
443 MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
444 DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
445 DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
447 CLOBBERFILES += $(POFILE) $(POFILES)
448 COMPILE.cpp= $(CC) -xc -E -C $(CFLAGS) $(CPPFLAGS)
449 XGETTEXT= /usr/bin/xgettext
450 XGETFLAGS= -c TRANSLATION_NOTE
451 BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
452         $(RM)   $@ ;\
453         $(SED) "/^domain/d" < $(<F).po > $@ ;\
454         $(RM) $(<F).po $<.i
457 # This is overwritten by local Makefile when PROG is a list.
459 POFILE= $(PROG).po
461 sparc_CCFLAGS=          -m32 mcpu=v8 mno-v8plus \
462                         -mtunesupersparc \
463                         $(CCERRWARN)
464 sparcv9_CCFLAGS=        $(sparcv9_XARCH) \
465                         $(CCERRWARN)
466 i386_CCFLAGS=           $(CCERRWARN)
467 amd64_CCFLAGS=          $(amd64_XARCH) \
468                         $(CCERRWARN)
470 sparc_CCOPTFLAG=        -O
471 sparcv9_CCOPTFLAG=      -O
472 i386_CCOPTFLAG=         -O
473 amd64_CCOPTFLAG=        -O
475 CCOPTFLAG=      $($(MACH)_CCOPTFLAG)
476 CCOPTFLAG64=    $($(MACH64)_CCOPTFLAG)
477 CCFLAGS=        $(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
478                 $(CCUSERFLAGS)
479 CCFLAGS64=      $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
480                 $(CCUSERFLAGS64)
485 ELFWRAP_FLAGS   =
486 ELFWRAP_FLAGS64 =       -64
489 # Various mapfiles that are used throughout the build, and delivered to
490 # /usr/lib/ld.
492 MAPFILE.PGA =           $(SRC)/common/mapfiles/common/map.pagealign
493 MAPFILE.FLT =           $(SRC)/common/mapfiles/common/map.filter
494 MAPFILE.LEX =           $(SRC)/common/mapfiles/common/map.lex.yy
497 # Generated mapfiles that are compiler specific, and used throughout the
498 # build.  These mapfiles are not delivered in /usr/lib/ld.
500 MAPFILE.NGB_sparc=      $(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
501 MAPFILE.NGB_sparcv9=    $(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
502 MAPFILE.NGB_i386=       $(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
503 MAPFILE.NGB_amd64=      $(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
504 MAPFILE.NGB =           $(MAPFILE.NGB_$(MACH))
507 # A generic interface mapfile name, used by various dynamic objects to define
508 # the interfaces and interposers the object must export.
510 MAPFILE.INT =           mapfile-intf
513 # LDLIBS32 and LDLIBS64 can be set in the environment to override the following
514 # assignments.
516 LDLIBS32 =      $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
517 LDLIBS32 +=     $(ADJUNCT_PROTO:%=-L%/usr/lib -L%/lib)
518 LDLIBS.cmd =    $(LDLIBS32)
519 LDLIBS.lib =    $(LDLIBS32)
521 LDLIBS64 =      $(ENVLDLIBS1:%=%/$(MACH64)) \
522                 $(ENVLDLIBS2:%=%/$(MACH64)) \
523                 $(ENVLDLIBS3:%=%/$(MACH64))
524 LDLIBS64 +=     $(ADJUNCT_PROTO:%=-L%/usr/lib/$(MACH64) -L%/lib/$(MACH64))
527 # Define compilation macros.
529 COMPILE.c=      $(CC) $(CFLAGS) $(CPPFLAGS) -c
530 COMPILE64.c=    $(CC) $(CFLAGS64) $(CPPFLAGS) -c
531 COMPILE.cc=     $(CCC) $(CCFLAGS) $(CPPFLAGS) -c
532 COMPILE64.cc=   $(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
533 COMPILE.s=      $(AS) $(ASFLAGS) $(AS_CPPFLAGS)
534 COMPILE64.s=    $(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
535 COMPILE.d=      $(DTRACE) -G -32
536 COMPILE64.d=    $(DTRACE) -G -64
537 COMPILE.b=      $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
538 COMPILE64.b=    $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
541 # Link time macros
543 CCNEEDED        = -L$(GCCLIBDIR) -lstdc++ -lgcc_s
544 CCEXTNEEDED     = $(CCNEEDED)
546 LINK.c=         $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
547 LINK64.c=       $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
548 LINK.cc=        $(CCC) $(CCFLAGS) $(CPPFLAGS) \
549                 $(LDFLAGS) $(CCNEEDED)
550 LINK64.cc=      $(CCC) $(CCFLAGS64) $(CPPFLAGS) \
551                 $(LDFLAGS) $(CCNEEDED)
553 SECLEVEL=       core
555 # For some future builds, NATIVE_MACH and MACH might be different.
556 # Therefore, NATIVE_MACH needs to be redefined in the
557 # environment as `uname -p` to override this macro.
559 # For now at least, we cross-compile amd64 on i386 machines.
560 NATIVE_MACH=    $(MACH:amd64=i386)
562 # Define native compilation macros
565 # Base directory where compilers are located.
566 # Defined here so it can be overridden by developers.
568 GNU_ROOT=               /usr
570 BASIC_CC_ARGS=  -fident \
571                 -finline \
572                 -fno-inline-functions \
573                 -fno-builtin \
574                 -fno-asm \
575                 -fdiagnostics-show-option \
576                 -nodefaultlibs
578 # The SPARC ldd and std instructions require 8-byte alignment of their
579 # address operand.  gcc correctly uses them only when the ABI requires
580 # 8-byte alignment; unfortunately we have a number of pieces of buggy code
581 # that does not conform to the ABI.  This flag makes gcc work more like
582 # Studio with -xmemalign=4.
583 $(SPARC_BLD)BASIC_CC_ARGS += mno-integer-ldd-std
585 BASIC_CC_ARGS += -D__sun
587 BASIC_AS_ARGS=  -x assembler-with-cpp \
588                 -c \
589                 -Wa,--warn \
590                 -Wa,--fatal-warnings \
591                 -Wa,--traditional-format \
592                 -D__GNUC_AS__
594 # Specify platform compiler versions for languages
595 # that we use (currently only c and c++).
597 sparc_CC=               /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
598 sparc_CCC=              /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
599 sparc_CPP=              $(GNUC_ROOT)/bin/cpp
600 sparc_AS=               /usr/bin/as -xregsym=no
601 sparc_LD=               /usr/bin/ld
603 sparcv9_CC=             /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
604 sparcv9_CCC=            /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
605 sparcv9_CPP=            $(GNUC_ROOT)/bin/cpp
606 sparcv9_AS=             /usr/bin/as -xregsym=no
607 sparcv9_LD=             /usr/bin/ld
609 i386_CC=                /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
610 i386_CCC=               /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
611 i386_CPP=               $(GNUC_ROOT)/bin/cpp
612 i386_AS=                $(GNUC_ROOT)/bin/gcc $(BASIC_AS_ARGS)
613 i386_LD=                /usr/bin/ld
615 amd64_CC=               /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
616 amd64_CCC=              /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
617 amd64_CPP=              $(GNUC_ROOT)/bin/cpp
618 amd64_AS=               $(GNUC_ROOT)/bin/gcc $(BASIC_AS_ARGS)
619 amd64_LD=               /usr/bin/ld
621 NATIVECC=               $($(NATIVE_MACH)_CC)
622 NATIVECCC=              $($(NATIVE_MACH)_CCC)
623 NATIVECPP=              $($(NATIVE_MACH)_CPP)
624 NATIVEAS=               $($(NATIVE_MACH)_AS)
625 NATIVELD=               $($(NATIVE_MACH)_LD)
628 # Makefile.master.64 overrides these settings
630 CC=                     $(NATIVECC)
631 CCC=                    $(NATIVECCC)
632 CPP=                    $(NATIVECPP)
633 AS=                     $(NATIVEAS)
634 LD=                     $(NATIVELD)
636 CCYFLAG=        -nostdinc
638 LD_BDIRECT=     -Bdirect
639 LD_BDYNAMIC=    -Bdynamic
640 LD_BLOCAL=      -Blocal
641 LD_BNODIRECT=   -Bnodirect
642 LD_BREDUCE=     -Breduce
643 LD_BSTATIC=     -Bstatic
645 BDIRECT=        $(LD_BDIRECT:%=-Wl,%)
646 BDYNAMIC=       $(LD_BDYNAMIC:%=-Wl,%)
647 BLOCAL=         $(LD_BLOCAL:%=-Wl,%)
648 BNODIRECT=      $(LD_BNODIRECT:%=-Wl,%)
649 BREDUCE=        $(LD_BREDUCE:%=-Wl,%)
650 BSTATIC=        $(LD_BSTATIC:%=-Wl,%)
652 LD_ZDEFS=               -zdefs
653 LD_ZDIRECT=             -zdirect
654 LD_ZIGNORE=             -zignore
655 LD_ZINITFIRST=          -zinitfirst
656 LD_ZINTERPOSE=          -zinterpose
657 LD_ZLAZYLOAD=           -zlazyload
658 LD_ZLOADFLTR=           -zloadfltr
659 LD_ZNODEFS=             -znodefs
660 LD_ZNODELETE=           -znodelete
661 LD_ZNODLOPEN=           -znodlopen
662 LD_ZNODUMP=             -znodump
663 LD_ZNOLAZYLOAD=         -znolazyload
664 LD_ZNOLDYNSYM=          -znoldynsym
665 LD_ZNORELOC=            -znoreloc
666 LD_ZNOVERSION=          -znoversion
667 LD_ZRECORD=             -zrecord
668 LD_ZTEXT=               -ztext
670 ZDEFS=          $(LD_ZDEFS:%=-Wl,%)
671 ZDIRECT=        $(LD_ZDIRECT:%=-Wl,%)
672 ZIGNORE=        $(LD_ZIGNORE:%=-Wl,%)
673 ZINITFIRST=     $(LD_ZINITFIRST:%=-Wl,%)
674 ZINTERPOSE=     $(LD_ZINTERPOSE:%=-Wl,%)
675 ZLAZYLOAD=      $(LD_ZLAZYLOAD:%=-Wl,%)
676 ZLOADFLTR=      $(LD_ZLOADFLTR:%=-Wl,%)
677 ZNODEFS=        $(LD_ZNODEFS:%=-Wl,%)
678 ZNODELETE=      $(LD_ZNODELETE:%=-Wl,%)
679 ZNODLOPEN=      $(LD_ZNODLOPEN:%=-Wl,%)
680 ZNODUMP=        $(LD_ZNODUMP:%=-Wl,%)
681 ZNOLAZYLOAD=    $(LD_ZNOLAZYLOAD:%=-Wl,%)
682 ZNOLDYNSYM=     $(LD_ZNOLDYNSYM:%=-Wl,%)
683 NORELOC=        $(LD_ZNORELOC:%=-Wl,%)
684 ZNOVERSION=     $(LD_ZNOVERSION:%=-Wl,%)
685 ZRECORD=        $(LD_ZRECORD:%=-Wl,%)
686 ZTEXT=          $(LD_ZTEXT:%=-Wl,%)
688 GSHARED=        -shared
690 # Handle different PIC models on different ISAs
691 # (May be overridden by lower-level Makefiles)
693 sparc_C_PICFLAGS =      -fpic
694 sparcv9_C_PICFLAGS =    -fpic
695 i386_C_PICFLAGS =       -fpic
696 amd64_C_PICFLAGS =      -fpic
697 C_PICFLAGS =            $($(MACH)_C_PICFLAGS)
698 C_PICFLAGS64 =          $($(MACH64)_C_PICFLAGS)
700 sparc_C_BIGPICFLAGS =   -fPIC
701 sparcv9_C_BIGPICFLAGS = -fPIC
702 i386_C_BIGPICFLAGS =    -fPIC
703 amd64_C_BIGPICFLAGS =   -fPIC
704 C_BIGPICFLAGS =         $($(MACH)_C_BIGPICFLAGS)
705 C_BIGPICFLAGS64 =       $($(MACH64)_C_BIGPICFLAGS)
707 # CC requires there to be no space between '-K' and 'pic' or 'PIC'.
708 sparc_CC_PICFLAGS =     -fpic
709 sparcv9_CC_PICFLAGS =   -fPIC
710 i386_CC_PICFLAGS =      -fpic
711 amd64_CC_PICFLAGS =     -fpic
712 CC_PICFLAGS =           $($(MACH)_CC_PICFLAGS)
713 CC_PICFLAGS64 =         $($(MACH64)_CC_PICFLAGS)
715 AS_PICFLAGS=
716 AS_BIGPICFLAGS=
719 # Default label for CTF sections
721 CTFCVTFLAGS=            -i -L VERSION
724 # Override to pass module-specific flags to ctfmerge.  Currently used only by
725 # krtld to turn on fuzzy matching, and source-level debugging to inhibit
726 # stripping.
728 CTFMRGFLAGS=
730 CTFCONVERT_O            = $(CTFCONVERT) $(CTFCVTFLAGS) $@
732 # Rules (normally from make.rules) and macros which are used for post
733 # processing files. Normally, these do stripping of the comment section
734 # automatically.
735 #    RELEASE_CM:        Should be editted to reflect the release.
736 #    POST_PROCESS_O:    Post-processing for `.o' files.
737 #    POST_PROCESS_A:    Post-processing for `.a' files (currently null).
738 #    POST_PROCESS_SO:   Post-processing for `.so' files.
739 #    POST_PROCESS:      Post-processing for executable files (no suffix).
740 # Note that these macros are not completely generalized as they are to be
741 # used with the file name to be processed following.
743 # It is left as an exercise to Release Engineering to embellish the generation
744 # of the release comment string.
746 #       If this is a standard development build:
747 #               compress the comment section (mcs -c)
748 #               add the standard comment (mcs -a $(RELEASE_CM))
749 #               add the development specific comment (mcs -a $(DEV_CM))
751 #       If this is an installation build:
752 #               delete the comment section (mcs -d)
753 #               add the standard comment (mcs -a $(RELEASE_CM))
754 #               add the development specific comment (mcs -a $(DEV_CM))
756 #       If this is an release build:
757 #               delete the comment section (mcs -d)
758 #               add the standard comment (mcs -a $(RELEASE_CM))
760 # The following list of macros are used in the definition of RELEASE_CM
761 # which is used to label all binaries in the build:
763 #       RELEASE         Specific release of the build, eg: 5.2
764 #       RELEASE_MAJOR   Major version number part of $(RELEASE)
765 #       RELEASE_MINOR   Minor version number part of $(RELEASE)
766 #       VERSION         Version of the build (alpha, beta, Generic)
767 #       PATCHID         If this is a patch this value should contain
768 #                       the patchid value (eg: "Generic 100832-01"), otherwise
769 #                       it will be set to $(VERSION)
770 #       RELEASE_DATE    Date of the Release Build
771 #       PATCH_DATE      Date the patch was created, if this is blank it
772 #                       will default to the RELEASE_DATE
774 SYSNAME=        SunOS
775 RELEASE_MAJOR=  5
776 RELEASE_MINOR=  11
777 RELEASE=        $(RELEASE_MAJOR).$(RELEASE_MINOR)
778 VERSION=        $(SYSNAME) Development
779 PATCHID=        $(VERSION)
780 RELEASE_DATE=   release date not set
781 PATCH_DATE=     $(RELEASE_DATE)
782 RELEASE_CM=     "$(SYSNAME) $(RELEASE) $(PATCHID) $(PATCH_DATE)"
783 DEV_CM=         "$(SYSNAME) Development: non-nightly build"
785 STRIP_STABS=                       $(STRIP) -x $@
786 $(SRCDBGBLD)STRIP_STABS=           :
788 POST_PROCESS_O=         :
789 POST_PROCESS_A=         :
790 POST_PROCESS_SO=        $(STRIP_STABS)
791 POST_PROCESS=           $(STRIP_STABS)
794 # PKGARCHIVE specifies the default location where packages should be
795 # placed if built.
797 PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly
800 # The repositories will be created with these publisher settings.  To
801 # update an image to the resulting repositories, this must match the
802 # publisher name provided to "pkg set-publisher."
804 PKGPUBLISHER=   unleashed
806 #       Default build rules which perform comment section post-processing.
809         $(LINK.c) -o $@ $< $(LDLIBS)
810         $(POST_PROCESS)
811 .c.o:
812         $(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
813         $(POST_PROCESS_O)
814 .c.a:
815         $(COMPILE.c) -o $% $<
816         $(AR) $(ARFLAGS) $@ $%
817         $(RM) $%
818 .s.o:
819         $(COMPILE.s) -o $@ $<
820         $(POST_PROCESS_O)
821 .s.a:
822         $(COMPILE.s) -o $% $<
823         $(AR) $(ARFLAGS) $@ $%
824         $(RM) $%
825 .cc:
826         $(LINK.cc) -o $@ $< $(LDLIBS)
827         $(POST_PROCESS)
828 .cc.o:
829         $(COMPILE.cc) $(OUTPUT_OPTION) $<
830         $(POST_PROCESS_O)
831 .cc.a:
832         $(COMPILE.cc) -o $% $<
833         $(AR) $(ARFLAGS) $@ $%
834         $(RM) $%
836         $(YACC.y) $<
837         $(LINK.c) -o $@ y.tab.c $(LDLIBS)
838         $(POST_PROCESS)
839         $(RM) y.tab.c
840 .y.o:
841         $(YACC.y) $<
842         $(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
843         $(POST_PROCESS_O)
844         $(RM) y.tab.c
846         $(RM) $*.c
847         $(LEX.l) $< > $*.c
848         $(LINK.c) -o $@ $*.c -ll $(LDLIBS)
849         $(POST_PROCESS)
850         $(RM) $*.c
851 .l.o:
852         $(RM) $*.c
853         $(LEX.l) $< > $*.c
854         $(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
855         $(POST_PROCESS_O)
856         $(RM) $*.c
858 .bin.o:
859         $(COMPILE.b) -o $@ $<
860         $(POST_PROCESS_O)
862 .java.class:
863         $(COMPILE.java) $<
865 # Bourne and Korn shell script message catalog build rules.
866 # We extract all gettext strings with sed(1) (being careful to permit
867 # multiple gettext strings on the same line), weed out the dups, and
868 # build the catalogue with awk(1).
870 .sh.po .ksh.po:
871         $(SED) -n -e ":a"                               \
872                   -e "h"                                        \
873                   -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"       \
874                   -e "x"                                        \
875                   -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"  \
876                   -e "t a"                                      \
877                $< | sort -u | $(AWK) '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
880 # Python and Perl executable and message catalog build rules.
882 .SUFFIXES: .pl .pm .py .pyc
884 .pl:
885         $(RM) $@;
886         $(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
887         $(CHMOD) +x $@
889 .py:
890         $(RM) $@; $(SED) -e "1s:^\#!@PYTHON@:\#!$(PYTHON):" < $< > $@; $(CHMOD) +x $@
892 .py.pyc:
893         $(RM) $@
894         $(PYTHON) -mpy_compile $<
895         @[ $(<)c = $@ ] || $(MV) $(<)c $@
897 .pl.po .pm.po:
898         $(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
899         $(RM)   $@ ;
900         $(SED) "/^domain/d" < $(<F).po > $@ ;
901         $(RM) $(<F).po
904 # When using xgettext, we want messages to go to the default domain,
905 # rather than the specified one.  This special version of the
906 # COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
907 # causing xgettext to put all messages into the default domain.
909 CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
911 .c.i:
912         $(CPPFORPO) $< > $@
914 .h.i:
915         $(CPPFORPO) $< > $@
917 .y.i:
918         $(YACC) -d $<
919         $(CPPFORPO) y.tab.c  > $@
920         $(RM) y.tab.c
922 .l.i:
923         $(LEX) $<
924         $(CPPFORPO) lex.yy.c  > $@
925         $(RM) lex.yy.c
927 .c.po:
928         $(CPPFORPO) $< > $<.i
929         $(BUILD.po)
931 .cc.po:
932         $(CPPFORPO) $< > $<.i
933         $(BUILD.po)
935 .y.po:
936         $(YACC) -d $<
937         $(CPPFORPO) y.tab.c  > $<.i
938         $(BUILD.po)
939         $(RM) y.tab.c
941 .l.po:
942         $(LEX) $<
943         $(CPPFORPO) lex.yy.c  > $<.i
944         $(BUILD.po)
945         $(RM) lex.yy.c
948 # Rules to perform stylistic checks
950 .SUFFIXES: .x .xml .check .xmlchk
952 .h.check:
953         $(DOT_H_CHECK)
955 .x.check:
956         $(DOT_X_CHECK)
958 .xml.xmlchk:
959         $(MANIFEST_CHECK)