make/common/Defs-solaris.gmk

changeset 1
55540e827aef
child 158
91006f157c46
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/common/Defs-solaris.gmk	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,644 @@
     1.4 +#
     1.5 +# Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Sun designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Sun in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.25 +# CA 95054 USA or visit www.sun.com if you need additional information or
    1.26 +# have any questions.
    1.27 +#
    1.28 +
    1.29 +#
    1.30 +# Makefile to specify compiler flags for programs and libraries
    1.31 +# targeted to Solaris.  Should not contain any rules.
    1.32 +#
    1.33 +
    1.34 +# Warning: the following variables are overridden by Defs.gmk. Set
    1.35 +# values will be silently ignored:
    1.36 +#   CFLAGS        (set $(OTHER_CFLAGS) instead)
    1.37 +#   CPPFLAGS      (set $(OTHER_CPPFLAGS) instead)
    1.38 +#   CXXFLAGS      (set $(OTHER_CXXFLAGS) instead)
    1.39 +#   LDFLAGS       (set $(OTHER_LDFAGS) instead)
    1.40 +#   LDLIBS        (set $(EXTRA_LIBS) instead)
    1.41 +#   LDLIBS_COMMON (set $(EXTRA_LIBS) instead)
    1.42 +#   LINTFLAGS     (set $(OTHER_LINTFLAGS) instead)
    1.43 +
    1.44 +# Get shared JDK settings
    1.45 +include $(BUILDDIR)/common/shared/Defs.gmk
    1.46 +
    1.47 +ifndef PLATFORM_SRC
    1.48 +PLATFORM_SRC = $(TOPDIR)/src/solaris
    1.49 +endif # PLATFORM_SRC
    1.50 +
    1.51 +# platform specific include files
    1.52 +PLATFORM_INCLUDE_NAME = $(PLATFORM)
    1.53 +PLATFORM_INCLUDE      = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
    1.54 +
    1.55 +# suffix used for make dependencies files
    1.56 +DEPEND_SUFFIX = d
    1.57 +# suffix used for lint files
    1.58 +LINT_SUFFIX = ln
    1.59 +# The suffix applied to the library name for FDLIBM
    1.60 +FDDLIBM_SUFFIX = a
    1.61 +# The suffix applied to scripts (.bat for windows, nothing for unix)
    1.62 +SCRIPT_SUFFIX =
    1.63 +# CC compiler object code output directive flag value
    1.64 +CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
    1.65 +CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
    1.66 +
    1.67 +#
    1.68 +# Default HPI libraries. Build will build only native unless
    1.69 +# overriden at the make command line. This makes it convenient for
    1.70 +# people doing, say, a pthreads port -- they can create a posix
    1.71 +# directory here, and say "gnumake HPIS=posix" at the top
    1.72 +# level.
    1.73 +#
    1.74 +HPIS = native
    1.75 +
    1.76 +#
    1.77 +# Java default optimization (-x04/-O2) etc.  Applies to the VM.
    1.78 +#
    1.79 +ifeq ($(PRODUCT), java)
    1.80 +    _OPT = $(CC_HIGHER_OPT)
    1.81 +else
    1.82 +    _OPT = $(CC_LOWER_OPT)
    1.83 +    CPPFLAGS_DBG    += -DLOGGING -DDBINFO
    1.84 +endif
    1.85 +
    1.86 +#
    1.87 +# If -Xa is in CFLAGS_COMMON it will end up ahead of $(POPT) for the
    1.88 +# optimized build, and that ordering of the flags completely freaks
    1.89 +# out cc.  Hence, -Xa is instead in each CFLAGS variant.
    1.90 +#
    1.91 +# The more unusual options to the Sun C compiler:
    1.92 +#	-v		Stricter type checking, more error checking
    1.93 +#			(To turn ALL warnings into fatals, use -errwarn=%all)
    1.94 +#	-xstrconst	Place string literals and constants in read-only area
    1.95 +#			(means you can't write on your string literals)
    1.96 +#	-xs		Force debug information (stabs) into the .so or a.out
    1.97 +#			(makes the library/executable debuggable without the
    1.98 +#			.o files needing to be around, but at a space cost)
    1.99 +#	-g & -O		If you add the -g option to the optimized compiles
   1.100 +#			you will get better stack retraces, the code is
   1.101 +#			still optimized. This includes a space cost too.
   1.102 +#       -xc99=%none     Do NOT allow for c99 extensions to be used.
   1.103 +#                       e.g. declarations must precede statements
   1.104 +#       -xCC            Allow the C++ style of comments in C: //
   1.105 +#                       Required with many of the source files.
   1.106 +#       -mt             Assume multi-threaded (important)
   1.107 +#
   1.108 +
   1.109 +#
   1.110 +# Debug flag for C and C++ compiler
   1.111 +#
   1.112 +CFLAGS_DEBUG_OPTION=-g
   1.113 +CXXFLAGS_DEBUG_OPTION=-g
   1.114 +
   1.115 +# Turn off -g if we are doing tcov build
   1.116 +ifdef TCOV_BUILD
   1.117 +  CFLAGS_DEBUG_OPTION=
   1.118 +  CXXFLAGS_DEBUG_OPTION=
   1.119 +endif
   1.120 +
   1.121 +# FASTDEBUG: Optimize the -g builds, gives us a faster debug java
   1.122 +#        If true adds -O to the debug compiles. This allows for any assert
   1.123 +#        tests to remain and debug checking. The resulting code is faster
   1.124 +#        but less debuggable.  Stack traces are still valid, although only
   1.125 +#        approximate line numbers are given. Printing of local variables
   1.126 +#        during a debugging session is not possible, but stepping and
   1.127 +#        printing of global or static variables should be possible.
   1.128 +#        Performance/size of files should be about the same, maybe smaller.
   1.129 +#
   1.130 +ifeq ($(FASTDEBUG), true)
   1.131 +  CC_FASTDEBUG_OPT       = $(CC_LOWER_OPT)
   1.132 +  CFLAGS_DEBUG_OPTION    = -g   $(CC_FASTDEBUG_OPT)
   1.133 +  CXXFLAGS_DEBUG_OPTION  = -g0  $(CC_FASTDEBUG_OPT)
   1.134 +endif
   1.135 +
   1.136 +CFLAGS_COMMON   = -v -mt -L$(OBJDIR) -xc99=%none
   1.137 +CFLAGS_COMMON  += -xCC
   1.138 +CFLAGS_COMMON  += -errshort=tags
   1.139 +CFLAGS_OPT      = $(POPT)
   1.140 +CFLAGS_DBG      = $(CFLAGS_DEBUG_OPTION)
   1.141 +CFLAGS_COMMON  +=  -Xa $(CFLAGS_REQUIRED)
   1.142 +
   1.143 +# Assume MT behavior all the time (important)
   1.144 +CXXFLAGS_COMMON  = -mt
   1.145 +
   1.146 +# Assume no C++ exceptions are used
   1.147 +CXXFLAGS_COMMON += -features=no%except -DCC_NOEX
   1.148 +
   1.149 +# For C++, these options tell it to assume nothing about locating libraries
   1.150 +#    either at compile time, or at runtime. Use of these options will likely
   1.151 +#    require the use of -L and -R options to indicate where libraries will
   1.152 +#    be found at compile time (-L) and at runtime (-R).
   1.153 +#    The /usr/lib location comes for free, so no need to specify that one.
   1.154 +#    Note: C is much simplier and there is no need for these options. This
   1.155 +#          is mostly needed to avoid dependencies on libraries in the
   1.156 +#          Compiler install area, also see LIBCXX and LIBM.
   1.157 +CXXFLAGS_COMMON += -norunpath -xnolib
   1.158 +
   1.159 +#
   1.160 +# Treat compiler warnings as errors, if requested
   1.161 +#
   1.162 +ifeq ($(COMPILER_WARNINGS_FATAL),true)
   1.163 +  CFLAGS_COMMON += -errwarn=%all
   1.164 +  CXXFLAGS_COMMON += -errwarn=%all
   1.165 +endif
   1.166 +
   1.167 +CXXFLAGS_OPT	= $(POPT)
   1.168 +CXXFLAGS_DBG	= $(CXXFLAGS_DEBUG_OPTION)
   1.169 +CXXFLAGS_COMMON += $(CFLAGS_REQUIRED)
   1.170 +
   1.171 +# Add -xstrconst to the library compiles. This forces all string
   1.172 +#  literals into the read-only data section, which prevents them from
   1.173 +#  being written to and increases the runtime pages shared on the system.
   1.174 +#
   1.175 +ifdef LIBRARY
   1.176 +  CFLAGS_COMMON +=-xstrconst
   1.177 +endif
   1.178 +
   1.179 +# Source browser database
   1.180 +#
   1.181 +# COMPILE_WITH_SB    
   1.182 +#        If defined adds -xsb to compiles and creates a
   1.183 +#        source browsing database during compilation.
   1.184 +#
   1.185 +ifdef COMPILE_WITH_SB
   1.186 +  ifeq ($(LIBRARY), java)
   1.187 +    CFLAGS_DBG +=   -xsb
   1.188 +  endif
   1.189 +endif
   1.190 +
   1.191 +# Lint Flags:
   1.192 +#	-Xa			ANSI C plus K&R, favor ANSI rules
   1.193 +#       -Xarch=XXX		Same as 'cc -xarch=XXX'
   1.194 +#	-fd			report on old style func defs
   1.195 +#	-errchk=structarg	report on 64bit struct args by value
   1.196 +#	-errchk=longptr64	report on 64bit to 32bit issues (ignores casts)
   1.197 +#	-errchk=parentheses	report on suggested use of extra parens
   1.198 +#	-v 			suppress unused args
   1.199 +#	-x			suppress unused externs
   1.200 +#	-u			suppress extern func/vars used/defined
   1.201 +#	-errfmt=simple		use one line errors with position info
   1.202 +
   1.203 +LINTFLAGS_COMMON  = -Xa
   1.204 +LINTFLAGS_COMMON += -fd 
   1.205 +LINTFLAGS_COMMON += -errchk=structarg,longptr64,parentheses
   1.206 +LINTFLAGS_COMMON += -v
   1.207 +LINTFLAGS_COMMON += -x 
   1.208 +LINTFLAGS_COMMON += -u
   1.209 +LINTFLAGS_COMMON += -errfmt=simple 
   1.210 +LINTFLAGS_OPT   = 
   1.211 +LINTFLAGS_DBG   =
   1.212 +
   1.213 +# The -W0,-noglobal tells the compiler to NOT generate mangled global
   1.214 +#    ELF data symbols for file local static data.
   1.215 +#    This can break fix&continue, but we'd rather do the same compilations
   1.216 +#    for deliverable bits as we do for non-deliverable bits
   1.217 +#    Tell the compilers to never generate globalized names, all the time.
   1.218 +CFLAGS_COMMON += -W0,-noglobal
   1.219 +
   1.220 +# Arch specific settings (determines type of .o files and instruction set)
   1.221 +ifeq ($(ARCH_FAMILY), sparc)
   1.222 +  ifdef VIS_NEEDED
   1.223 +    XARCH_VALUE/32=v8plusa
   1.224 +    XARCH_VALUE/64=v9a
   1.225 +  else 
   1.226 +    # Someday this should change to improve optimization on UltraSPARC
   1.227 +    #    and abandon the old v8-only machines like the SPARCstation 10.
   1.228 +    #    Indications with Mustang is that alacrity runs do not show a
   1.229 +    #    big improvement using v8plus over v8, but other benchmarks might.
   1.230 +    XARCH_VALUE/32=v8
   1.231 +    XARCH_VALUE/64=v9
   1.232 +  endif
   1.233 +endif
   1.234 +ifeq ($(ARCH_FAMILY), i586)
   1.235 +  XARCH_VALUE/64=amd64
   1.236 +  XARCH_VALUE/32=
   1.237 +endif
   1.238 +
   1.239 +# Arch value based on current data model being built
   1.240 +XARCH_VALUE=$(XARCH_VALUE/$(ARCH_DATA_MODEL))
   1.241 +ifneq ($(XARCH_VALUE), )
   1.242 +  # The actual compiler -xarch options to use
   1.243 +  XARCH_OPTION/32 = -xarch=$(XARCH_VALUE/32)
   1.244 +  XARCH_OPTION/64 = -xarch=$(XARCH_VALUE/64)
   1.245 +  XARCH_OPTION    = $(XARCH_OPTION/$(ARCH_DATA_MODEL))
   1.246 +endif
   1.247 +
   1.248 +# If we have a specific -xarch value to use, add it
   1.249 +ifdef XARCH_OPTION
   1.250 +  CFLAGS_COMMON    += $(XARCH_OPTION)
   1.251 +  CXXFLAGS_COMMON  += $(XARCH_OPTION)
   1.252 +  ASFLAGS_COMMON   += $(XARCH_OPTION)
   1.253 +  EXTRA_LIBS       += $(XARCH_OPTION)
   1.254 +  LINTFLAGS_COMMON += -Xarch=$(XARCH_VALUE)
   1.255 +endif
   1.256 +
   1.257 +#
   1.258 +# uncomment the following to build with PERTURBALOT set
   1.259 +#
   1.260 +# OTHER_CFLAGS += -DPERTURBALOT
   1.261 +#
   1.262 +
   1.263 +CPPFLAGS_COMMON = -D$(ARCH_FAMILY) -D__solaris__ -D_REENTRANT 
   1.264 +CPPFLAGS_OPT    = 
   1.265 +CPPFLAGS_DBG    = -DDEBUG
   1.266 +
   1.267 +ifeq ($(ARCH_FAMILY), i586)
   1.268 +  # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
   1.269 +  #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
   1.270 +  #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
   1.271 +  #   Note: -Dmacro         is the same as    #define macro 1
   1.272 +  #         -Dmacro=	    is the same as    #define macro
   1.273 +  #
   1.274 +  CPPFLAGS_COMMON +=  -DcpuIntel -D_LITTLE_ENDIAN= -D$(LIBARCH)
   1.275 +  # Turn off a superfluous compiler error message on Intel
   1.276 +  CFLAGS_COMMON += -erroff=E_BAD_PRAGMA_PACK_VALUE
   1.277 +endif
   1.278 +
   1.279 +# Java memory management is based on memory mapping by default, but a
   1.280 +# system only assuming malloc/free can be built by adding -DUSE_MALLOC 
   1.281 +
   1.282 +CPPFLAGS_COMMON	+= -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS
   1.283 +CPPFLAGS_OPT	+= -DTRIMMED
   1.284 +
   1.285 +LDFLAGS_DEFS_OPTION  = -z defs
   1.286 +LDFLAGS_COMMON  += $(LDFLAGS_DEFS_OPTION)
   1.287 +
   1.288 +#
   1.289 +# -L paths for finding and -ljava
   1.290 +#
   1.291 +LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
   1.292 +LDFLAGS_OPT     =
   1.293 +LDFLAGS_DBG     =
   1.294 +
   1.295 +#
   1.296 +# We never really want the incremental linker, ever
   1.297 +#    The -xildoff option tells Sun's compilers to NOT use incremental linker
   1.298 +#
   1.299 +LDFLAGS_COMMON  += -xildoff
   1.300 +
   1.301 +ifdef LIBRARY
   1.302 +  # Libraries need to locate other libraries at runtime, and you can tell
   1.303 +  #   a library where to look by way of the dynamic runpaths (RPATH or RUNPATH)
   1.304 +  #   buried inside the .so. The $ORIGIN says to look relative to where
   1.305 +  #   the library itself is and it can be followed with relative paths from
   1.306 +  #   that. By default we always look in $ORIGIN, optionally we add relative
   1.307 +  #   paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths.
   1.308 +  #   The environment variable LD_LIBRARY_PATH will over-ride these runpaths.
   1.309 +  #   Try: 'dump -Lv lib*.so' to see these settings in a library.
   1.310 +  #
   1.311 +  LDFLAGS_COMMON += -R\$$ORIGIN
   1.312 +  LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-R\$$ORIGIN/%)
   1.313 +endif
   1.314 +
   1.315 +EXTRA_LIBS += -lc
   1.316 +
   1.317 +# Postprocessing is done on the images directories only
   1.318 +#
   1.319 +ifeq ($(VARIANT), OPT)
   1.320 +  ifeq ($(PARTIAL_GPROF), true)
   1.321 +    NO_STRIP = true
   1.322 +  endif
   1.323 +  ifeq ($(GPROF), true)
   1.324 +    NO_STRIP = true
   1.325 +  endif
   1.326 +  ifneq ($(NO_STRIP), true)
   1.327 +    # Debug 'strip -x' leaves local function Elf symbols (better stack traces)
   1.328 +    POST_STRIP_PROCESS = $(STRIP) -x
   1.329 +  endif
   1.330 +endif
   1.331 +POST_MCS_PROCESS=$(MCS) -d -a "JDK $(FULL_VERSION)"
   1.332 +
   1.333 +#
   1.334 +# Sun C compiler will take -M and pass it on to ld.
   1.335 +# Usage: ld $(LD_MAPFILE_FLAG) mapfile *.o
   1.336 +#
   1.337 +ifeq ($(CC_VERSION),gcc)
   1.338 +LD_MAPFILE_FLAG = -Xlinker -M -Xlinker
   1.339 +else
   1.340 +LD_MAPFILE_FLAG = -M
   1.341 +endif
   1.342 +
   1.343 +#
   1.344 +# Variables globally settable from the make command line (default
   1.345 +# values in brackets):
   1.346 +#	GPROF (false)
   1.347 +# Eg: 	% gnumake GPROF=true
   1.348 +GPROF = false
   1.349 +ifeq ($(GPROF), true)
   1.350 +    CFLAGS_COMMON += -DGPROF -xpg
   1.351 +    EXTRA_LIBS += -xpg
   1.352 +endif
   1.353 +
   1.354 +# PARTIAL_GPROF is to be used ONLY during compilation - it should not
   1.355 +# appear during linking of libraries or programs.  It also should
   1.356 +# prevent linking with -z defs to allow a symbol to remain undefined.
   1.357 +#
   1.358 +PARTIAL_GPROF = false
   1.359 +ifeq ($(PARTIAL_GPROF), true)
   1.360 +  CFLAGS_GPROF += -xpg
   1.361 +  LDFLAGS_DEFS_OPTION  = -z nodefs
   1.362 +endif
   1.363 +
   1.364 +#
   1.365 +# For a TCOV build we add in the TCOV_OPTION
   1.366 +#
   1.367 +ifdef TCOV_BUILD
   1.368 +  TCOV_OPTION		= -xprofile=tcov
   1.369 +  LDFLAGS_COMMON 	+= $(TCOV_OPTION) -Kpic
   1.370 +  CFLAGS_COMMON  	+= $(TCOV_OPTION)
   1.371 +  CXXFLAGS_COMMON 	+= $(TCOV_OPTION)
   1.372 +  EXTRA_LIBS 	+= $(TCOV_OPTION)
   1.373 +  LDNOMAP=true
   1.374 +endif
   1.375 +
   1.376 +#
   1.377 +# Solaris only uses native threads. 
   1.378 +#
   1.379 +THREADS_FLAG=	native
   1.380 +THREADS_DIR=	threads
   1.381 +
   1.382 +#
   1.383 +# Support for Quantify.
   1.384 +#
   1.385 +ifdef QUANTIFY
   1.386 +  QUANTIFY_CMD = quantify
   1.387 +  QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
   1.388 +  LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS)
   1.389 +  ifdef LIBRARY
   1.390 +    CFLAGS_COMMON += -K PIC
   1.391 +  endif
   1.392 +endif
   1.393 +
   1.394 +#
   1.395 +# Support for Purify.
   1.396 +#
   1.397 +ifdef PURIFY
   1.398 +  PURIFY_CMD = /net/suntools.eng/export/tools/sparc/bin/purify
   1.399 +  PURIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
   1.400 +  LINK_PRE_CMD = $(PURIFY_CMD) $(PURIFY_OPTIONS)
   1.401 +  ifdef LIBRARY
   1.402 +    CFLAGS_COMMON += -K PIC
   1.403 +  endif
   1.404 +endif
   1.405 +
   1.406 +#
   1.407 +# Different "levels" of optimization.
   1.408 +#
   1.409 +ifeq ($(CC_VERSION),gcc)
   1.410 +  CC_HIGHEST_OPT = -O3
   1.411 +  CC_HIGHER_OPT  = -O3
   1.412 +  CC_LOWER_OPT   = -O2
   1.413 +  CFLAGS_REQUIRED_i586  += -fno-omit-frame-pointer
   1.414 +  CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer
   1.415 +  # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
   1.416 +  #   (See Rules.gmk) May need to wait for gcc 5?
   1.417 +  AUTOMATIC_PCH_OPTION = 
   1.418 +else
   1.419 +  # Highest could be -xO5, but indications are that -xO5 should be reserved
   1.420 +  #    for a per-file use, on sources with known performance impacts.
   1.421 +  CC_HIGHEST_OPT = -xO4
   1.422 +  CC_HIGHER_OPT  = -xO4
   1.423 +  CC_LOWER_OPT   = -xO2
   1.424 +  #
   1.425 +  # WARNING: Use of _OPT=$(CC_HIGHEST_OPT) in your Makefile needs to be
   1.426 +  #          done with care, there are some assumptions below that need to
   1.427 +  #          be understood about the use of pointers, and IEEE behavior.
   1.428 +  #
   1.429 +  # Use non-standard floating point mode (not IEEE 754)
   1.430 +  CC_HIGHEST_OPT += -fns
   1.431 +  # Do some simplification of floating point arithmetic (not IEEE 754)
   1.432 +  CC_HIGHEST_OPT += -fsimple
   1.433 +  # Use single precision floating point with 'float'
   1.434 +  CC_HIGHEST_OPT += -fsingle
   1.435 +  # Assume memory references via basic pointer types do not alias
   1.436 +  #   (Source with excessing pointer casting and data access with mixed 
   1.437 +  #    pointer types are not recommended)
   1.438 +  CC_HIGHEST_OPT += -xalias_level=basic
   1.439 +  # Use intrinsic or inline versions for math/std functions
   1.440 +  #   (If you expect perfect errno behavior, do not use this)
   1.441 +  CC_HIGHEST_OPT += -xbuiltin=%all
   1.442 +  # Loop data dependency optimizations (need -xO3 or higher)
   1.443 +  CC_HIGHEST_OPT += -xdepend
   1.444 +  # Pointer parameters to functions do not overlap
   1.445 +  #   (Similar to -xalias_level=basic usage, but less obvious sometimes.
   1.446 +  #    If you pass in multiple pointers to the same data, do not use this)
   1.447 +  CC_HIGHEST_OPT += -xrestrict
   1.448 +  # Inline some library routines
   1.449 +  #   (If you expect perfect errno behavior, do not use this)
   1.450 +  CC_HIGHEST_OPT += -xlibmil
   1.451 +  # Use optimized math routines
   1.452 +  #   (If you expect perfect errno behavior, do not use this)
   1.453 +  #  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
   1.454 +  #  CC_HIGHEST_OPT += -xlibmopt
   1.455 +  ifeq ($(ARCH_FAMILY), sparc)
   1.456 +    # Assume at most 8byte alignment, raise SIGBUS on error
   1.457 +    ### Presents an ABI issue with customer JNI libs?
   1.458 +    ####CC_HIGHEST_OPT  += -xmemalign=8s
   1.459 +    # Automatic prefetch instructions, explicit prefetch macros
   1.460 +    CC_HIGHEST_OPT  += -xprefetch=auto,explicit
   1.461 +    # Pick ultra as the chip to optimize to
   1.462 +    CC_HIGHEST_OPT  += -xchip=ultra
   1.463 +  endif
   1.464 +  ifeq ($(ARCH), i586)
   1.465 +    # Pick pentium as the chip to optimize to
   1.466 +    CC_HIGHEST_OPT  += -xchip=pentium
   1.467 +  endif
   1.468 +  ifdef LIBRARY
   1.469 +    # The Solaris CBE (Common Build Environment) requires that the use
   1.470 +    # of appl registers be disabled when compiling a public library (or
   1.471 +    # a library that's loaded by a public library) on sparc.
   1.472 +    CFLAGS_REQUIRED_sparc    += -xregs=no%appl
   1.473 +    CFLAGS_REQUIRED_sparcv9  += -xregs=no%appl
   1.474 +  endif
   1.475 +  ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1)
   1.476 +    # Do NOT use the frame pointer register as a general purpose opt register
   1.477 +    CFLAGS_REQUIRED_i586  += -xregs=no%frameptr
   1.478 +    CFLAGS_REQUIRED_amd64 += -xregs=no%frameptr
   1.479 +    # We MUST allow data alignment of 4 for sparc V8 (32bit)
   1.480 +    #     Presents an ABI issue with customer JNI libs? We must be able to
   1.481 +    #     to handle 4byte aligned objects? (rare occurance, but possible?)
   1.482 +    CFLAGS_REQUIRED_sparc += -xmemalign=4s
   1.483 +  endif
   1.484 +  # Just incase someone trys to use the SOS9 compilers
   1.485 +  ifeq ($(CC_VER), 5.6)
   1.486 +    # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s)
   1.487 +    CFLAGS_REQUIRED_sparc += -xmemalign=4s
   1.488 +  endif
   1.489 +  # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
   1.490 +  #   (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken.
   1.491 +  AUTOMATIC_PCH_OPTION =
   1.492 +endif
   1.493 +CC_NO_OPT      = 
   1.494 +
   1.495 +# If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off
   1.496 +ifdef NO_OPTIMIZATIONS
   1.497 +  CC_HIGHEST_OPT = $(CC_NO_OPT)
   1.498 +  CC_HIGHER_OPT  = $(CC_NO_OPT)
   1.499 +  CC_LOWER_OPT   = $(CC_NO_OPT)
   1.500 +endif
   1.501 +
   1.502 +# Flags required all the time
   1.503 +CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH))
   1.504 +
   1.505 +# Add processor specific options for optimizations
   1.506 +CC_HIGHEST_OPT += $(_OPT_$(ARCH))
   1.507 +CC_HIGHER_OPT  += $(_OPT_$(ARCH))
   1.508 +CC_LOWER_OPT   += $(_OPT_$(ARCH))
   1.509 +
   1.510 +# Secret compiler optimization options that should be in the above macros
   1.511 +#    but since they differ in format from C to C++, are added into the C or
   1.512 +#    C++ specific macros for compiler flags.
   1.513 +#
   1.514 +#  On i586 we need to tell the code generator to ALWAYS use a
   1.515 +#   frame pointer.
   1.516 +ifeq ($(ARCH_FAMILY), i586)
   1.517 +  # Note that in 5.7, this is done with -xregs=no%frameptr
   1.518 +  ifeq ($(CC_VER), 5.5)
   1.519 +    #       It's not exactly clear when this optimization kicks in, the
   1.520 +    #       current assumption is -xO4 or greater and for C++ with
   1.521 +    #       the -features=no%except option and -xO4 and greater.
   1.522 +    #       Bottom line is, we ALWAYS want a frame pointer!
   1.523 +    CXXFLAGS_OPT += -Qoption ube -Z~B
   1.524 +    CFLAGS_OPT   +=          -Wu,-Z~B
   1.525 +    ifeq ($(FASTDEBUG), true)
   1.526 +        CXXFLAGS_DBG += -Qoption ube -Z~B
   1.527 +        CFLAGS_DBG   +=          -Wu,-Z~B
   1.528 +    endif
   1.529 +  endif
   1.530 +endif
   1.531 +#
   1.532 +#  Optimizer for sparc needs to be told not to do certain things
   1.533 +#   related to frames or save instructions.
   1.534 +ifeq ($(ARCH_FAMILY), sparc)
   1.535 +  # NOTE: Someday the compilers will provide a high-level option for this.
   1.536 +  #   Use save instructions instead of add instructions
   1.537 +  #    This was an optimization starting in SC5.0 that made it hard for us to
   1.538 +  #    find the "save" instruction (which got turned into an "add")
   1.539 +  CXXFLAGS_OPT += -Qoption cg -Qrm-s
   1.540 +  CFLAGS_OPT   +=         -Wc,-Qrm-s
   1.541 +  ifeq ($(FASTDEBUG), true)
   1.542 +    CXXFLAGS_DBG += -Qoption cg -Qrm-s
   1.543 +    CFLAGS_DBG   +=         -Wc,-Qrm-s
   1.544 +  endif
   1.545 +  #
   1.546 +  # NOTE: Someday the compilers will provide a high-level option for this.
   1.547 +  #   Don't allow tail call code optimization. Started in SC5.0.
   1.548 +  #    We don't like code of this form:
   1.549 +  #	save
   1.550 +  #	<code>
   1.551 +  #	call foo
   1.552 +  #	   restore
   1.553 +  #   because we can't tell if the method will have a stack frame
   1.554 +  #   and register windows or not.
   1.555 +  CXXFLAGS_OPT += -Qoption cg -Qiselect-T0
   1.556 +  CFLAGS_OPT   +=         -Wc,-Qiselect-T0
   1.557 +  ifeq ($(FASTDEBUG), true)
   1.558 +    CXXFLAGS_DBG += -Qoption cg -Qiselect-T0
   1.559 +    CFLAGS_DBG   +=         -Wc,-Qiselect-T0
   1.560 +  endif
   1.561 +endif
   1.562 +
   1.563 +#
   1.564 +# Path and option to link against the VM, if you have to.  Note that
   1.565 +# there are libraries that link against only -ljava, but they do get
   1.566 +# -L to the -ljvm, this is because -ljava depends on -ljvm, whereas
   1.567 +# the library itself should not.
   1.568 +#
   1.569 +VM_NAME         = server
   1.570 +JVMLIB		= -L$(BOOTDIR)/jre/lib/$(LIBARCH)/server -ljvm
   1.571 +JAVALIB		=
   1.572 +
   1.573 +# Part of INCREMENTAL_BUILD mechanism.
   1.574 +#   Compiler emits things like:  path/file.o: file.h
   1.575 +#   We want something like: relative_path/file.o relative_path/file.d: file.h
   1.576 +#   In addition on Solaris, any include file starting with / is deleted,
   1.577 +#   this gets rid of things like /usr/include files, which never change.
   1.578 +CC_DEPEND	 = -xM1
   1.579 +CC_DEPEND_FILTER = $(SED) -e '/:[ 	]*[/]/d' -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' | $(SORT) -u
   1.580 +
   1.581 +# Location of openwin libraries (do we really need this anymore?)
   1.582 +OPENWIN_HOME    = /usr/openwin
   1.583 +OPENWIN_LIB     = $(OPENWIN_HOME)/lib$(ISA_DIR)
   1.584 +
   1.585 +# Runtime graphics library search paths...
   1.586 +OPENWIN_RUNTIME_LIB = /usr/openwin/lib$(ISA_DIR)
   1.587 +AWT_RUNPATH = -R/usr/dt/lib$(ISA_DIR) -R$(OPENWIN_RUNTIME_LIB)
   1.588 +
   1.589 +# C++ Runtime library (libCrun.so), use instead of -lCrun.
   1.590 +#    Originally used instead of -lCrun to guarantee use of the system
   1.591 +#    .so version and not the .a or .so that came with the compilers.
   1.592 +#    With the newer compilers this could probably change back to -lCrun but
   1.593 +#    in general this is ok to continue to do.
   1.594 +LIBCXX = /usr/lib$(ISA_DIR)/libCrun.so.1
   1.595 +
   1.596 +# Math Library (libm.so), do not use -lm.
   1.597 +#    There might be two versions of libm.so on the build system:
   1.598 +#    libm.so.1 and libm.so.2, and we want libm.so.1.
   1.599 +#    Depending on the Solaris release being used to build with,
   1.600 +#    /usr/lib/libm.so could point at a libm.so.2, so we are
   1.601 +#    explicit here so that the libjvm.so you have built will work on an
   1.602 +#    older Solaris release that might not have libm.so.2.
   1.603 +#    This is a critical factor in allowing builds on Solaris 10 or newer
   1.604 +#    to run on Solaris 8 or 9.
   1.605 +#
   1.606 +#    Note: Historically there was also a problem picking up a static version
   1.607 +#          of libm.a from the compiler area, but that problem has gone away
   1.608 +#          with the newer compilers. Use of libm.a would cause .so bloat.
   1.609 +#
   1.610 +LIBM = /usr/lib$(ISA_DIR)/libm.so.1
   1.611 +
   1.612 +# Socket library
   1.613 +LIBSOCKET = -lsocket
   1.614 +
   1.615 +# GLOBAL_KPIC: If set means all libraries are PIC, position independent code
   1.616 +#    EXCEPT for select compiles
   1.617 +#    If a .o file is compiled non-PIC then it should be forced
   1.618 +#	   into the RW data segment with a mapfile option. This is done
   1.619 +#    with object files which generated from .s files.
   1.620 +#    The -ztext enforces that no relocations remain in the text segment
   1.621 +#    so that it remains purely read-only for optimum system performance.
   1.622 +#    Some libraries may use a smaller size (13bit -Kpic) on sparc instead of 
   1.623 +#    (32 bit -KPIC) and will override GLOBAL_KPIC appropriately.
   1.624 +#
   1.625 +PIC_CODE_LARGE   = -KPIC
   1.626 +PIC_CODE_SMALL   = -Kpic
   1.627 +ifndef TCOV_BUILD
   1.628 +    GLOBAL_KPIC      = $(PIC_CODE_LARGE)
   1.629 +    CXXFLAGS_COMMON += $(GLOBAL_KPIC)
   1.630 +    CFLAGS_COMMON   += $(GLOBAL_KPIC)
   1.631 +    LDFLAGS_COMMON  += -ztext
   1.632 +endif # TCOV_BUILD
   1.633 +
   1.634 +# If your platform has DPS, it will have Type1 fonts too, in which case
   1.635 +# it is best to enable DPS support until such time as 2D's rasteriser
   1.636 +# can fully handle Type1 fonts in all cases. Default is "yes".
   1.637 +# HAVE_DPS should only be "no" if the platform has no DPS headers or libs
   1.638 +# DPS (Displayable PostScript) is available on Solaris machines
   1.639 +
   1.640 +HAVE_DPS = yes
   1.641 +
   1.642 +#
   1.643 +# Japanese manpages
   1.644 +#
   1.645 +JA_SOURCE_ENCODING = eucJP
   1.646 +JA_TARGET_ENCODINGS = eucJP UTF-8 PCK
   1.647 +

mercurial