jdk/makefiles/common/shared/Compiler-sun.gmk
changeset 12317 9670c1610c53
equal deleted inserted replaced
12316:ba6b7a51e226 12317:9670c1610c53
       
     1 #
       
     2 # Copyright (c) 2005, 2010, 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 # Sun Studio Compiler settings
       
    28 #
       
    29 
       
    30 # Sun Studio Compiler settings specific to Solaris
       
    31 ifeq ($(PLATFORM), solaris)
       
    32   CC             ?= $(COMPILER_PATH)cc
       
    33   CPP            ?= $(COMPILER_PATH)cc -E
       
    34   CXX            ?= $(COMPILER_PATH)CC
       
    35   LINT           ?= $(COMPILER_PATH)lint
       
    36   # Option used to create a shared library
       
    37   SHARED_LIBRARY_FLAG = -G
       
    38   GCC =$(GCC_COMPILER_PATH)gcc
       
    39 endif
       
    40 
       
    41 # Sun Studio Compiler settings specific to Linux
       
    42 ifeq ($(PLATFORM), linux)
       
    43   # This has not been tested
       
    44   CC             ?= $(COMPILER_PATH)cc
       
    45   CPP            ?= $(COMPILER_PATH)cc -E
       
    46   CXX            ?= $(COMPILER_PATH)CC
       
    47   LINT           ?= $(COMPILER_PATH)lint
       
    48   # statically link libstdc++ before C++ ABI is stablized on Linux
       
    49   STATIC_CXX     = true
       
    50   ifeq ($(STATIC_CXX),true)
       
    51     # CC always dynamically links libstdc++, even we use "-Wl,-Bstatic -lstdc++"
       
    52     # We need to use cc to statically link the C++ runtime.
       
    53     CXX            ?= $(COMPILER_PATH)cc
       
    54   else
       
    55     CXX            ?= $(COMPILER_PATH)CC
       
    56   endif
       
    57   # Option used to create a shared library
       
    58   SHARED_LIBRARY_FLAG = -G
       
    59 endif
       
    60 
       
    61 # Get compiler version
       
    62 _CC_VER :=$(shell $(CC) -V 2>&1 | $(HEAD) -n 1)
       
    63 CC_VER  :=$(call GetVersion,"$(_CC_VER)")
       
    64 CC_MAJORVER  :=$(call MajorVersion,$(CC_VER))
       
    65 CC_MINORVER  :=$(call MinorVersion,$(CC_VER))
       
    66 
       
    67 # Name of compilers being used
       
    68 COMPILER_VERSION-5.7  = SS10
       
    69 COMPILER_NAME-5.7     = Sun Studio 10
       
    70 COMPILER_VERSION-5.8  = SS11
       
    71 COMPILER_NAME-5.8     = Sun Studio 11
       
    72 COMPILER_VERSION-5.9  = SS12
       
    73 COMPILER_NAME-5.9     = Sun Studio 12
       
    74 COMPILER_VERSION-5.10 = SS12u1
       
    75 COMPILER_NAME-5.10    = Sun Studio 12 Update 1
       
    76 COMPILER_VERSION-5.11 = OSS12u2
       
    77 COMPILER_NAME-5.11    = Oracle Solaris Studio 12 Update 2
       
    78 COMPILER_VERSION      = $(COMPILER_VERSION-$(CC_VER))
       
    79 COMPILER_NAME         = $(COMPILER_NAME-$(CC_VER))
       
    80 
       
    81 # Arch specific settings (determines type of .o files and instruction set)
       
    82 #  Starting in SS12 (5.9), the arch options changed.
       
    83 #  The assembler /usr/ccs/bin/as wants older SS11 (5.8) style options.
       
    84 #   Note: We need to have both 32 and 64 values at all times for awt Makefiles.
       
    85 #
       
    86 XARCH_OPTION_OLD/32 =
       
    87 XARCH_OPTION_OLD/64 =
       
    88 XARCH_OPTION_NEW/32 = -m32
       
    89 XARCH_OPTION_NEW/64 = -m64
       
    90 # Lint options are slightly different
       
    91 LINT_XARCH_OPTION_OLD/32 =
       
    92 LINT_XARCH_OPTION_OLD/64 =
       
    93 LINT_XARCH_OPTION_NEW/32 = -m32
       
    94 LINT_XARCH_OPTION_NEW/64 = -m64
       
    95 ifeq ($(ARCH_FAMILY), sparc)
       
    96   ifdef VIS_NEEDED
       
    97     XARCH_OPTION_OLD/32 += -xarch=v8plusa
       
    98     XARCH_OPTION_OLD/64 += -xarch=v9a
       
    99     XARCH_OPTION_NEW/32 += -xarch=sparcvis
       
   100     XARCH_OPTION_NEW/64 += -xarch=sparcvis
       
   101   else
       
   102     # Someday this should change to improve optimization on UltraSPARC
       
   103     #    and abandon v8, even change to sparcvis or sparcvis2, this
       
   104     #    abandons machines like the SPARCstation 10.
       
   105     #    Indications with jdk6 is that alacrity runs do not show a
       
   106     #    big improvement using v8plus over v8, but other benchmarks might.
       
   107     XARCH_OPTION_OLD/32 += -xarch=v8
       
   108     XARCH_OPTION_OLD/64 += -xarch=v9
       
   109     # Note that this new option (SS12+) effectively means v8plus
       
   110     XARCH_OPTION_NEW/32 += -xarch=sparc
       
   111     XARCH_OPTION_NEW/64 += -xarch=sparc
       
   112   endif
       
   113   LINT_XARCH_OPTION_OLD/64 += -Xarch=v9
       
   114 endif
       
   115 ifeq ($(ARCH_FAMILY), i586)
       
   116   XARCH_OPTION_OLD/64      += -xarch=amd64
       
   117   LINT_XARCH_OPTION_OLD/64 += -Xarch=amd64
       
   118 endif
       
   119 # Pick the options we want based on the compiler being used. (5.9 or newer)
       
   120 CC_59_OR_NEWER := \
       
   121   $(shell expr $(CC_MAJORVER) \> 5 \| \
       
   122       \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \>= 9 \) )
       
   123 ifeq ($(CC_59_OR_NEWER), 1)
       
   124   XARCH_OPTION/32 = $(XARCH_OPTION_NEW/32)
       
   125   XARCH_OPTION/64 = $(XARCH_OPTION_NEW/64)
       
   126   LINT_XARCH_OPTION/32 = $(LINT_XARCH_OPTION_NEW/32)
       
   127   LINT_XARCH_OPTION/64 = $(LINT_XARCH_OPTION_NEW/64)
       
   128 else
       
   129   XARCH_OPTION/32 = $(XARCH_OPTION_OLD/32)
       
   130   XARCH_OPTION/64 = $(XARCH_OPTION_OLD/64)
       
   131   LINT_XARCH_OPTION/32 = $(LINT_XARCH_OPTION_OLD/32)
       
   132   LINT_XARCH_OPTION/64 = $(LINT_XARCH_OPTION_OLD/64)
       
   133 endif
       
   134 XARCH_OPTION = $(XARCH_OPTION/$(ARCH_DATA_MODEL))
       
   135 LINT_XARCH_OPTION = $(LINT_XARCH_OPTION/$(ARCH_DATA_MODEL))
       
   136 # The /usr/ccs/bin/as assembler always wants the older SS11 (5.8) options.
       
   137 AS_XARCH_OPTION = $(XARCH_OPTION_OLD/$(ARCH_DATA_MODEL))
       
   138