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 Bsd. 28 # 29 30 # Default for COMPILER_WARNINGS_FATAL on Bsd (C & C++ compiler warnings) 31 ifndef COMPILER_WARNINGS_FATAL 32 COMPILER_WARNINGS_FATAL=false 33 endif 34 35 # Bsd 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 = $(PACKAGE_PATH) 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 ifeq ($(OS_VENDOR), Apple) 103 ifndef DEVELOPER_DIR 104 DEVELOPER_DIR = $(shell /usr/bin/xcode-select -print-path)/usr/bin/ 105 endif 106 107 COMPILER_PATH := $(call DirExists,$(DEVELOPER_DIR),/usr/bin/,/NOT-SET) 108 else 109 COMPILER_PATH =/usr/bin/ 110 endif 111 endif 112 113 # OPENWIN_HOME: path to where the X11 environment is installed. 114 # NOTE: Must end with / so that it could be empty, allowing PATH usage. 115 ifneq ($(ALT_OPENWIN_HOME),) 116 OPENWIN_HOME :=$(call PrefixPath,$(ALT_OPENWIN_HOME)) 117 else 118 OPENWIN_HOME =$(X11_PATH) 119 endif 120 121 # DEVTOOLS_PATH: for other tools required for building (such as zip, etc.) 122 # NOTE: Must end with / so that it could be empty, allowing PATH usage. 123 ifneq "$(origin ALT_DEVTOOLS_PATH)" "undefined" 124 DEVTOOLS_PATH :=$(call PrefixPath,$(ALT_DEVTOOLS_PATH)) 125 else 126 DEVTOOLS_PATH =$(PACKAGE_PATH)/bin/ 127 endif 128 129 # _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK. 130 # _BOOTDIR2: Second choice 131 ifndef ALT_BOOTDIR 132 _BOOTDIR1 =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH) 133 _BOOTDIR2 =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION) 134 endif 135 136 # Always build headless on Bsd 137 BUILD_HEADLESS = true 138 LIBM=-lm 139 140 ifeq ($(OS_VENDOR), Apple) 141 _CUPS_HEADERS_PATH=/usr/include 142 else 143 _CUPS_HEADERS_PATH=$(PACKAGE_PATH)/include 144 endif 145 146 # Import JDK images allow for partial builds, components not built are 147 # imported (or copied from) these import areas when needed. 148 149 # BUILD_JDK_IMPORT_PATH: location of JDK install trees to import for 150 # multiple platforms, e.g. windows-i586, solaris-sparc, bsd-586, etc. 151 ifdef ALT_BUILD_JDK_IMPORT_PATH 152 BUILD_JDK_IMPORT_PATH :=$(call FullPath,$(ALT_BUILD_JDK_IMPORT_PATH)) 153 else 154 BUILD_JDK_IMPORT_PATH = $(PROMOTED_BUILD_BINARIES) 155 endif 156 BUILD_JDK_IMPORT_PATH:=$(call AltCheckValue,BUILD_JDK_IMPORT_PATH) 157 158 # JDK_IMPORT_PATH: location of JDK install tree (this version) to import 159 ifdef ALT_JDK_IMPORT_PATH 160 JDK_IMPORT_PATH :=$(call FullPath,$(ALT_JDK_IMPORT_PATH)) 161 else 162 JDK_IMPORT_PATH = $(BUILD_JDK_IMPORT_PATH)/$(PLATFORM)-$(ARCH)$(_JDK_IMPORT_VARIANT) 163 endif 164 JDK_IMPORT_PATH:=$(call AltCheckValue,JDK_IMPORT_PATH) 165 166 # HOTSPOT_IMPORT_PATH: location of hotspot pre-built files 167 ifdef ALT_HOTSPOT_IMPORT_PATH 168 HOTSPOT_IMPORT_PATH :=$(call FullPath,$(ALT_HOTSPOT_IMPORT_PATH)) 169 else 170 HOTSPOT_IMPORT_PATH =$(JDK_IMPORT_PATH) 171 endif 172 HOTSPOT_IMPORT_PATH:=$(call AltCheckValue,HOTSPOT_IMPORT_PATH) 173 174 # check if the HOTSPOT_IMPORT_PATH is a modules image or not 175 HOTSPOT_IMPORT_MODULES_IMAGE := $(shell \ 176 if [ -d $(HOTSPOT_IMPORT_PATH)/jre/$(ARCH_VM_SUBDIR) ] ; then \ 177 echo "false"; \ 178 elif [ -d $(HOTSPOT_IMPORT_PATH)/lib/modules ] ; then \ 179 echo "true"; \ 180 else \ 181 echo "false"; \ 182 fi \ 183 ) 184 185 # MMM ARCH_VM_SUBDIR=jre/lib on Mac OS .. 186 # 187 #ifeq ($(HOTSPOT_IMPORT_MODULES_IMAGE),true) 188 # HOTSPOT_ARCH_VM_SUBDIR=$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR) 189 #else 190 # HOTSPOT_ARCH_VM_SUBDIR=$(HOTSPOT_IMPORT_PATH)/jre/$(ARCH_VM_SUBDIR) 191 #endif 192 HOTSPOT_ARCH_VM_SUBDIR=$(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR) 193 194 HOTSPOT_SALIB_PATH=$(HOTSPOT_ARCH_VM_SUBDIR) 195 196 # HOTSPOT_CLIENT_PATH: location of client jvm library file. 197 ifeq ($(ARCH_DATA_MODEL), 32) 198 ifdef ALT_HOTSPOT_CLIENT_PATH 199 HOTSPOT_CLIENT_PATH :=$(call FullPath,$(ALT_HOTSPOT_CLIENT_PATH)) 200 else 201 HOTSPOT_CLIENT_PATH =$(HOTSPOT_ARCH_VM_SUBDIR)/client 202 endif 203 HOTSPOT_CLIENT_PATH:=$(call AltCheckValue,HOTSPOT_CLIENT_PATH) 204 endif 205 206 # HOTSPOT_SERVER_PATH: location of server jvm library file. 207 ifdef ALT_HOTSPOT_SERVER_PATH 208 HOTSPOT_SERVER_PATH :=$(call FullPath,$(ALT_HOTSPOT_SERVER_PATH)) 209 else 210 HOTSPOT_SERVER_PATH =$(HOTSPOT_ARCH_VM_SUBDIR)/server 211 endif 212 HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH) 213 214 # Special define for checking the binaries 215 216 # Debug builds should downgrade warnings to just info 217 MAPFILE_WARNING-DBG=INFO 218 MAPFILE_WARNING-OPT=WARNING 219 MAPFILE_WARNING-=WARNING 220 MAPFILE_WARNING=$(MAPFILE_WARNING-$(VARIANT)) 221 222 # Macro to check it's input file for banned dependencies and verify the 223 # binary built properly. Relies on process exit code. 224 ifndef CROSS_COMPILE_ARCH 225 ifeq ($(OS_VENDOR), Apple) 226 define binary_file_verification # binary_file 227 ( \ 228 $(ECHO) "Checking for mapfile use in: $1" && \ 229 if [ "`$(NM) -g $1 | $(EGREP) 'SUNWprivate'`" = "" ] ; then \ 230 $(ECHO) "WARNING: File was not built with a mapfile: $1"; \ 231 fi && \ 232 $(ECHO) "Library loads for: $1" && \ 233 $(OTOOL) -L $1 && \ 234 $(ECHO) "RUNPATH for: $1" && \ 235 ( $(OTOOL) -l $1 | $(EGREP) 'path ' ) \ 236 ) || true 237 endef 238 else 239 ifeq ($(OS_VENDOR), OpenBSD) 240 define binary_file_verification # binary_file 241 ( \ 242 $(ECHO) "Checking for mapfile use in: $1" && \ 243 if [ "`$(OBJDUMP) -T $1 | $(EGREP) '[0-9a-f]* g *DF \.text.*SUNWprivate'`" = "" ] ; then \ 244 $(ECHO) "$(MAPFILE_WARNING): File was not built with a mapfile: $1"; \ 245 fi && \ 246 $(ECHO) "Library loads for: $1" && \ 247 $(LDD) $1 && \ 248 $(ECHO) "RUNPATH for: $1" && \ 249 ( $(READELF) -d $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \ 250 ) || true 251 endef 252 else 253 define binary_file_verification # binary_file 254 ( \ 255 $(ECHO) "Checking for mapfile use in: $1" && \ 256 if [ "`$(NM) -D -g --defined-only $1 | $(EGREP) 'SUNWprivate'`" = "" ] ; then \ 257 $(ECHO) "$(MAPFILE_WARNING): File was not built with a mapfile: $1"; \ 258 fi && \ 259 $(ECHO) "Library loads for: $1" && \ 260 $(LDD) $1 && \ 261 $(ECHO) "RUNPATH for: $1" && \ 262 ( $(READELF) -d $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \ 263 ) 264 endef 265 endif # OS_VENDOR == OpenBSD 266 endif # OS_VENDOR == Apple 267 else 268 define binary_file_verification 269 ( \ 270 $(ECHO) "Skipping binary file verification for cross-compile build" \ 271 ) 272 endef 273 endif 274 --- EOF ---