move 32-bit libs to lib/i386 subdirs & 64-bit libs to lib/
[unleashed.git] / usr / src / Makefile.master
blobc22458e2b31b4f57eed3f3d7b19e80180e3c78fb
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>
30 # Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
31 # Copyright (c) 2019, Joyent, Inc.
34 include $(SRC)/Makefile.cfgparam
37 # Makefile.master, global definitions for system source
39 ROOT=           /proto
42 # Adjunct root, containing an additional proto area to be used for headers
43 # and libraries.
45 ADJUNCT_PROTO=
48 # Adjunct for building things that run on the build machine.
50 NATIVE_ADJUNCT= /usr
53 # RELEASE_BUILD should be cleared for final release builds.
54 # NOT_RELEASE_BUILD is exactly what the name implies.
57 NOT_RELEASE_BUILD=
58 RELEASE_BUILD=                          $(POUND_SIGN)
59 $(RELEASE_BUILD)NOT_RELEASE_BUILD=      $(POUND_SIGN)
60 PATCH_BUILD=                            $(POUND_SIGN)
62 # SPARC_BLD is '#' for an Intel build.
63 # INTEL_BLD is '#' for a Sparc build.
64 SPARC_BLD_1=    $(MACH:i386=$(POUND_SIGN))
65 SPARC_BLD=      $(SPARC_BLD_1:sparc=)
66 INTEL_BLD_1=    $(MACH:sparc=$(POUND_SIGN))
67 INTEL_BLD=      $(INTEL_BLD_1:i386=)
69 # Allow build-time "configuration" to enable or disable some things.
70 # The default is POUND_SIGN, meaning "not enabled".
71 ENABLE_PERL64=          $(POUND_SIGN)
73 # BUILD_TOOLS is the root of all tools including compilers.
74 # ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
76 BUILD_TOOLS=            /opt
77 ONBLD_TOOLS=            $(BUILD_TOOLS)/onbld
79 GNUC_ROOT=      /opt/gcc/4.4.4
80 GCCLIBDIR=      $(GNUC_ROOT)/lib/$(MACH32)
81 GCCLIBDIR64=    $(GNUC_ROOT)/lib
83 DOCBOOK_XSL_ROOT=       /usr/share/sgml/docbook/xsl-stylesheets
85 RPCGEN=         /usr/bin/rpcgen
86 ELFEXTRACT=     $(ONBLD_TOOLS)/bin/$(MACH)/elfextract
87 MBH_PATCH=      $(SRCTOP)/tools/mbh_patch/obj/mbh_patch
88 BTXLD=          $(ONBLD_TOOLS)/bin/$(MACH)/btxld
89 VTFONTCVT=      /usr/bin/vtfontcvt
90 # echo(1) and true(1) are specified without absolute paths, so that the shell
91 # spawned by make(1) may use the built-in versions.  This is minimally
92 # problematic, as the shell spawned by make(1) is known and under control, the
93 # only risk being if the shell falls back to $PATH.
95 # We specifically want an echo(1) that does interpolation of escape sequences,
96 # which ksh, /bin/sh, and bash will all provide.
97 ECHO=           echo
98 TRUE=           true
99 INS=            /usr/bin/install
100 SYMLINK=        /usr/bin/ln -s
101 LN=             /usr/bin/ln
102 MKDIR=          /usr/bin/mkdir
103 CHMOD=          /usr/bin/chmod
104 MV=             /usr/bin/mv -f
105 RM=             /usr/bin/rm -f
106 CUT=            /usr/bin/cut
107 NM=             /usr/bin/nm
108 DIFF=           /usr/bin/diff
109 GREP=           /usr/bin/grep
110 EGREP=          /usr/bin/egrep
111 ELFWRAP=        /usr/bin/elfwrap
112 SED=            /usr/bin/sed
113 AWK=            /usr/bin/nawk
114 CP=             /usr/bin/cp -f
115 MCS=            /usr/bin/mcs
116 CAT=            /usr/bin/cat
117 ELFDUMP=        /usr/bin/elfdump
118 M4=             /usr/bin/m4
119 GM4=            /usr/bin/gm4
120 STRIP=          /usr/bin/strip
121 LEX=            /usr/bin/lex
122 LFLAGS=         -n
123 FLEX=           /usr/bin/flex
124 YACC=           /usr/bin/yacc
125 BISON=          /usr/bin/bison
126 CPP=            $(GNUC_ROOT)/cpp
127 ANSI_CPP=       $(GNUC_ROOT)/bin/cpp
128 CTFCONVERT=     /usr/bin/ctfconvert
129 CTFDIFF=        /usr/bin/ctfdiff
130 CTFMERGE=       /usr/bin/ctfmerge
131 CTFSTABS=       $(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
132 CTFSTRIP=       $(ONBLD_TOOLS)/bin/$(MACH)/ctfstrip
133 NDRGEN=         $(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
134 GENOFFSETS=     $(ONBLD_TOOLS)/bin/genoffsets
135 FIND=           /usr/bin/find
136 PERL=           /usr/bin/perl
137 PERL_VERSION=   5.22
138 PERL_PKGVERS=   -522
139 PERL_ARCH=              i86pc-solaris-64int
140 PERL_ARCH64=    i86pc-solaris-64
141 $(SPARC_BLD)PERL_ARCH=          sun4-solaris-64int
142 $(SPARC_BLD)PERL_ARCH64=        sun4-solaris-64
143 PYTHON_VERSION= 2.7
144 PYTHON_PKGVERS= -27
145 PYTHON_SUFFIX=
146 PYTHON=         /usr/bin/python$(PYTHON_VERSION)
147 PYTHON3_VERSION=        3.5
148 PYTHON3_PKGVERS=        -35
149 PYTHON3_SUFFIX=         m
150 PYTHON3=                /usr/bin/python$(PYTHON3_VERSION)
151 $(BUILDPY3TOOLS)TOOLS_PYTHON=           $(PYTHON3)
152 $(BUILDPY2TOOLS)TOOLS_PYTHON=           $(PYTHON)
153 SORT=           /usr/bin/sort
154 TOUCH=          /usr/bin/touch
155 WC=             /usr/bin/wc
156 XARGS=          /usr/bin/xargs
157 ELFEDIT=        /usr/bin/elfedit
158 DTRACE=         /usr/sbin/dtrace -xnolibs
159 UNIQ=           /usr/bin/uniq
160 TAR=            /usr/bin/tar
161 ASTBINDIR=      /usr/ast/bin
162 MSGCC=          $(ASTBINDIR)/msgcc
163 MSGFMT=         /usr/bin/msgfmt -s
165 FILEMODE=       644
166 DIRMODE=        755
168 # Declare that nothing should be built in parallel.
169 # Individual Makefiles can use the .PARALLEL target to declare otherwise.
170 .NO_PARALLEL:
172 # For stylistic checks
174 # Note that the X and C checks are not used at this time and may need
175 # modification when they are actually used.
177 CSTYLE=         $(ONBLD_TOOLS)/bin/cstyle
178 CSTYLE_TAIL=
179 HDRCHK=         $(ONBLD_TOOLS)/bin/hdrchk
180 HDRCHK_TAIL=
182 DOT_H_CHECK=    \
183         @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
184         $(HDRCHK) $< $(HDRCHK_TAIL)
186 DOT_X_CHECK=    \
187         @$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
188         $(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
190 DOT_C_CHECK=    \
191         @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
193 MANIFEST_CHECK= \
194         @$(ECHO) "checking $<"; \
195         SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
196         SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
197         SVCCFG_CONFIGD_PATH=$(SRC)/cmd/svc/configd/svc.configd-native \
198         $(SRC)/cmd/svc/svccfg/svccfg-native validate $<
200 INS.file=       $(INS) -m $(FILEMODE) $< $@
201 INS.dir=        $(INS) -d -m $(DIRMODE) $@
202 # installs and renames at once
204 INS.rename=     $(INS.file)
206 # install a link
207 INSLINKTARGET=  $<
208 INS.link=       $(RM) $@; $(LN) $(INSLINKTARGET) $@
209 INS.symlink=    $(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
211 # The path to python that will be used for the shebang line when installing
212 # python scripts to the proto area. This is overridden by makefiles to
213 # select to the correct version.
214 PYSHEBANG=      $(PYTHON)
217 # Python bakes the mtime of the .py file into the compiled .pyc and
218 # rebuilds if the baked-in mtime != the mtime of the source file
219 # (rather than only if it's less than), thus when installing python
220 # files we must make certain to not adjust the mtime of the source
221 # (.py) file.
223 INS.pyfile=     $(RM) $@; $(SED) \
224                 -e "1s:^\#!@PYTHON@:\#!$(PYSHEBANG):" \
225                 -e "1s:^\#!@TOOLS_PYTHON@:\#!$(TOOLS_PYTHON):" \
226                 < $< > $@; $(CHMOD) $(FILEMODE) $@; $(TOUCH) -r $< $@
228 # MACH must be set in the shell environment per uname -p on the build host
229 # More specific architecture variables should be set in lower makefiles.
231 # MACH64 is derived from MACH, and BUILD64 is set to `#' for
232 # architectures on which we do not build 64-bit versions.
233 # (There are no such architectures at the moment.)
235 # Set BUILD64=# in the environment to disable 64-bit amd64
236 # builds on i386 machines.
238 MACH64_1=       $(MACH:sparc=sparcv9)
239 MACH64=         $(MACH64_1:i386=amd64)
241 MACH32_1=       $(MACH:sparc=sparcv7)
242 MACH32=         $(MACH32_1:i386=i386)
244 sparc_BUILD64=
245 i386_BUILD64=
246 BUILD64=        $($(MACH)_BUILD64)
249 # generate 32-bit addresses in the v9 kernel. Saves memory.
250 CCABS32=                -fno-pic -mcmodel=medlow
252 # generate v9 code which tolerates callers using the v7 ABI, for the sake of
253 # system calls.
254 CC32BITCALLERS=         -massume-32bit-callers
256 # GCC, especially, is increasingly beginning to auto-inline functions and
257 # sadly does so separately not under the general -fno-inline-functions
258 # Additionally, we wish to prevent optimisations which cause GCC to clone
259 # functions -- in particular, these may cause unhelpful symbols to be
260 # emitted instead of function names
261 CCNOAUTOINLINE= -fno-inline-small-functions \
262         -fno-inline-functions-called-once \
263         -fno-ipa-cp
266 # compiler architecture flags.
268 sparc_XARCH=    -m32 -mcpu=v8 -mno-v8plus
269 sparcv9_XARCH=  -m64 -mcpu=v9
270 i386_XARCH=     -m32 -march=pentiumpro
271 amd64_XARCH=    -m64 -Ui386 -U__i386 -mtune=opteron
273 # assembler architecture flags.  Different from compiler architecture flags.
274 sparc_AS_XARCH=         -xarch=v8plus -Dsparc -D__sparc -D__sparcv8
275 sparcv9_AS_XARCH=       -xarch=v9 -Dsparc -D__sparc -D__sparcv9
276 i386_AS_XARCH=          -m32 -Di386 -D__i386
277 amd64_AS_XARCH=         -m64 -Ui386 -U__i386 -D__x86_64 -D__amd64
280 # These flags define what we need to be 'standalone' i.e. -not- part
281 # of the rather more cosy userland environment.  This basically means
282 # the kernel.
284 # XX64  future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
286 sparc_STAND_FLAGS=      -ffreestanding
287 sparcv9_STAND_FLAGS=    -ffreestanding
288 # Disabling MMX also disables 3DNow, disabling SSE also disables all later
289 # additions to SSE (SSE2, AVX ,etc.)
290 NO_SIMD=                -mno-mmx -mno-sse
291 i386_STAND_FLAGS=       -ffreestanding $(NO_SIMD)
292 amd64_STAND_FLAGS=      -ffreestanding -mno-red-zone \
293                         -mcmodel=kernel $(NO_SIMD)
295 SAVEARGS=               -msave-args
296 amd64_STAND_FLAGS       += $(SAVEARGS)
298 STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
299 STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
302 # turn warnings into errors (C)
303 CERRWARN = -Wall -Wextra -Werror
305 CERRWARN += -Wno-missing-braces
306 CERRWARN += -Wno-sign-compare
307 CERRWARN += -Wno-unknown-pragmas
308 CERRWARN += -Wno-unused-parameter
309 CERRWARN += -Wno-missing-field-initializers
311 # Unfortunately, this option can misfire very easily and unfixably.
312 CERRWARN +=     -Wno-array-bounds
314 # DEBUG v. -nd make for frequent unused variables, empty conditions, etc. in
315 # -nd builds
316 $(RELEASE_BUILD)CERRWARN += -Wno-unused
317 $(RELEASE_BUILD)CERRWARN += -Wno-empty-body
320 # turn warnings into errors (C++)
321 CCERRWARN=              -Werror
323 # C standard.
324 CSTD_GNU89=     -std=gnu89
325 CSTD_GNU99=     -std=gnu99
326 CSTD=           $(CSTD_GNU89)
328 # In most places, assignments to these macros should be appended with +=
329 # (CPPFLAGS.first allows values to be prepended to CPPFLAGS).
330 sparc_CFLAGS=   $(sparc_XARCH)
331 sparcv9_CFLAGS= $(sparcv9_XARCH)
332 i386_CFLAGS=    $(i386_XARCH)
333 amd64_CFLAGS=   $(amd64_XARCH)
335 sparc_ASFLAGS=  $(sparc_AS_XARCH)
336 sparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
337 i386_ASFLAGS=   $(i386_AS_XARCH)
338 amd64_ASFLAGS=  $(amd64_AS_XARCH)
341 sparc_COPTFLAG=         -fno-strict-aliasing \
342         -fno-unit-at-a-time \
343         -fno-optimize-sibling-calls \
344         -O2
345 sparcv9_COPTFLAG=       -fno-strict-aliasing \
346         -fno-unit-at-a-time \
347         -fno-optimize-sibling-calls \
348         -O2
349 i386_COPTFLAG=          -O
350 amd64_COPTFLAG=         -fno-strict-aliasing \
351         -fno-unit-at-a-time \
352         -fno-optimize-sibling-calls \
353         -O2
355 COPTFLAG= $($(MACH)_COPTFLAG)
356 COPTFLAG64= $($(MACH64)_COPTFLAG)
358 # Sometimes we want all symbols and types in debugging information even
359 # if they aren't used.
360 CALLSYMS=       -fno-eliminate-unused-debug-symbols \
361                 -fno-eliminate-unused-debug-types
364 # Flags used to build in debug mode for ctf generation.  Bugs in the Devpro
365 # compilers currently prevent us from building with cc-emitted DWARF.
367 CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(CSTD) $(CDWARFSTR)
368 CTF_FLAGS_i386  = -g $(CSTD) $(CDWARFSTR)
370 CTF_FLAGS_sparcv9       = $(CTF_FLAGS_sparc)
371 CTF_FLAGS_amd64         = $(CTF_FLAGS_i386)
373 CTF_FLAGS_amd64 += $(SAVEARGS)
375 CTF_FLAGS_32    = $(CTF_FLAGS_$(MACH))
376 CTF_FLAGS_64    = $(CTF_FLAGS_$(MACH64))
377 CTF_FLAGS       = $(CTF_FLAGS_32)
380 # Flags used with genoffsets
382 GOFLAGS = $(CALLSYMS) \
383         $(CDWARFSTR)
385 OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
386         $(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
388 OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
389         $(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
391 sparc_XREGSFLAG         = -mno-app-regs
392 sparcv9_XREGSFLAG       = -mno-app-regs
393 i386_XREGSFLAG          =
394 amd64_XREGSFLAG         =
396 XREGSFLAG               = $($(MACH)_XREGSFLAG)
397 XREGSFLAG64             = $($(MACH64)_XREGSFLAG)
399 # dmake SOURCEDEBUG=yes ... enables source-level debugging information, and
400 # avoids stripping it.
401 SOURCEDEBUG     = $(POUND_SIGN)
402 SRCDBGBLD       = $(SOURCEDEBUG:yes=)
405 # These variables are intended ONLY for use by developers to safely pass extra
406 # flags to the compilers without unintentionally overriding Makefile-set
407 # flags.  They should NEVER be set to any value in a Makefile.
409 # They come last in the associated FLAGS variable such that they can
410 # explicitly override things if necessary, there are gaps in this, but it's
411 # the best we can manage.
413 CUSERFLAGS              =
414 CUSERFLAGS64            = $(CUSERFLAGS)
415 CCUSERFLAGS             =
416 CCUSERFLAGS64           = $(CCUSERFLAGS)
418 CSOURCEDEBUGFLAGS       =
419 CCSOURCEDEBUGFLAGS      =
420 $(SRCDBGBLD)CSOURCEDEBUGFLAGS   = -g
421 $(SRCDBGBLD)CCSOURCEDEBUGFLAGS  = -g
423 CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) \
424                 $(CERRWARN) $(CSTD) \
425                 $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
426                 $(CUSERFLAGS)
427 CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) \
428                 $(CERRWARN) $(CSTD) \
429                 $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
430                 $(CUSERFLAGS64)
431 ARFLAGS=        rc
433 # Flags that are used to build parts of the code that are subsequently
434 # run on the build machine (also known as the NATIVE_BUILD).
436 NATIVE_CFLAGS=  $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) \
437                 $(CERRWARN) $(CSTD) \
438                 $(CCNOAUTOINLINE) \
439                 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
441 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"       # For messaging.
442 CPPFLAGS.first= # Please keep empty.  Only lower makefiles should set this.
443 CPPFLAGS.master=$(DTEXTDOM) \
444         $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
445         $(ADJUNCT_PROTO:%=-I%/usr/include)
446 CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
447                 $(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
448 CPPFLAGS=       $(CPPFLAGS.first) $(CPPFLAGS.master)
449 AS_CPPFLAGS=    $(CPPFLAGS.first) $(CPPFLAGS.master)
452 # For source message catalogue
454 .SUFFIXES: $(SUFFIXES) .i .po
455 MSGROOT= $(ROOT)/catalog
456 MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
457 MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
458 DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
459 DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
461 CLOBBERFILES += $(POFILE) $(POFILES)
462 COMPILE.cpp= $(CC) -xc -E -C $(CFLAGS) $(CPPFLAGS)
463 XGETTEXT= /usr/bin/xgettext
464 XGETFLAGS= -c TRANSLATION_NOTE
465 BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
466         $(RM)   $@ ;\
467         $(SED) "/^domain/d" < $(<F).po > $@ ;\
468         $(RM) $(<F).po $<.i
471 # This is overwritten by local Makefile when PROG is a list.
473 POFILE= $(PROG).po
475 sparc_CCFLAGS=          -m32 mcpu=v8 mno-v8plus \
476                         -mtunesupersparc \
477                         $(CCERRWARN)
478 sparcv9_CCFLAGS=        $(sparcv9_XARCH) \
479                         $(CCERRWARN)
480 i386_CCFLAGS=           $(i386_XARCH) $(CCERRWARN)
481 amd64_CCFLAGS=          $(amd64_XARCH) \
482                         $(CCERRWARN)
484 sparc_CCOPTFLAG=        -O
485 sparcv9_CCOPTFLAG=      -O
486 i386_CCOPTFLAG=         -O
487 amd64_CCOPTFLAG=        -O
489 CCOPTFLAG=      $($(MACH)_CCOPTFLAG)
490 CCOPTFLAG64=    $($(MACH64)_CCOPTFLAG)
491 CCFLAGS=        $(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
492                 $(CCUSERFLAGS)
493 CCFLAGS64=      $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
494                 $(CCUSERFLAGS64)
499 ELFWRAP_FLAGS   =
500 ELFWRAP_FLAGS64 =       -64
503 # Various mapfiles that are used throughout the build, and delivered to
504 # /usr/lib/ld.
506 MAPFILE.PGA =           $(SRC)/common/mapfiles/common/map.pagealign
507 MAPFILE.FLT =           $(SRC)/common/mapfiles/common/map.filter
508 MAPFILE.LEX =           $(SRC)/common/mapfiles/common/map.lex.yy
511 # Generated mapfiles that are compiler specific, and used throughout the
512 # build.  These mapfiles are not delivered in /usr/lib/ld.
514 MAPFILE.NGB_sparc=      $(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
515 MAPFILE.NGB_sparcv9=    $(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
516 MAPFILE.NGB_i386=       $(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
517 MAPFILE.NGB_amd64=      $(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
518 MAPFILE.NGB =           $(MAPFILE.NGB_$(MACH))
521 # A generic interface mapfile name, used by various dynamic objects to define
522 # the interfaces and interposers the object must export.
524 MAPFILE.INT =           mapfile-intf
527 # LDLIBS32 and LDLIBS64 can be set in the environment to override the following
528 # assignments.
530 LDLIBS64 =      $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
531 LDLIBS32 =      $(ENVLDLIBS1:%=%/$(MACH32)) \
532                 $(ENVLDLIBS2:%=%/$(MACH32)) \
533                 $(ENVLDLIBS3:%=%/$(MACH32))
535 LDLIBS32 +=     $(ADJUNCT_PROTO:%=-L%/usr/lib/$(MACH32) -L%/lib/$(MACH32))
536 LDLIBS.cmd =    $(LDLIBS32)
537 LDLIBS.lib =    $(LDLIBS32)
539 LDLIBS64 +=     $(ADJUNCT_PROTO:%=-L%/usr/lib -L%/lib)
542 # Define compilation macros.
544 COMPILE.c=      $(CC) $(CFLAGS) $(CPPFLAGS) -c
545 COMPILE64.c=    $(CC) $(CFLAGS64) $(CPPFLAGS) -c
546 COMPILE.cc=     $(CCC) $(CCFLAGS) $(CPPFLAGS) -c
547 COMPILE64.cc=   $(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
548 COMPILE.s=      $(AS) $(ASFLAGS) $(AS_CPPFLAGS)
549 COMPILE32.s=    $(AS) $(ASFLAGS) $($(MACH32)_AS_XARCH) $(AS_CPPFLAGS)
550 COMPILE64.s=    $(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
551 COMPILE.d=      $(DTRACE) -G -32
552 COMPILE64.d=    $(DTRACE) -G -64
553 COMPILE.b=      $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
554 COMPILE64.b=    $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
557 # Link time macros
559 CCNEEDED        = -L$(GCCLIBDIR) -lstdc++ -lgcc -R$(GCCLIBDIR)
560 CCEXTNEEDED     = $(CCNEEDED)
562 LINK.c=         $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
563 LINK64.c=       $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
564 LINK.cc=        $(CCC) $(CCFLAGS) $(CPPFLAGS) \
565                 $(LDFLAGS) $(CCNEEDED)
566 LINK64.cc=      $(CCC) $(CCFLAGS64) $(CPPFLAGS) \
567                 $(LDFLAGS) $(CCNEEDED)
569 SECLEVEL=       core
571 NATIVE_MACH=    $(MACH64)
573 # Define native compilation macros
576 # Base directory where compilers are located.
577 # Defined here so it can be overridden by developers.
579 GNU_ROOT=               /usr
581 BASIC_CC_ARGS=  -fident \
582                 -finline \
583                 -fno-inline-functions \
584                 -fno-builtin \
585                 -fno-asm \
586                 -fdiagnostics-show-option
588 # The SPARC ldd and std instructions require 8-byte alignment of their
589 # address operand.  gcc correctly uses them only when the ABI requires
590 # 8-byte alignment; unfortunately we have a number of pieces of buggy code
591 # that does not conform to the ABI.  This flag makes gcc work more like
592 # Studio with -xmemalign=4.
593 $(SPARC_BLD)BASIC_CC_ARGS += mno-integer-ldd-std
595 BASIC_CC_ARGS += -D__sun
597 BASIC_AS_ARGS=  -x assembler-with-cpp \
598                 -c \
599                 -Wa,--warn \
600                 -Wa,--fatal-warnings \
601                 -Wa,--traditional-format \
602                 -D__GNUC_AS__
604 # Specify platform compiler versions for languages
605 # that we use (currently only c and c++).
607 sparc_CC=               /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
608 sparc_CCC=              /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
609 sparc_CPP=              $(GNUC_ROOT)/bin/cpp
610 sparc_AS=               /usr/bin/as -xregsym=no
611 sparc_LD=               /usr/bin/ld.sun
613 sparcv9_CC=             /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
614 sparcv9_CCC=            /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
615 sparcv9_CPP=            $(GNUC_ROOT)/bin/cpp
616 sparcv9_AS=             /usr/bin/as -xregsym=no
617 sparcv9_LD=             /usr/bin/ld.sun
619 i386_CC=                /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS) -nodefaultlibs
620 i386_CCC=               /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
621 i386_CPP=               $(GNUC_ROOT)/bin/cpp
622 i386_AS=                $(GNUC_ROOT)/bin/gcc $(BASIC_AS_ARGS)
623 i386_LD=                /usr/bin/ld.sun
625 amd64_CC=               /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS) -nodefaultlibs
626 amd64_CCC=              /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
627 amd64_CPP=              $(GNUC_ROOT)/bin/cpp
628 amd64_AS=               $(GNUC_ROOT)/bin/gcc $(BASIC_AS_ARGS)
629 amd64_LD=               /usr/bin/ld.sun
631 NATIVECC=               $($(NATIVE_MACH)_CC)
632 NATIVECCC=              $($(NATIVE_MACH)_CCC)
633 NATIVECPP=              $($(NATIVE_MACH)_CPP)
634 NATIVEAS=               $($(NATIVE_MACH)_AS)
635 NATIVELD=               $($(NATIVE_MACH)_LD)
638 # Makefile.master.64 overrides these settings
640 CC=                     $(NATIVECC)
641 CCC=                    $(NATIVECCC)
642 CPP=                    $(NATIVECPP)
643 AS=                     $(NATIVEAS)
644 LD=                     $(NATIVELD)
646 CCYFLAG=        -nostdinc
648 LD_BDIRECT=     -Bdirect
649 LD_BDYNAMIC=    -Bdynamic
650 LD_BLOCAL=      -Blocal
651 LD_BNODIRECT=   -Bnodirect
652 LD_BREDUCE=     -Breduce
653 LD_BSTATIC=     -Bstatic
655 BDIRECT=        $(LD_BDIRECT:%=-Wl,%)
656 BDYNAMIC=       $(LD_BDYNAMIC:%=-Wl,%)
657 BLOCAL=         $(LD_BLOCAL:%=-Wl,%)
658 BNODIRECT=      $(LD_BNODIRECT:%=-Wl,%)
659 BREDUCE=        $(LD_BREDUCE:%=-Wl,%)
660 BSTATIC=        $(LD_BSTATIC:%=-Wl,%)
662 LD_ZDEFS=               -zdefs
663 LD_ZDIRECT=             -zdirect
664 LD_ZIGNORE=             -zignore
665 LD_ZINITFIRST=          -zinitfirst
666 LD_ZINTERPOSE=          -zinterpose
667 LD_ZLAZYLOAD=           -zlazyload
668 LD_ZLOADFLTR=           -zloadfltr
669 LD_ZNODEFS=             -znodefs
670 LD_ZNODELETE=           -znodelete
671 LD_ZNODLOPEN=           -znodlopen
672 LD_ZNODUMP=             -znodump
673 LD_ZNOLAZYLOAD=         -znolazyload
674 LD_ZNOLDYNSYM=          -znoldynsym
675 LD_ZNORELOC=            -znoreloc
676 LD_ZNOVERSION=          -znoversion
677 LD_ZRECORD=             -zrecord
678 LD_ZTEXT=               -ztext
680 ZDEFS=          $(LD_ZDEFS:%=-Wl,%)
681 ZDIRECT=        $(LD_ZDIRECT:%=-Wl,%)
682 ZIGNORE=        $(LD_ZIGNORE:%=-Wl,%)
683 ZINITFIRST=     $(LD_ZINITFIRST:%=-Wl,%)
684 ZINTERPOSE=     $(LD_ZINTERPOSE:%=-Wl,%)
685 ZLAZYLOAD=      $(LD_ZLAZYLOAD:%=-Wl,%)
686 ZLOADFLTR=      $(LD_ZLOADFLTR:%=-Wl,%)
687 ZNODEFS=        $(LD_ZNODEFS:%=-Wl,%)
688 ZNODELETE=      $(LD_ZNODELETE:%=-Wl,%)
689 ZNODLOPEN=      $(LD_ZNODLOPEN:%=-Wl,%)
690 ZNODUMP=        $(LD_ZNODUMP:%=-Wl,%)
691 ZNOLAZYLOAD=    $(LD_ZNOLAZYLOAD:%=-Wl,%)
692 ZNOLDYNSYM=     $(LD_ZNOLDYNSYM:%=-Wl,%)
693 NORELOC=        $(LD_ZNORELOC:%=-Wl,%)
694 ZNOVERSION=     $(LD_ZNOVERSION:%=-Wl,%)
695 ZRECORD=        $(LD_ZRECORD:%=-Wl,%)
696 ZTEXT=          $(LD_ZTEXT:%=-Wl,%)
698 GSHARED=        -shared
700 # Handle different PIC models on different ISAs
701 # (May be overridden by lower-level Makefiles)
703 sparc_C_PICFLAGS =      -fpic
704 sparcv9_C_PICFLAGS =    -fpic
705 i386_C_PICFLAGS =       -fpic
706 amd64_C_PICFLAGS =      -fpic
707 C_PICFLAGS =            $($(MACH)_C_PICFLAGS)
708 C_PICFLAGS64 =          $($(MACH64)_C_PICFLAGS)
710 sparc_C_BIGPICFLAGS =   -fPIC
711 sparcv9_C_BIGPICFLAGS = -fPIC
712 i386_C_BIGPICFLAGS =    -fPIC
713 amd64_C_BIGPICFLAGS =   -fPIC
714 C_BIGPICFLAGS =         $($(MACH)_C_BIGPICFLAGS)
715 C_BIGPICFLAGS64 =       $($(MACH64)_C_BIGPICFLAGS)
717 # CC requires there to be no space between '-K' and 'pic' or 'PIC'.
718 sparc_CC_PICFLAGS =     -fpic
719 sparcv9_CC_PICFLAGS =   -fPIC
720 i386_CC_PICFLAGS =      -fpic
721 amd64_CC_PICFLAGS =     -fpic
722 CC_PICFLAGS =           $($(MACH)_CC_PICFLAGS)
723 CC_PICFLAGS64 =         $($(MACH64)_CC_PICFLAGS)
725 AS_PICFLAGS=
726 AS_BIGPICFLAGS=
729 # Default label for CTF sections
731 CTFCVTFLAGS=            -i -L VERSION
734 # Override to pass module-specific flags to ctfmerge.  Currently used only by
735 # krtld to turn on fuzzy matching, and source-level debugging to inhibit
736 # stripping.
738 CTFMRGFLAGS=
740 CTFCONVERT_O            = $(CTFCONVERT) $(CTFCVTFLAGS) $@
742 # Rules (normally from make.rules) and macros which are used for post
743 # processing files. Normally, these do stripping of the comment section
744 # automatically.
745 #    RELEASE_CM:        Should be editted to reflect the release.
746 #    POST_PROCESS_O:    Post-processing for `.o' files.
747 #    POST_PROCESS_A:    Post-processing for `.a' files (currently null).
748 #    POST_PROCESS_SO:   Post-processing for `.so' files.
749 #    POST_PROCESS:      Post-processing for executable files (no suffix).
750 # Note that these macros are not completely generalized as they are to be
751 # used with the file name to be processed following.
753 # It is left as an exercise to Release Engineering to embellish the generation
754 # of the release comment string.
756 #       If this is a standard development build:
757 #               compress the comment section (mcs -c)
758 #               add the standard comment (mcs -a $(RELEASE_CM))
759 #               add the development specific comment (mcs -a $(DEV_CM))
761 #       If this is an installation build:
762 #               delete the comment section (mcs -d)
763 #               add the standard comment (mcs -a $(RELEASE_CM))
764 #               add the development specific comment (mcs -a $(DEV_CM))
766 #       If this is an release build:
767 #               delete the comment section (mcs -d)
768 #               add the standard comment (mcs -a $(RELEASE_CM))
770 # The following list of macros are used in the definition of RELEASE_CM
771 # which is used to label all binaries in the build:
773 #       RELEASE         Specific release of the build, eg: 5.2
774 #       RELEASE_MAJOR   Major version number part of $(RELEASE)
775 #       RELEASE_MINOR   Minor version number part of $(RELEASE)
776 #       VERSION         Version of the build (alpha, beta, Generic)
777 #       PATCHID         If this is a patch this value should contain
778 #                       the patchid value (eg: "Generic 100832-01"), otherwise
779 #                       it will be set to $(VERSION)
780 #       RELEASE_DATE    Date of the Release Build
781 #       PATCH_DATE      Date the patch was created, if this is blank it
782 #                       will default to the RELEASE_DATE
784 SYSNAME=        SunOS
785 RELEASE_MAJOR=  5
786 RELEASE_MINOR=  11
787 RELEASE=        $(RELEASE_MAJOR).$(RELEASE_MINOR)
788 VERSION=        $(SYSNAME) Development
789 PATCHID=        $(VERSION)
790 RELEASE_DATE=   release date not set
791 PATCH_DATE=     $(RELEASE_DATE)
792 RELEASE_CM=     "$(SYSNAME) $(RELEASE) $(PATCHID) $(PATCH_DATE)"
793 DEV_CM=         "$(SYSNAME) Development: non-nightly build"
795 STRIP_STABS=                       $(STRIP) -x $@
796 $(SRCDBGBLD)STRIP_STABS=           :
798 POST_PROCESS_O=         :
799 POST_PROCESS_A=         :
800 POST_PROCESS_SO=        $(STRIP_STABS)
801 POST_PROCESS=           $(STRIP_STABS)
804 # PKGARCHIVE specifies the default location where packages should be
805 # placed if built.
807 PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly
810 # The repositories will be created with these publisher settings.  To
811 # update an image to the resulting repositories, this must match the
812 # publisher name provided to "pkg set-publisher."
814 PKGPUBLISHER=   unleashed
816 #       Default build rules which perform comment section post-processing.
819         $(LINK.c) -o $@ $< $(LDLIBS)
820         $(POST_PROCESS)
821 .c.o:
822         $(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
823         $(POST_PROCESS_O)
824 .c.a:
825         $(COMPILE.c) -o $% $<
826         $(AR) $(ARFLAGS) $@ $%
827         $(RM) $%
828 .s.o:
829         $(COMPILE.s) -o $@ $<
830         $(POST_PROCESS_O)
831 .s.a:
832         $(COMPILE.s) -o $% $<
833         $(AR) $(ARFLAGS) $@ $%
834         $(RM) $%
835 .cc:
836         $(LINK.cc) -o $@ $< $(LDLIBS)
837         $(POST_PROCESS)
838 .cc.o:
839         $(COMPILE.cc) $(OUTPUT_OPTION) $<
840         $(POST_PROCESS_O)
841 .cc.a:
842         $(COMPILE.cc) -o $% $<
843         $(AR) $(ARFLAGS) $@ $%
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) \
901                 -e "1s:^\#!@PYTHON@:\#!$(PYSHEBANG):" \
902                 -e "1s:^\#!@TOOLS_PYTHON@:\#!$(TOOLS_PYTHON):" \
903                 < $< > $@; $(CHMOD) +x $@
905 .py.pyc:
906         $(RM) $@
907         $(PYTHON) -mpy_compile $<
908         @[ $(<)c = $@ ] || $(MV) $(<)c $@
910 .pl.po .pm.po:
911         $(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
912         $(RM)   $@ ;
913         $(SED) "/^domain/d" < $(<F).po > $@ ;
914         $(RM) $(<F).po
917 # When using xgettext, we want messages to go to the default domain,
918 # rather than the specified one.  This special version of the
919 # COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
920 # causing xgettext to put all messages into the default domain.
922 CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
924 .c.i:
925         $(CPPFORPO) $< > $@
927 .h.i:
928         $(CPPFORPO) $< > $@
930 .y.i:
931         $(YACC) -d $<
932         $(CPPFORPO) y.tab.c  > $@
933         $(RM) y.tab.c
935 .l.i:
936         $(LEX) $<
937         $(CPPFORPO) lex.yy.c  > $@
938         $(RM) lex.yy.c
940 .c.po:
941         $(CPPFORPO) $< > $<.i
942         $(BUILD.po)
944 .cc.po:
945         $(CPPFORPO) $< > $<.i
946         $(BUILD.po)
948 .y.po:
949         $(YACC) -d $<
950         $(CPPFORPO) y.tab.c  > $<.i
951         $(BUILD.po)
952         $(RM) y.tab.c
954 .l.po:
955         $(LEX) $<
956         $(CPPFORPO) lex.yy.c  > $<.i
957         $(BUILD.po)
958         $(RM) lex.yy.c
961 # Rules to perform stylistic checks
963 .SUFFIXES: .x .xml .check .xmlchk
965 .h.check:
966         $(DOT_H_CHECK)
968 .x.check:
969         $(DOT_X_CHECK)
971 .xml.xmlchk:
972         $(MANIFEST_CHECK)