Compiler-sun.gmk 5.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
#
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

#
# Sun Studio Compiler settings
#

# Sun Studio Compiler settings specific to Solaris
ifeq ($(PLATFORM), solaris)
  CC             ?= $(COMPILER_PATH)cc
  CPP            ?= $(COMPILER_PATH)cc -E
  CXX            ?= $(COMPILER_PATH)CC
  LINT           ?= $(COMPILER_PATH)lint
  # Option used to create a shared library
  SHARED_LIBRARY_FLAG = -G
  GCC =$(GCC_COMPILER_PATH)gcc
endif

# Sun Studio Compiler settings specific to Linux
ifeq ($(PLATFORM), linux)
  # This has not been tested
  CC             ?= $(COMPILER_PATH)cc
  CPP            ?= $(COMPILER_PATH)cc -E
  CXX            ?= $(COMPILER_PATH)CC
  LINT           ?= $(COMPILER_PATH)lint
  # statically link libstdc++ before C++ ABI is stablized on Linux
  STATIC_CXX     = true
  ifeq ($(STATIC_CXX),true)
    # CC always dynamically links libstdc++, even we use "-Wl,-Bstatic -lstdc++"
    # We need to use cc to statically link the C++ runtime.
    CXX            ?= $(COMPILER_PATH)cc
  else
    CXX            ?= $(COMPILER_PATH)CC
  endif
  # Option used to create a shared library
  SHARED_LIBRARY_FLAG = -G
endif

# Get compiler version
_CC_VER :=$(shell $(CC) -V 2>&1 | $(HEAD) -n 1)
CC_VER  :=$(call GetVersion,"$(_CC_VER)")
CC_MAJORVER  :=$(call MajorVersion,$(CC_VER))
CC_MINORVER  :=$(call MinorVersion,$(CC_VER))

# Name of compilers being used
COMPILER_VERSION-5.7  = SS10
COMPILER_NAME-5.7     = Sun Studio 10
COMPILER_VERSION-5.8  = SS11
COMPILER_NAME-5.8     = Sun Studio 11
COMPILER_VERSION-5.9  = SS12
COMPILER_NAME-5.9     = Sun Studio 12
COMPILER_VERSION-5.10 = SS12u1
COMPILER_NAME-5.10    = Sun Studio 12 Update 1
COMPILER_VERSION-5.11 = OSS12u2
COMPILER_NAME-5.11    = Oracle Solaris Studio 12 Update 2
COMPILER_VERSION      = $(COMPILER_VERSION-$(CC_VER))
COMPILER_NAME         = $(COMPILER_NAME-$(CC_VER))

# Arch specific settings (determines type of .o files and instruction set)
#  Starting in SS12 (5.9), the arch options changed.
#  The assembler /usr/ccs/bin/as wants older SS11 (5.8) style options.
#   Note: We need to have both 32 and 64 values at all times for awt Makefiles.
#
XARCH_OPTION_OLD/32 =
XARCH_OPTION_OLD/64 =
XARCH_OPTION_NEW/32 = -m32
XARCH_OPTION_NEW/64 = -m64
# Lint options are slightly different
LINT_XARCH_OPTION_OLD/32 =
LINT_XARCH_OPTION_OLD/64 =
LINT_XARCH_OPTION_NEW/32 = -m32
LINT_XARCH_OPTION_NEW/64 = -m64
ifeq ($(ARCH_FAMILY), sparc)
  ifdef VIS_NEEDED
    XARCH_OPTION_OLD/32 += -xarch=v8plusa
    XARCH_OPTION_OLD/64 += -xarch=v9a
    XARCH_OPTION_NEW/32 += -xarch=sparcvis
    XARCH_OPTION_NEW/64 += -xarch=sparcvis
  else
    # Someday this should change to improve optimization on UltraSPARC
    #    and abandon v8, even change to sparcvis or sparcvis2, this
    #    abandons machines like the SPARCstation 10.
    #    Indications with jdk6 is that alacrity runs do not show a
    #    big improvement using v8plus over v8, but other benchmarks might.
    XARCH_OPTION_OLD/32 += -xarch=v8
    XARCH_OPTION_OLD/64 += -xarch=v9
    # Note that this new option (SS12+) effectively means v8plus
    XARCH_OPTION_NEW/32 += -xarch=sparc
    XARCH_OPTION_NEW/64 += -xarch=sparc
  endif
  LINT_XARCH_OPTION_OLD/64 += -Xarch=v9
endif
ifeq ($(ARCH_FAMILY), i586)
  XARCH_OPTION_OLD/64      += -xarch=amd64
  LINT_XARCH_OPTION_OLD/64 += -Xarch=amd64
endif
# Pick the options we want based on the compiler being used. (5.9 or newer)
CC_59_OR_NEWER := \
  $(shell expr $(CC_MAJORVER) \> 5 \| \
      \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \>= 9 \) )
ifeq ($(CC_59_OR_NEWER), 1)
  XARCH_OPTION/32 = $(XARCH_OPTION_NEW/32)
  XARCH_OPTION/64 = $(XARCH_OPTION_NEW/64)
  LINT_XARCH_OPTION/32 = $(LINT_XARCH_OPTION_NEW/32)
  LINT_XARCH_OPTION/64 = $(LINT_XARCH_OPTION_NEW/64)
else
  XARCH_OPTION/32 = $(XARCH_OPTION_OLD/32)
  XARCH_OPTION/64 = $(XARCH_OPTION_OLD/64)
  LINT_XARCH_OPTION/32 = $(LINT_XARCH_OPTION_OLD/32)
  LINT_XARCH_OPTION/64 = $(LINT_XARCH_OPTION_OLD/64)
endif
XARCH_OPTION = $(XARCH_OPTION/$(ARCH_DATA_MODEL))
LINT_XARCH_OPTION = $(LINT_XARCH_OPTION/$(ARCH_DATA_MODEL))
# The /usr/ccs/bin/as assembler always wants the older SS11 (5.8) options.
AS_XARCH_OPTION = $(XARCH_OPTION_OLD/$(ARCH_DATA_MODEL))