jdk/makefiles/common/shared/Defs-solaris.gmk
changeset 12317 9670c1610c53
equal deleted inserted replaced
12316:ba6b7a51e226 12317:9670c1610c53
       
     1 #
       
     2 # Copyright (c) 2005, 2011, 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 # Definitions for Solaris.
       
    28 #
       
    29 
       
    30 # Default for COMPILER_WARNINGS_FATAL on Solaris (C & C++ compiler warnings)
       
    31 ifndef COMPILER_WARNINGS_FATAL
       
    32   COMPILER_WARNINGS_FATAL=false
       
    33 endif
       
    34 
       
    35 # Solaris should use parallel compilation for best build times
       
    36 ifndef COMPILE_APPROACH
       
    37   COMPILE_APPROACH = parallel
       
    38 endif
       
    39 
       
    40 # Indication that we are doing an incremental build.
       
    41 #    This may trigger the creation of make depend files.
       
    42 ifndef INCREMENTAL_BUILD
       
    43   INCREMENTAL_BUILD = false
       
    44 endif
       
    45 
       
    46 # FullPath just makes sure it never ends with a / and no duplicates
       
    47 define FullPath
       
    48 $(shell cd $1 2> $(DEV_NULL) && pwd)
       
    49 endef
       
    50 
       
    51 # OptFullPath: Absolute path name of a dir that might not initially exist.
       
    52 define OptFullPath
       
    53 $(shell if [ "$1" != "" -a -d "$1" ]; then (cd $1 && pwd); else echo "$1"; fi)
       
    54 endef
       
    55 
       
    56 # Location on system where jdk installs might be
       
    57 USRJDKINSTANCES_PATH =/usr/jdk/instances
       
    58 
       
    59 # UNIXCOMMAND_PATH: path to where the most common Unix commands are.
       
    60 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
    61 ifneq "$(origin ALT_UNIXCOMMAND_PATH)" "undefined"
       
    62   UNIXCOMMAND_PATH :=$(call PrefixPath,$(ALT_UNIXCOMMAND_PATH))
       
    63 else
       
    64   UNIXCOMMAND_PATH  = /usr/bin/
       
    65 endif
       
    66 
       
    67 # UNIXCCS_PATH: path to where the less common UNIX commands can be found
       
    68 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
    69 ifneq "$(origin ALT_UNIXCCS_PATH)" "undefined"
       
    70   UNIXCCS_PATH :=$(call PrefixPath,$(ALT_UNIXCCS_PATH))
       
    71 else
       
    72   UNIXCCS_PATH = /usr/ccs/bin/
       
    73 endif
       
    74 
       
    75 # SLASH_JAVA: location of all network accessable files
       
    76 ifdef ALT_SLASH_JAVA
       
    77   SLASH_JAVA  :=$(ALT_SLASH_JAVA)
       
    78 else
       
    79   SLASH_JAVA  := $(call DirExists,/java,/java,/NOT-SET)
       
    80 endif
       
    81 
       
    82 # JDK_DEVTOOLS_DIR: common path for all the java devtools
       
    83 ifdef ALT_JDK_DEVTOOLS_DIR
       
    84   JDK_DEVTOOLS_DIR  =$(ALT_JDK_DEVTOOLS_DIR)
       
    85 else
       
    86   JDK_DEVTOOLS_DIR =$(SLASH_JAVA)/devtools
       
    87 endif
       
    88 
       
    89 # COMPILER_PATH: path to where the compiler and tools are installed.
       
    90 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
    91 ifneq "$(origin ALT_COMPILER_PATH)" "undefined"
       
    92   COMPILER_PATH :=$(call PrefixPath,$(ALT_COMPILER_PATH))
       
    93 else
       
    94   # If the place where we keep a set of Sun Studio compilers doesn't exist,
       
    95   #  try and use /opt/SUNWspro, the default location for the SS compilers.
       
    96   #  (DirExists checks for this path twice, an automount double check)
       
    97   _SUNSTUDIO_SET_ROOT=$(JDK_DEVTOOLS_DIR)/$(ARCH_FAMILY)/SUNWspro
       
    98   SUNSTUDIO_SET_ROOT:=$(call DirExists,$(_SUNSTUDIO_SET_ROOT),$(_SUNSTUDIO_SET_ROOT),)
       
    99   ifneq ($(SUNSTUDIO_SET_ROOT),)
       
   100     COMPILER_PATH =$(SUNSTUDIO_SET_ROOT)/$(REQUIRED_COMPILER_VERSION)/bin/
       
   101   else
       
   102     COMPILER_PATH =/opt/SUNWspro/bin/
       
   103   endif
       
   104 endif
       
   105 
       
   106 # DEVTOOLS_PATH: for other tools required for building (such as zip, etc.)
       
   107 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
   108 ifneq "$(origin ALT_DEVTOOLS_PATH)" "undefined"
       
   109   DEVTOOLS_PATH :=$(call PrefixPath,$(ALT_DEVTOOLS_PATH))
       
   110 else
       
   111   ifdef ALT_JDK_DEVTOOLS_DIR
       
   112     DEVTOOLS_PATH =$(JDK_DEVTOOLS_DIR)/$(ARCH_FAMILY)/bin/
       
   113   else
       
   114     ifdef OPENJDK
       
   115       DEVTOOLS_PATH = /usr/bin/
       
   116     else
       
   117       DEVTOOLS_PATH =$(JDK_DEVTOOLS_DIR)/$(ARCH_FAMILY)/bin/
       
   118     endif
       
   119   endif
       
   120 endif
       
   121 
       
   122 # _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK.
       
   123 # _BOOTDIR2: Second choice
       
   124 ifndef ALT_BOOTDIR
       
   125   _BOOTDIR1  =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
       
   126   _BOOTDIR2  =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION)
       
   127 endif
       
   128 
       
   129 # GCC_COMPILER_PATH: path to where the gcc/g++ compiler and tools are installed
       
   130 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
   131 ifneq "$(origin ALT_GCC_COMPILER_PATH)" "undefined"
       
   132   GCC_COMPILER_PATH :=$(call PrefixPath,$(ALT_GCC_COMPILER_PATH))
       
   133 else
       
   134   GCC_COMPILER_PATH = $(JDK_DEVTOOLS_DIR)/$(ARCH_FAMILY)/gnucc/bin/
       
   135 endif
       
   136 
       
   137 
       
   138 # Always build headless on Solaris
       
   139 BUILD_HEADLESS = true
       
   140 
       
   141 _CUPS_HEADERS_PATH=/opt/sfw/cups/include
       
   142 
       
   143 # Import JDK images allow for partial builds, components not built are
       
   144 #    imported (or copied from) these import areas when needed.
       
   145 
       
   146 # BUILD_JDK_IMPORT_PATH: location of JDK install trees to import for 
       
   147 #   multiple platforms, e.g. windows-i586, solaris-sparc, linux-586, etc.
       
   148 ifdef ALT_BUILD_JDK_IMPORT_PATH
       
   149   BUILD_JDK_IMPORT_PATH  :=$(call FullPath,$(ALT_BUILD_JDK_IMPORT_PATH))
       
   150 else
       
   151   BUILD_JDK_IMPORT_PATH   = $(PROMOTED_BUILD_BINARIES)
       
   152 endif
       
   153 
       
   154 # JDK_IMPORT_PATH: location of previously built JDK (this version) to import
       
   155 ifdef ALT_JDK_IMPORT_PATH
       
   156   JDK_IMPORT_PATH  :=$(call FullPath,$(ALT_JDK_IMPORT_PATH))
       
   157 else
       
   158   JDK_IMPORT_PATH   = $(BUILD_JDK_IMPORT_PATH)/$(PLATFORM)-$(ARCH)$(_JDK_IMPORT_VARIANT)
       
   159 endif
       
   160 
       
   161 # HOTSPOT_IMPORT_PATH: location of hotspot pre-built files
       
   162 ifdef ALT_HOTSPOT_IMPORT_PATH
       
   163   HOTSPOT_IMPORT_PATH :=$(call FullPath,$(ALT_HOTSPOT_IMPORT_PATH))
       
   164 else
       
   165   HOTSPOT_IMPORT_PATH ?=$(JDK_IMPORT_PATH)
       
   166 endif
       
   167 
       
   168 # HOTSPOT_CLIENT_PATH: location of client jvm library file.
       
   169 ifeq ($(ARCH_DATA_MODEL), 32)
       
   170   ifdef ALT_HOTSPOT_CLIENT_PATH
       
   171     HOTSPOT_CLIENT_PATH :=$(call FullPath,$(ALT_HOTSPOT_CLIENT_PATH))
       
   172   else
       
   173     HOTSPOT_CLIENT_PATH   =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/client
       
   174   endif
       
   175 endif
       
   176 
       
   177 # HOTSPOT_SERVER_PATH: location of server jvm library file.
       
   178 ifdef ALT_HOTSPOT_SERVER_PATH
       
   179   HOTSPOT_SERVER_PATH :=$(call FullPath,$(ALT_HOTSPOT_SERVER_PATH))
       
   180 else
       
   181   HOTSPOT_SERVER_PATH   =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/server
       
   182 endif
       
   183 
       
   184 # Special define for checking the binaries
       
   185 
       
   186 # Debug builds should downgrade warnings to just info
       
   187 MAPFILE_WARNING-DBG=INFO
       
   188 MAPFILE_WARNING-OPT=WARNING
       
   189 MAPFILE_WARNING-=WARNING
       
   190 MAPFILE_WARNING=$(MAPFILE_WARNING-$(VARIANT))
       
   191 
       
   192 # Some libraries do not have mapfiles for multiple reasons.
       
   193 #   These libraries for sparc and sparcv9 are exceptions to the mapfile rule:
       
   194 #     libjdgaSUNWafb.so
       
   195 #     libjdgaSUNWcg6.so
       
   196 #     libjdgaSUNWffb.so
       
   197 #     libjdgaSUNWm64.so
       
   198 #     libxinerama.so
       
   199 #   The library libJdbcOdbc.so has also been given an exception.
       
   200 #   The JNI/JVMTI demo libraries are also missing mapfiles, no exceptions yet.
       
   201 ifeq ($(ARCH_FAMILY),sparc)
       
   202   MAPFILE_EXCEPTIONS = \
       
   203     (libJdbcOdbc|libjdgaSUNWafb|libjdgaSUNWcg6|libjdgaSUNWffb|libjdgaSUNWm64|libxinerama)
       
   204 else
       
   205   MAPFILE_EXCEPTIONS = (libJdbcOdbc)
       
   206 endif
       
   207 
       
   208 # Macro to check it's input file for banned dependencies and verify the
       
   209 #   binary built properly. Relies on process exit code.
       
   210 ifndef CROSS_COMPILE_ARCH
       
   211 ifneq (,$(DUMP))
       
   212 define binary_file_verification # binary_file
       
   213 ( \
       
   214   $(ECHO) "Checking for mapfile use in: $1" && \
       
   215   if [ "`$(ECHO) $(basename $(notdir $1)) | $(EGREP) '$(MAPFILE_EXCEPTIONS)'`" = "" \
       
   216        -a "`$(NM) -g -D $1 | $(EGREP) -v 'UNDEF' | $(EGREP) 'SUNWprivate'`" = "" ] ; then \
       
   217     $(ECHO) "$(MAPFILE_WARNING): File was not built with a mapfile: $1"; \
       
   218   fi && \
       
   219   $(ECHO) "Library loads for: $1" && \
       
   220   $(LDD) $1 && \
       
   221   $(ECHO) "RUNPATH for: $1" && \
       
   222   ( $(DUMP) -L -v $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \
       
   223 )
       
   224 endef
       
   225 else
       
   226 define binary_file_verification 
       
   227 ( \
       
   228   $(ECHO) "Skipping binary file verification since no dump command found" \
       
   229 )
       
   230 endef
       
   231 endif
       
   232 else
       
   233 define binary_file_verification 
       
   234 ( \
       
   235   $(ECHO) "Skipping binary file verification for cross-compile build" \
       
   236 )
       
   237 endef
       
   238 endif
       
   239