1 #
   2 # Copyright (c) 2005, 2008, 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 
  65 # Name of compilers being used
  66 COMPILER_VERSION-5.7  = SS10
  67 COMPILER_NAME-5.7     = Sun Studio 10
  68 COMPILER_VERSION-5.8  = SS11
  69 COMPILER_NAME-5.8     = Sun Studio 11
  70 COMPILER_VERSION-5.9  = SS12
  71 COMPILER_NAME-5.9     = Sun Studio 12
  72 COMPILER_VERSION-5.10 = SS13
  73 COMPILER_NAME-5.10    = Sun Studio 13
  74 COMPILER_VERSION      = $(COMPILER_VERSION-$(CC_VER))
  75 COMPILER_NAME         = $(COMPILER_NAME-$(CC_VER))
  76 
  77 # Arch specific settings (determines type of .o files and instruction set)
  78 #  Starting in SS12 (5.9), the arch options changed.
  79 #  The assembler /usr/ccs/bin/as wants older SS11 (5.8) style options.
  80 #   Note: We need to have both 32 and 64 values at all times for awt Makefiles.
  81 #
  82 XARCH_OPTION_OLD/32 =
  83 XARCH_OPTION_OLD/64 =
  84 XARCH_OPTION_NEW/32 = -m32
  85 XARCH_OPTION_NEW/64 = -m64
  86 # Lint options are slightly different
  87 LINT_XARCH_OPTION_OLD/32 =
  88 LINT_XARCH_OPTION_OLD/64 =
  89 LINT_XARCH_OPTION_NEW/32 = -m32
  90 LINT_XARCH_OPTION_NEW/64 = -m64
  91 ifeq ($(ARCH_FAMILY), sparc)
  92   ifdef VIS_NEEDED
  93     XARCH_OPTION_OLD/32 += -xarch=v8plusa
  94     XARCH_OPTION_OLD/64 += -xarch=v9a
  95     XARCH_OPTION_NEW/32 += -xarch=sparcvis
  96     XARCH_OPTION_NEW/64 += -xarch=sparcvis
  97   else
  98     # Someday this should change to improve optimization on UltraSPARC
  99     #    and abandon v8, even change to sparcvis or sparcvis2, this
 100     #    abandons machines like the SPARCstation 10.
 101     #    Indications with jdk6 is that alacrity runs do not show a
 102     #    big improvement using v8plus over v8, but other benchmarks might.
 103     XARCH_OPTION_OLD/32 += -xarch=v8
 104     XARCH_OPTION_OLD/64 += -xarch=v9
 105     # Note that this new option (SS12+) effectively means v8plus
 106     XARCH_OPTION_NEW/32 += -xarch=sparc
 107     XARCH_OPTION_NEW/64 += -xarch=sparc
 108   endif
 109   LINT_XARCH_OPTION_OLD/64 += -Xarch=v9
 110 endif
 111 ifeq ($(ARCH_FAMILY), i586)
 112   XARCH_OPTION_OLD/64      += -xarch=amd64
 113   LINT_XARCH_OPTION_OLD/64 += -Xarch=amd64
 114 endif
 115 # Pick the options we want based on the compiler being used.
 116 ifeq ($(shell expr $(CC_VER) \>= 5.9), 1)
 117   XARCH_OPTION/32 = $(XARCH_OPTION_NEW/32)
 118   XARCH_OPTION/64 = $(XARCH_OPTION_NEW/64)
 119   LINT_XARCH_OPTION/32 = $(LINT_XARCH_OPTION_NEW/32)
 120   LINT_XARCH_OPTION/64 = $(LINT_XARCH_OPTION_NEW/64)
 121 else
 122   XARCH_OPTION/32 = $(XARCH_OPTION_OLD/32)
 123   XARCH_OPTION/64 = $(XARCH_OPTION_OLD/64)
 124   LINT_XARCH_OPTION/32 = $(LINT_XARCH_OPTION_OLD/32)
 125   LINT_XARCH_OPTION/64 = $(LINT_XARCH_OPTION_OLD/64)
 126 endif
 127 XARCH_OPTION = $(XARCH_OPTION/$(ARCH_DATA_MODEL))
 128 LINT_XARCH_OPTION = $(LINT_XARCH_OPTION/$(ARCH_DATA_MODEL))
 129 # The /usr/ccs/bin/as assembler always wants the older SS11 (5.8) options.
 130 AS_XARCH_OPTION = $(XARCH_OPTION_OLD/$(ARCH_DATA_MODEL))
 131