jdk/makefiles/common/shared/Defs-linux.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 Linux.
       
    28 #
       
    29 
       
    30 # Default for COMPILER_WARNINGS_FATAL on Linux (C & C++ compiler warnings)
       
    31 ifndef COMPILER_WARNINGS_FATAL
       
    32   COMPILER_WARNINGS_FATAL=false
       
    33 endif
       
    34 
       
    35 # Linux 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 =/opt/java
       
    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  = /bin/
       
    65 endif
       
    66 
       
    67 # USRBIN_PATH: path to where the most common Unix commands are.
       
    68 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
    69 ifneq "$(origin ALT_USRBIN_PATH)" "undefined"
       
    70   USRBIN_PATH :=$(call PrefixPath,$(ALT_USRBIN_PATH))
       
    71 else
       
    72   USRBIN_PATH  = /usr/bin/
       
    73 endif
       
    74 
       
    75 # UNIXCCS_PATH: path to where the Solaris ported UNIX commands can be found
       
    76 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
    77 ifneq "$(origin ALT_UNIXCCS_PATH)" "undefined"
       
    78   UNIXCCS_PATH :=$(call PrefixPath,$(ALT_UNIXCCS_PATH))
       
    79 else
       
    80   UNIXCCS_PATH = /usr/ccs/bin/
       
    81 endif
       
    82 
       
    83 # SLASH_JAVA: location of all network accessable files
       
    84 ifdef ALT_SLASH_JAVA
       
    85   SLASH_JAVA  :=$(ALT_SLASH_JAVA)
       
    86 else
       
    87   SLASH_JAVA  := $(call DirExists,/java,/java,/NOT-SET)
       
    88 endif
       
    89 
       
    90 # JDK_DEVTOOLS_DIR: common path for all the java devtools
       
    91 ifdef ALT_JDK_DEVTOOLS_DIR
       
    92   JDK_DEVTOOLS_DIR  =$(ALT_JDK_DEVTOOLS_DIR)
       
    93 else
       
    94   JDK_DEVTOOLS_DIR =$(SLASH_JAVA)/devtools
       
    95 endif
       
    96 
       
    97 # COMPILER_PATH: path to where the compiler and tools are installed.
       
    98 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
    99 ifneq "$(origin ALT_COMPILER_PATH)" "undefined"
       
   100   COMPILER_PATH :=$(call PrefixPath,$(ALT_COMPILER_PATH))
       
   101 else
       
   102   COMPILER_PATH  =/usr/bin/
       
   103 endif
       
   104 
       
   105 # OPENWIN_HOME: path to where the X11 environment is installed.
       
   106 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
   107 ifneq ($(ALT_OPENWIN_HOME),)
       
   108   OPENWIN_HOME :=$(call PrefixPath,$(ALT_OPENWIN_HOME))
       
   109 else
       
   110   OPENWIN_HOME  ?=$(SYS_ROOT)/usr/X11R6/
       
   111 endif
       
   112 
       
   113 # DEVTOOLS_PATH: for other tools required for building (such as zip, etc.)
       
   114 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
   115 ifneq "$(origin ALT_DEVTOOLS_PATH)" "undefined"
       
   116   DEVTOOLS_PATH :=$(call PrefixPath,$(ALT_DEVTOOLS_PATH))
       
   117 else
       
   118   DEVTOOLS_PATH =/usr/bin/
       
   119 endif
       
   120 
       
   121 # _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK.
       
   122 # _BOOTDIR2: Second choice
       
   123 ifndef ALT_BOOTDIR
       
   124   _BOOTDIR1  =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
       
   125   _BOOTDIR2  =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION)
       
   126 endif
       
   127 
       
   128 # Always build headless on Linux
       
   129 BUILD_HEADLESS = true
       
   130 LIBM=-lm
       
   131 
       
   132 # GCC29_COMPILER_PATH: is the path to where the gcc 2.9 compiler is installed
       
   133 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
       
   134 ifdef ALT_GCC29_COMPILER_PATH
       
   135   GCC29_COMPILER_PATH :=$(call PrefixPath,$(ALT_GCC29_COMPILER_PATH))
       
   136 else
       
   137   GCC29_COMPILER_PATH = $(JDK_DEVTOOLS_DIR)/$(PLATFORM)/gcc29/usr/
       
   138 endif
       
   139 
       
   140 _CUPS_HEADERS_PATH=/usr/include
       
   141 
       
   142 # Import JDK images allow for partial builds, components not built are
       
   143 #    imported (or copied from) these import areas when needed.
       
   144 
       
   145 # BUILD_JDK_IMPORT_PATH: location of JDK install trees to import for 
       
   146 #   multiple platforms, e.g. windows-i586, solaris-sparc, linux-586, etc.
       
   147 ifdef ALT_BUILD_JDK_IMPORT_PATH
       
   148   BUILD_JDK_IMPORT_PATH  :=$(call FullPath,$(ALT_BUILD_JDK_IMPORT_PATH))
       
   149 else
       
   150   BUILD_JDK_IMPORT_PATH   = $(PROMOTED_BUILD_BINARIES)
       
   151 endif
       
   152 
       
   153 # JDK_IMPORT_PATH: location of JDK install tree (this version) to import
       
   154 ifdef ALT_JDK_IMPORT_PATH
       
   155   JDK_IMPORT_PATH  :=$(call FullPath,$(ALT_JDK_IMPORT_PATH))
       
   156 else
       
   157   JDK_IMPORT_PATH   = $(BUILD_JDK_IMPORT_PATH)/$(PLATFORM)-$(ARCH)$(_JDK_IMPORT_VARIANT)
       
   158 endif
       
   159 
       
   160 # HOTSPOT_IMPORT_PATH: location of hotspot pre-built files
       
   161 ifdef ALT_HOTSPOT_IMPORT_PATH
       
   162   HOTSPOT_IMPORT_PATH :=$(call FullPath,$(ALT_HOTSPOT_IMPORT_PATH))
       
   163 else
       
   164   HOTSPOT_IMPORT_PATH ?=$(JDK_IMPORT_PATH)
       
   165 endif
       
   166 
       
   167 # HOTSPOT_CLIENT_PATH: location of client jvm library file.
       
   168 ifeq ($(ARCH_DATA_MODEL), 32)
       
   169   ifdef ALT_HOTSPOT_CLIENT_PATH
       
   170     HOTSPOT_CLIENT_PATH :=$(call FullPath,$(ALT_HOTSPOT_CLIENT_PATH))
       
   171   else
       
   172     HOTSPOT_CLIENT_PATH   =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/client
       
   173   endif
       
   174 endif
       
   175 
       
   176 # HOTSPOT_SERVER_PATH: location of server jvm library file.
       
   177 ifdef ALT_HOTSPOT_SERVER_PATH
       
   178   HOTSPOT_SERVER_PATH :=$(call FullPath,$(ALT_HOTSPOT_SERVER_PATH))
       
   179 else
       
   180   HOTSPOT_SERVER_PATH   =$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/server
       
   181 endif
       
   182 
       
   183 # Special define for checking the binaries
       
   184 
       
   185 # Debug builds should downgrade warnings to just info
       
   186 MAPFILE_WARNING-DBG=INFO
       
   187 MAPFILE_WARNING-OPT=WARNING
       
   188 MAPFILE_WARNING-=WARNING
       
   189 MAPFILE_WARNING=$(MAPFILE_WARNING-$(VARIANT))
       
   190 
       
   191 # Macro to check it's input file for banned dependencies and verify the
       
   192 #   binary built properly. Relies on process exit code.
       
   193 ifndef CROSS_COMPILE_ARCH
       
   194 define binary_file_verification # binary_file
       
   195 ( \
       
   196   $(ECHO) "Checking for mapfile use in: $1" && \
       
   197   if [ "`$(NM) -D -g --defined-only $1 | $(EGREP) 'SUNWprivate'`" = "" ] ; then \
       
   198     $(ECHO) "$(MAPFILE_WARNING): File was not built with a mapfile: $1"; \
       
   199   fi && \
       
   200   $(ECHO) "Library loads for: $1" && \
       
   201   $(LDD) $1 && \
       
   202   $(ECHO) "RUNPATH for: $1" && \
       
   203   ( $(READELF) -d $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \
       
   204 )
       
   205 endef
       
   206 else
       
   207 define binary_file_verification 
       
   208 ( \
       
   209   $(ECHO) "Skipping binary file verification for cross-compile build" \
       
   210 )
       
   211 endef
       
   212 endif
       
   213