1 #
   2 # Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 #
  27 # Makefile to specify compiler flags for programs and libraries
  28 # targeted to Solaris.  Should not contain any rules.
  29 #
  30 # WARNING: This file is shared with other workspaces. 
  31 #          So when it includes other files, it must use JDK_TOPDIR.
  32 #
  33 
  34 # Warning: the following variables are overridden by Defs.gmk. Set
  35 # values will be silently ignored:
  36 #   CFLAGS        (set $(OTHER_CFLAGS) instead)
  37 #   CPPFLAGS      (set $(OTHER_CPPFLAGS) instead)
  38 #   CXXFLAGS      (set $(OTHER_CXXFLAGS) instead)
  39 #   LDFLAGS       (set $(OTHER_LDFAGS) instead)
  40 #   LDLIBS        (set $(EXTRA_LIBS) instead)
  41 #   LDLIBS_COMMON (set $(EXTRA_LIBS) instead)
  42 #   LINTFLAGS     (set $(OTHER_LINTFLAGS) instead)
  43 #
  44 # Note: CPPFLAGS are used in C and C++ compiles.
  45 #
  46 
  47 # Get shared JDK settings
  48 include $(JDK_MAKE_SHARED_DIR)/Defs.gmk
  49 
  50 ifndef PLATFORM_SRC
  51 PLATFORM_SRC = $(BUILDDIR)/../src/solaris
  52 endif # PLATFORM_SRC
  53 
  54 # Platform specific closed sources
  55 ifndef OPENJDK
  56   ifndef CLOSED_PLATFORM_SRC
  57     CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris
  58   endif
  59 endif
  60 
  61 # platform specific include files
  62 PLATFORM_INCLUDE_NAME = $(PLATFORM)
  63 PLATFORM_INCLUDE      = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
  64 
  65 # suffix used for make dependencies files
  66 DEPEND_SUFFIX = d
  67 # suffix used for lint files
  68 LINT_SUFFIX = ln
  69 # The suffix applied to the library name for FDLIBM
  70 FDDLIBM_SUFFIX = a
  71 # The suffix applied to scripts (.bat for windows, nothing for unix)
  72 SCRIPT_SUFFIX =
  73 # CC compiler object code output directive flag value
  74 CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
  75 CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
  76 
  77 ENABLE_FULL_DEBUG_SYMBOLS ?= 1
  78 # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
  79 
  80 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
  81   # Default OBJCOPY comes from the SUNWbinutils package:
  82   DEF_OBJCOPY=/usr/sfw/bin/gobjcopy
  83   ifeq ($(PLATFORM)-$(LIBARCH), solaris-amd64)
  84     # On Solaris AMD64/X64, gobjcopy is not happy and fails:
  85     #
  86     # usr/sfw/bin/gobjcopy --add-gnu-debuglink=<lib>.debuginfo <lib>.so
  87     # BFD: stKPaiop: Not enough room for program headers, try linking with -N
  88     # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value
  89     # BFD: stKPaiop: Not enough room for program headers, try linking with -N
  90     # /usr/sfw/bin/gobjcopy: libsaproc.debuginfo: Bad value
  91     # BFD: stKPaiop: Not enough room for program headers, try linking with -N
  92     # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value
  93     _JUNK_ := $(shell \
  94       echo >&2 "INFO: $(DEF_OBJCOPY) is not working on Solaris AMD64/X64")
  95     OBJCOPY=
  96   else
  97     OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
  98     ifneq ($(ALT_OBJCOPY),)
  99       _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
 100       # disable .debuginfo support by setting ALT_OBJCOPY to a non-existent path
 101       OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
 102     endif
 103   endif
 104 
 105   # Setting ENABLE_FULL_DEBUG_SYMBOLS=1 (and OBJCOPY) above enables the
 106   # JDK build to import .debuginfo or .diz files from the HotSpot build.
 107   # However, adding FDS support to the JDK build will occur in phases
 108   # so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS)
 109   # is used to indicate that a particular library supports FDS.
 110 
 111   ifeq ($(OBJCOPY),)
 112     _JUNK_ := $(shell \
 113       echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.")
 114     ENABLE_FULL_DEBUG_SYMBOLS=0
 115   else
 116     _JUNK_ := $(shell \
 117       echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.")
 118 
 119     # Library stripping policies for .debuginfo configs:
 120     #   all_strip - strips everything from the library
 121     #   min_strip - strips most stuff from the library; leaves minimum symbols
 122     #   no_strip  - does not strip the library at all
 123     #
 124     # Oracle security policy requires "all_strip". A waiver was granted on
 125     # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE.
 126     #
 127     #
 128     # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled.
 129     STRIP_POLICY ?= min_strip
 130 
 131     _JUNK_ := $(shell \
 132       echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
 133 
 134     ZIP_DEBUGINFO_FILES ?= 1
 135 
 136     _JUNK_ := $(shell \
 137       echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
 138   endif
 139 endif
 140 
 141 #
 142 # Java default optimization (-x04/-O2) etc.  Applies to the VM.
 143 #
 144 ifndef OPTIMIZATION_LEVEL
 145   ifeq ($(PRODUCT), java)
 146     OPTIMIZATION_LEVEL = HIGHER
 147   else
 148     OPTIMIZATION_LEVEL = LOWER
 149   endif
 150 endif
 151 ifndef FASTDEBUG_OPTIMIZATION_LEVEL
 152   FASTDEBUG_OPTIMIZATION_LEVEL = LOWER
 153 endif
 154 
 155 #
 156 # If -Xa is in CFLAGS_COMMON it will end up ahead of $(CC_OPT) for the
 157 # optimized build, and that ordering of the flags completely freaks
 158 # out cc.  Hence, -Xa is instead in each CFLAGS variant.
 159 #
 160 # The more unusual options to the Sun C compiler:
 161 #       -v              Stricter type checking, more error checking
 162 #                       (To turn ALL warnings into fatals, use -errwarn=%all)
 163 #       -xstrconst      Place string literals and constants in read-only area
 164 #                       (means you can't write on your string literals)
 165 #       -xs             Force debug information (stabs) into the .so or a.out
 166 #                       (makes the library/executable debuggable without the
 167 #                       .o files needing to be around, but at a space cost)
 168 #       -g & -O             If you add the -g option to the optimized compiles
 169 #                       you will get better stack retraces, the code is
 170 #                       still optimized. This includes a space cost too.
 171 #       -xc99=%none     Do NOT allow for c99 extensions to be used.
 172 #                       e.g. declarations must precede statements
 173 #       -xCC            Allow the C++ style of comments in C: //
 174 #                       Required with many of the source files.
 175 #       -mt             Assume multi-threaded (important)
 176 #
 177 # The more unusual options to the Sun C compiler:
 178 #       +w              Print more warnings
 179 #       +w2             Maximum warnings
 180 #
 181 
 182 #
 183 # Debug flag for C and C++ compiler
 184 #
 185 CFLAGS_DEBUG_OPTION    = -g $(CC_OPT/NONE)
 186 CXXFLAGS_DEBUG_OPTION  = -g $(CXX_OPT/NONE)
 187 
 188 # Turn off -g if we are doing tcov build
 189 ifdef TCOV_BUILD
 190   CFLAGS_DEBUG_OPTION=
 191   CXXFLAGS_DEBUG_OPTION=
 192 endif
 193 
 194 # FASTDEBUG: Optimize the -g builds, gives us a faster debug java
 195 #        If true adds -O to the debug compiles. This allows for any assert
 196 #        tests to remain and debug checking. The resulting code is faster
 197 #        but less debuggable.  Stack traces are still valid, although only
 198 #        approximate line numbers are given. Printing of local variables
 199 #        during a debugging session is not possible, but stepping and
 200 #        printing of global or static variables should be possible.
 201 #        Performance/size of files should be about the same, maybe smaller.
 202 #
 203 ifeq ($(FASTDEBUG), true)
 204   CFLAGS_DEBUG_OPTION    = -g  $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
 205   CXXFLAGS_DEBUG_OPTION  = -g0 $(CXX_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
 206 endif
 207 
 208 CFLAGS_COMMON   = -L$(OBJDIR)
 209 
 210 # Do not allow C99 language features like declarations in code etc.
 211 CFLAGS_COMMON  += -xc99=%none
 212 
 213 # Allow C++ comments in C code
 214 CFLAGS_COMMON  += -xCC
 215 
 216 # Show error message tags on errors
 217 CFLAGS_COMMON   += -errshort=tags
 218 CXXFLAGS_COMMON += -errtags=yes
 219 
 220 # Optimization flags
 221 CFLAGS_OPT      = $(CC_OPT)
 222 
 223 # Debug version flags
 224 CFLAGS_DBG      = $(CFLAGS_DEBUG_OPTION)
 225 
 226 # Required C compiler flags
 227 CFLAGS_COMMON  += -Xa $(CFLAGS_REQUIRED)
 228 
 229 # Maximum warnings all the time
 230 CXXFLAGS_COMMON += +w
 231 CFLAGS_COMMON   += -v
 232 
 233 # Assume MT behavior all the time (important)
 234 CXXFLAGS_COMMON += -mt
 235 CFLAGS_COMMON   += -mt
 236 
 237 # Assume no C++ exceptions are used
 238 CXXFLAGS_COMMON += -features=no%except -DCC_NOEX
 239 
 240 # For C++, these options tell it to assume nothing about locating libraries
 241 #    either at compile time, or at runtime. Use of these options will likely
 242 #    require the use of -L and -R options to indicate where libraries will
 243 #    be found at compile time (-L) and at runtime (-R).
 244 #    The /usr/lib location comes for free, so no need to specify that one.
 245 #    Note: C is much simplier and there is no need for these options. This
 246 #          is mostly needed to avoid dependencies on libraries in the
 247 #          Compiler install area, also see LIBCXX and LIBM.
 248 CXXFLAGS_COMMON += -norunpath -xnolib
 249 
 250 #
 251 # Treat compiler warnings as errors, if requested
 252 #
 253 ifeq ($(COMPILER_WARNINGS_FATAL),true)
 254   CFLAGS_COMMON += -errwarn=%all
 255   CXXFLAGS_COMMON += -errwarn=%all
 256 endif
 257 
 258 CXXFLAGS_OPT    = $(CXX_OPT)
 259 CXXFLAGS_DBG    = $(CXXFLAGS_DEBUG_OPTION)
 260 CXXFLAGS_COMMON += $(CFLAGS_REQUIRED)
 261 
 262 # Add -xstrconst to the library compiles. This forces all string
 263 #  literals into the read-only data section, which prevents them from
 264 #  being written to and increases the runtime pages shared on the system.
 265 #
 266 ifdef LIBRARY
 267   CFLAGS_COMMON +=-xstrconst
 268 endif
 269 
 270 # Source browser database
 271 #
 272 # COMPILE_WITH_SB    
 273 #        If defined adds -xsb to compiles and creates a
 274 #        source browsing database during compilation.
 275 #
 276 ifdef COMPILE_WITH_SB
 277   ifeq ($(LIBRARY), java)
 278     CFLAGS_DBG +=   -xsb
 279   endif
 280 endif
 281 
 282 # Lint Flags:
 283 #       -Xa                     ANSI C plus K&R, favor ANSI rules
 284 #       -fd                     report on old style func defs
 285 #       -errchk=structarg       report on 64bit struct args by value
 286 #       -errchk=longptr64       report on 64bit to 32bit issues (ignores casts)
 287 #       -errchk=parentheses     report on suggested use of extra parens
 288 #       -v                      suppress unused args
 289 #       -x                      suppress unused externs
 290 #       -u                      suppress extern func/vars used/defined
 291 #       -errfmt=simple          use one line errors with position info
 292 #       $(LINT_XARCH_OPTION)    See Compiler-sun.gwk
 293 
 294 LINTFLAGS_COMMON  = -Xa
 295 LINTFLAGS_COMMON += -fd 
 296 LINTFLAGS_COMMON += -errchk=structarg,longptr64,parentheses
 297 LINTFLAGS_COMMON += -v
 298 LINTFLAGS_COMMON += -x 
 299 LINTFLAGS_COMMON += -u
 300 LINTFLAGS_COMMON += -errfmt=simple 
 301 LINTFLAGS_OPT   = 
 302 LINTFLAGS_DBG   =
 303 
 304 # The -W0,-noglobal tells the compiler to NOT generate mangled global
 305 #    ELF data symbols for file local static data.
 306 #    This can break fix&continue, but we'd rather do the same compilations
 307 #    for deliverable bits as we do for non-deliverable bits
 308 #    Tell the compilers to never generate globalized names, all the time.
 309 CFLAGS_COMMON += -W0,-noglobal
 310 
 311 # If we have a specific arch value to use, add it
 312 CFLAGS_COMMON    += $(XARCH_OPTION)
 313 CXXFLAGS_COMMON  += $(XARCH_OPTION)
 314 ASFLAGS_COMMON   += $(AS_XARCH_OPTION)
 315 EXTRA_LIBS       += $(XARCH_OPTION)
 316 LINTFLAGS_COMMON += $(LINT_XARCH_OPTION)
 317 
 318 #
 319 # uncomment the following to build with PERTURBALOT set
 320 #
 321 # OTHER_CFLAGS += -DPERTURBALOT
 322 #
 323 
 324 CPPFLAGS_COMMON = -D__solaris__  -D$(ARCH_FAMILY)
 325 CPPFLAGS_OPT    = -DNDEBUG
 326 CPPFLAGS_DBG    = -DDEBUG
 327 
 328 ifneq ($(PRODUCT), java)
 329   CPPFLAGS_DBG    += -DLOGGING -DDBINFO
 330 endif
 331 
 332 ifeq ($(ARCH_FAMILY), i586)
 333   # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
 334   #   Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
 335   #   (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
 336   #   Note: -Dmacro         is the same as    #define macro 1
 337   #         -Dmacro=        is the same as    #define macro
 338   #
 339   CPPFLAGS_COMMON +=  -DcpuIntel -D_LITTLE_ENDIAN= -D$(LIBARCH)
 340   # Turn off a superfluous compiler error message on Intel
 341   CFLAGS_COMMON += -erroff=E_BAD_PRAGMA_PACK_VALUE
 342 endif
 343 
 344 # Java memory management is based on memory mapping by default, but a
 345 # system only assuming malloc/free can be built by adding -DUSE_MALLOC 
 346 
 347 CPPFLAGS_COMMON += -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS
 348 CPPFLAGS_OPT    += -DTRIMMED
 349 
 350 LDFLAGS_DEFS_OPTION  = -z defs
 351 LDFLAGS_COMMON  += $(LDFLAGS_DEFS_OPTION)
 352 
 353 #
 354 # -L paths for finding and -ljava
 355 #
 356 LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
 357 LDFLAGS_OPT     =
 358 LDFLAGS_DBG     =
 359 
 360 #
 361 # We never really want the incremental linker, ever
 362 #    The -xildoff option tells Sun's compilers to NOT use incremental linker
 363 #
 364 LDFLAGS_COMMON  += -xildoff
 365 
 366 ifdef LIBRARY
 367   # Libraries need to locate other libraries at runtime, and you can tell
 368   #   a library where to look by way of the dynamic runpaths (RPATH or RUNPATH)
 369   #   buried inside the .so. The $ORIGIN says to look relative to where
 370   #   the library itself is and it can be followed with relative paths from
 371   #   that. By default we always look in $ORIGIN, optionally we add relative
 372   #   paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths.
 373   #   The environment variable LD_LIBRARY_PATH will over-ride these runpaths.
 374   #   Try: 'dump -Lv lib*.so' to see these settings in a library.
 375   #
 376   LDFLAGS_COMMON += -R\$$ORIGIN
 377   LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-R\$$ORIGIN/%)
 378 endif
 379 
 380 EXTRA_LIBS += -lc
 381 
 382 # Postprocessing is done on the images directories only
 383 #
 384 ifeq ($(VARIANT), OPT)
 385   ifeq ($(PARTIAL_GPROF), true)
 386     NO_STRIP = true
 387   endif
 388   ifeq ($(GPROF), true)
 389     NO_STRIP = true
 390   endif
 391   ifneq ($(NO_STRIP), true)
 392     # Debug 'strip -x' leaves local function Elf symbols (better stack traces)
 393     POST_STRIP_PROCESS = $(STRIP) -x
 394   endif
 395 endif
 396 POST_MCS_PROCESS=$(MCS) -d -a "JDK $(FULL_VERSION)"
 397 
 398 #
 399 # Sun C compiler will take -M and pass it on to ld.
 400 # Usage: ld $(LD_MAPFILE_FLAG) mapfile *.o
 401 #
 402 ifeq ($(CC_VERSION),gcc)
 403 LD_MAPFILE_FLAG = -Xlinker -M -Xlinker
 404 else
 405 LD_MAPFILE_FLAG = -M
 406 endif
 407 
 408 #
 409 # Variables globally settable from the make command line (default
 410 # values in brackets):
 411 #       GPROF (false)
 412 # Eg:   % gnumake GPROF=true
 413 GPROF = false
 414 ifeq ($(GPROF), true)
 415     CFLAGS_COMMON += -DGPROF -xpg
 416     EXTRA_LIBS += -xpg
 417 endif
 418 
 419 # PARTIAL_GPROF is to be used ONLY during compilation - it should not
 420 # appear during linking of libraries or programs.  It also should
 421 # prevent linking with -z defs to allow a symbol to remain undefined.
 422 #
 423 PARTIAL_GPROF = false
 424 ifeq ($(PARTIAL_GPROF), true)
 425   CFLAGS_GPROF += -xpg
 426   LDFLAGS_DEFS_OPTION  = -z nodefs
 427 endif
 428 
 429 #
 430 # For a TCOV build we add in the TCOV_OPTION
 431 #
 432 ifdef TCOV_BUILD
 433   TCOV_OPTION           = -xprofile=tcov
 434   LDFLAGS_COMMON        += $(TCOV_OPTION) -Kpic
 435   CFLAGS_COMMON         += $(TCOV_OPTION)
 436   CXXFLAGS_COMMON       += $(TCOV_OPTION)
 437   EXTRA_LIBS    += $(TCOV_OPTION)
 438   LDNOMAP=true
 439 endif
 440 
 441 #
 442 # Solaris only uses native threads. 
 443 #
 444 THREADS_FLAG=   native
 445 THREADS_DIR=    threads
 446 
 447 #
 448 # Support for Quantify.
 449 #
 450 ifdef QUANTIFY
 451   QUANTIFY_CMD = quantify
 452   QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
 453   LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS)
 454   ifdef LIBRARY
 455     CFLAGS_COMMON += -K PIC
 456   endif
 457 endif
 458 
 459 #
 460 # Support for Purify.
 461 #
 462 ifdef PURIFY
 463   PURIFY_CMD = /net/suntools.eng/export/tools/sparc/bin/purify
 464   PURIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
 465   LINK_PRE_CMD = $(PURIFY_CMD) $(PURIFY_OPTIONS)
 466   ifdef LIBRARY
 467     CFLAGS_COMMON += -K PIC
 468   endif
 469 endif
 470 
 471 #
 472 # Different "levels" of optimization.
 473 #
 474 ifeq ($(CC_VERSION),gcc)
 475   
 476   CC_OPT/NONE     =
 477   CC_OPT/LOWER    = -O2
 478   CC_OPT/HIGHER   = -O3
 479   CC_OPT/HIGHEST  = -O3
 480 
 481   CXX_OPT/NONE    =
 482   CXX_OPT/LOWER   = -O2
 483   CXX_OPT/HIGHER  = -O3
 484   CXX_OPT/HIGHEST = -O3
 485 
 486   CFLAGS_REQUIRED_i586  += -fno-omit-frame-pointer
 487   CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer
 488   
 489   # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
 490   #   (See Rules.gmk) May need to wait for gcc 5?
 491   AUTOMATIC_PCH_OPTION = 
 492 
 493 else
 494   
 495   # Highest could be -xO5, but indications are that -xO5 should be reserved
 496   #    for a per-file use, on sources with known performance impacts.
 497   OPT_LEVEL/LOWER    = 2
 498   OPT_LEVEL/HIGHER   = 4
 499   OPT_LEVEL/HIGHEST  = 4
 500   
 501   CC_OPT/NONE     =
 502   CC_OPT/LOWER    = $(OPT_LEVEL/LOWER:%=-xO%)
 503   CC_OPT/HIGHER   = $(OPT_LEVEL/HIGHER:%=-xO%)
 504   CC_OPT/HIGHEST  = $(OPT_LEVEL/HIGHEST:%=-xO%)
 505   
 506   CXX_OPT/NONE    =
 507   CXX_OPT/LOWER   = $(OPT_LEVEL/LOWER:%=-xO%)
 508   CXX_OPT/HIGHER  = $(OPT_LEVEL/HIGHER:%=-xO%)
 509   CXX_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%)
 510     
 511   # We need stack frames at all times
 512   USE_XKEEPFRAME_OPTION = false
 513   ifeq ($(USE_XKEEPFRAME_OPTION),true)
 514     
 515     # Unknown spelling on this option at this time (Maybe in SS13?)
 516     CC_XKEEPFRAME_OPTIONS  = -xkeepframe
 517     CXX_XKEEPFRAME_OPTIONS = -xkeepframe
 518   
 519   else
 520   
 521     # On X86, make sure tail call optimization is off
 522     #    The z and y are the tail call optimizations.
 523     ifeq ($(ARCH_FAMILY), i586)
 524       CC_NEWER_THAN_58 := \
 525         $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
 526             \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 8 \) )
 527       ifeq ($(CC_NEWER_THAN_58),1)
 528         #    Somehow, tail call optimization is creeping in.
 529         #    Make sure it is off.
 530         # WARNING: These may cause compiler warnings about duplicate -O options
 531         CC_XKEEPFRAME_OPTIONS  += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
 532         CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
 533       endif
 534     endif
 535   
 536     #  On i586 we need to tell the code generator to ALWAYS use a
 537     #   frame pointer.
 538     ifeq ($(ARCH_FAMILY), i586)
 539       # Note that in 5.7, this is done with -xregs=no%frameptr
 540       ifeq ($(CC_VER), 5.5)
 541         # It's not exactly clear when this optimization kicks in, the
 542         #   current assumption is -xO4 or greater and for C++ with
 543         #   the -features=no%except option and -xO4 and greater.
 544         #   Bottom line is, we ALWAYS want a frame pointer!
 545         CC_XKEEPFRAME_OPTIONS  += -Wu,-Z~B
 546         CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B
 547       endif
 548 
 549       CC_NEWER_THAN_56 := \
 550         $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
 551             \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) )
 552       ifeq ($(CC_NEWER_THAN_56),1)
 553         # Do NOT use frame pointer register as a general purpose opt register
 554         CC_OPT/NONE            += -xregs=no%frameptr
 555         CXX_OPT/NONE           += -xregs=no%frameptr
 556         CC_XKEEPFRAME_OPTIONS  += -xregs=no%frameptr
 557         CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
 558       endif
 559     endif
 560   
 561     #  Optimizer for sparc needs to be told not to do certain things
 562     #   related to frames or save instructions.
 563     ifeq ($(ARCH_FAMILY), sparc)
 564       #  Do not use save instructions instead of add instructions
 565       #  This was an optimization starting in SC5.0 that made it hard for us to
 566       #    find the "save" instruction (which got turned into an "add")
 567       CC_XKEEPFRAME_OPTIONS  += -Wc,-Qrm-s
 568       CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qrm-s
 569       # Don't allow tail call code optimization. Started in SC5.0.
 570       #    We don't like code of this form:
 571       # save
 572       # <code>
 573       # call foo
 574       #    restore
 575       #   because we can't tell if the method will have a stack frame
 576       #   and register windows or not.
 577       CC_XKEEPFRAME_OPTIONS  += -Wc,-Qiselect-T0
 578       CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qiselect-T0
 579     endif
 580   
 581   endif
 582 
 583   # Extra options used with HIGHEST
 584   #
 585   # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
 586   #          done with care, there are some assumptions below that need to
 587   #          be understood about the use of pointers, and IEEE behavior.
 588   #
 589   # Use non-standard floating point mode (not IEEE 754)
 590   CC_HIGHEST_EXTRAS += -fns
 591   # Do some simplification of floating point arithmetic (not IEEE 754)
 592   CC_HIGHEST_EXTRAS += -fsimple
 593   # Use single precision floating point with 'float'
 594   CC_HIGHEST_EXTRAS += -fsingle
 595   # Assume memory references via basic pointer types do not alias
 596   #   (Source with excessing pointer casting and data access with mixed 
 597   #    pointer types are not recommended)
 598   CC_HIGHEST_EXTRAS += -xalias_level=basic
 599   # Use intrinsic or inline versions for math/std functions
 600   #   (If you expect perfect errno behavior, do not use this)
 601   CC_HIGHEST_EXTRAS += -xbuiltin=%all
 602   # Loop data dependency optimizations (need -xO3 or higher)
 603   CC_HIGHEST_EXTRAS += -xdepend
 604   # Pointer parameters to functions do not overlap
 605   #   (Similar to -xalias_level=basic usage, but less obvious sometimes.
 606   #    If you pass in multiple pointers to the same data, do not use this)
 607   CC_HIGHEST_EXTRAS += -xrestrict
 608   # Inline some library routines
 609   #   (If you expect perfect errno behavior, do not use this)
 610   CC_HIGHEST_EXTRAS += -xlibmil
 611   # Use optimized math routines
 612   #   (If you expect perfect errno behavior, do not use this)
 613   #  Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
 614   #  CC_HIGHEST_EXTRAS += -xlibmopt
 615   ifeq ($(ARCH_FAMILY), sparc)
 616     # Assume at most 8byte alignment, raise SIGBUS on error
 617     ### Presents an ABI issue with customer JNI libs?
 618     ####CC_HIGHEST_EXTRAS  += -xmemalign=8s
 619     # Automatic prefetch instructions, explicit prefetch macros
 620     CC_HIGHEST_EXTRAS += -xprefetch=auto,explicit
 621     # Pick ultra as the chip to optimize to
 622     CC_HIGHEST_EXTRAS += -xchip=ultra
 623   endif
 624   ifeq ($(ARCH), i586)
 625     # Pick pentium as the chip to optimize to
 626     CC_HIGHEST_EXTRAS += -xchip=pentium
 627   endif
 628   ifdef LIBRARY
 629     # The Solaris CBE (Common Build Environment) requires that the use
 630     # of appl registers be disabled when compiling a public library (or
 631     # a library that's loaded by a public library) on sparc.
 632     CFLAGS_REQUIRED_sparc    += -xregs=no%appl
 633     CFLAGS_REQUIRED_sparcv9  += -xregs=no%appl
 634   endif
 635   CC_NEWER_THAN_56 := \
 636     $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
 637          \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) )
 638   ifeq ($(CC_NEWER_THAN_56),1)
 639     #     Presents an ABI issue with customer JNI libs? We must be able to
 640     #     to handle 4byte aligned objects? (rare occurance, but possible?)
 641     CFLAGS_REQUIRED_sparc += -xmemalign=4s
 642   endif
 643   # Just incase someone trys to use the SOS9 compilers
 644   ifeq ($(CC_VER), 5.6)
 645     # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s)
 646     CFLAGS_REQUIRED_sparc += -xmemalign=4s
 647   endif
 648   # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
 649   #   (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken.
 650   AUTOMATIC_PCH_OPTION =
 651   
 652   # Add in keep frame options
 653   CC_OPT/LOWER    += $(CC_XKEEPFRAME_OPTIONS)
 654   CC_OPT/HIGHER   += $(CC_XKEEPFRAME_OPTIONS)
 655   CC_OPT/HIGHEST  += $(CC_XKEEPFRAME_OPTIONS)
 656   CXX_OPT/LOWER   += $(CXX_XKEEPFRAME_OPTIONS)
 657   CXX_OPT/HIGHER  += $(CXX_XKEEPFRAME_OPTIONS)
 658   CXX_OPT/HIGHEST += $(CXX_XKEEPFRAME_OPTIONS)
 659  
 660   # Add in highest optimization settings
 661   CC_OPT/HIGHEST  += $(CC_HIGHEST_EXTRAS)
 662   CXX_OPT/HIGHEST += $(CC_HIGHEST_EXTRAS)
 663   
 664 endif
 665 
 666 # Default optimization settings based on level.
 667 CC_OPT  = $(CC_OPT/$(OPTIMIZATION_LEVEL))
 668 CXX_OPT = $(CXX_OPT/$(OPTIMIZATION_LEVEL))
 669 
 670 # Flags required all the time
 671 CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH))
 672 
 673 #
 674 # Path and option to link against the VM, if you have to.  Note that
 675 # there are libraries that link against only -ljava, but they do get
 676 # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas
 677 # the library itself should not.
 678 #
 679 VM_NAME         = server
 680 JVMLIB          = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm
 681 JAVALIB         = -ljava $(JVMLIB)
 682 
 683 # Part of INCREMENTAL_BUILD mechanism.
 684 #   Compiler emits things like:  path/file.o: file.h
 685 #   We want something like: relative_path/file.o relative_path/file.d: file.h
 686 #   In addition on Solaris, any include file starting with / is deleted,
 687 #   this gets rid of things like /usr/include files, which never change.
 688 CC_DEPEND        = -xM1
 689 CC_DEPEND_FILTER = $(SED) -e '/:[       ]*[/]/d' -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' | $(SORT) -u
 690 
 691 # Location of openwin libraries (do we really need this anymore?)
 692 OPENWIN_HOME    = /usr/openwin
 693 OPENWIN_LIB     = $(OPENWIN_HOME)/lib$(ISA_DIR)
 694 
 695 # Runtime graphics library search paths...
 696 OPENWIN_RUNTIME_LIB = /usr/openwin/lib$(ISA_DIR)
 697 AWT_RUNPATH = -R/usr/dt/lib$(ISA_DIR) -R$(OPENWIN_RUNTIME_LIB)
 698 
 699 # C++ Runtime library (libCrun.so), use instead of -lCrun.
 700 #    Originally used instead of -lCrun to guarantee use of the system
 701 #    .so version and not the .a or .so that came with the compilers.
 702 #    With the newer compilers this could probably change back to -lCrun but
 703 #    in general this is ok to continue to do.
 704 LIBCXX = /usr/lib$(ISA_DIR)/libCrun.so.1
 705 
 706 # JDK now requires Solaris 10, so pick up libm.so.2
 707 LIBM = /usr/lib$(ISA_DIR)/libm.so.2
 708 
 709 # Socket library
 710 LIBSOCKET = -lsocket
 711 
 712 # Network Services library
 713 LIBNSL = -lnsl
 714 
 715 # service configuration facility library
 716 LIBSCF = -lscf
 717 
 718 # Dynamic Loading library
 719 LIBDL = -ldl
 720 
 721 # GLOBAL_KPIC: If set means all libraries are PIC, position independent code
 722 #    EXCEPT for select compiles
 723 #    If a .o file is compiled non-PIC then it should be forced
 724 #          into the RW data segment with a mapfile option. This is done
 725 #    with object files which generated from .s files.
 726 #    The -ztext enforces that no relocations remain in the text segment
 727 #    so that it remains purely read-only for optimum system performance.
 728 #    Some libraries may use a smaller size (13bit -Kpic) on sparc instead of 
 729 #    (32 bit -KPIC) and will override GLOBAL_KPIC appropriately.
 730 #
 731 PIC_CODE_LARGE   = -KPIC
 732 PIC_CODE_SMALL   = -Kpic
 733 ifndef TCOV_BUILD
 734     GLOBAL_KPIC      = $(PIC_CODE_LARGE)
 735     CXXFLAGS_COMMON += $(GLOBAL_KPIC)
 736     CFLAGS_COMMON   += $(GLOBAL_KPIC)
 737     LDFLAGS_COMMON  += -ztext
 738 endif # TCOV_BUILD
 739 
 740 # If your platform has DPS, it will have Type1 fonts too, in which case
 741 # it is best to enable DPS support until such time as 2D's rasteriser
 742 # can fully handle Type1 fonts in all cases. Default is "yes".
 743 # HAVE_DPS should only be "no" if the platform has no DPS headers or libs
 744 # DPS (Displayable PostScript) is available on Solaris machines
 745 
 746 HAVE_DPS = yes
 747 
 748 #
 749 # Japanese manpages
 750 #
 751 JA_SOURCE_ENCODING = eucJP
 752 JA_TARGET_ENCODINGS = eucJP UTF-8 PCK
 753 
 754 # Settings for the JDI - Serviceability Agent binding.
 755 HOTSPOT_SALIB_PATH   = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH)
 756 SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX)
 757 SA_DEBUGINFO_NAME = $(LIB_PREFIX)saproc.debuginfo
 758 SA_DIZ_NAME = $(LIB_PREFIX)saproc.diz
 759 INCLUDE_SA=true
 760