1 # 2 # Copyright (c) 2006, 2012, 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. 8 # 9 # This code is distributed in the hope that it will be useful, but WITHOUT 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 # version 2 for more details (a copy is included in the LICENSE file that 13 # accompanied this code). 14 # 15 # You should have received a copy of the GNU General Public License version 16 # 2 along with this work; if not, write to the Free Software Foundation, 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 # 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 # or visit www.oracle.com if you need additional information or have any 21 # questions. 22 # 23 # 24 25 # The common definitions for hotspot linux builds. 26 # Include the top level defs.make under make directory instead of this one. 27 # This file is included into make/defs.make. 28 29 SLASH_JAVA ?= /java 30 31 # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name 32 33 # ARCH can be set explicitly in spec.gmk 34 ifndef ARCH 35 ARCH := $(shell uname -m) 36 endif 37 38 PATH_SEP ?= : 39 40 ifeq ($(LP64), 1) 41 ARCH_DATA_MODEL ?= 64 42 else 43 ARCH_DATA_MODEL ?= 32 44 endif 45 46 # zero 47 ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) 48 ifeq ($(ARCH_DATA_MODEL), 64) 49 MAKE_ARGS += LP64=1 50 endif 51 PLATFORM = linux-zero 52 VM_PLATFORM = linux_$(subst i386,i486,$(ZERO_LIBARCH)) 53 HS_ARCH = zero 54 ARCH = zero 55 endif 56 57 # ia64 58 ifeq ($(ARCH), ia64) 59 ARCH_DATA_MODEL = 64 60 MAKE_ARGS += LP64=1 61 PLATFORM = linux-ia64 62 VM_PLATFORM = linux_ia64 63 HS_ARCH = ia64 64 endif 65 66 # sparc 67 ifeq ($(ARCH), sparc64) 68 ifeq ($(ARCH_DATA_MODEL), 64) 69 ARCH_DATA_MODEL = 64 70 MAKE_ARGS += LP64=1 71 PLATFORM = linux-sparcv9 72 VM_PLATFORM = linux_sparcv9 73 else 74 ARCH_DATA_MODEL = 32 75 PLATFORM = linux-sparc 76 VM_PLATFORM = linux_sparc 77 endif 78 HS_ARCH = sparc 79 endif 80 81 # amd64/x86_64 82 ifneq (,$(findstring $(ARCH), amd64 x86_64)) 83 ifeq ($(ARCH_DATA_MODEL), 64) 84 ARCH_DATA_MODEL = 64 85 MAKE_ARGS += LP64=1 86 PLATFORM = linux-amd64 87 VM_PLATFORM = linux_amd64 88 HS_ARCH = x86 89 else 90 ARCH_DATA_MODEL = 32 91 PLATFORM = linux-i586 92 VM_PLATFORM = linux_i486 93 HS_ARCH = x86 94 # We have to reset ARCH to i686 since SRCARCH relies on it 95 ARCH = i686 96 endif 97 endif 98 99 # i686/i586 ie 32-bit x86 100 ifneq (,$(findstring $(ARCH), i686 i586)) 101 ARCH_DATA_MODEL = 32 102 PLATFORM = linux-i586 103 VM_PLATFORM = linux_i486 104 HS_ARCH = x86 105 endif 106 107 # ARM 108 ifeq ($(ARCH), arm) 109 ARCH_DATA_MODEL = 32 110 PLATFORM = linux-arm 111 VM_PLATFORM = linux_arm 112 HS_ARCH = arm 113 endif 114 115 # PPC 116 ifeq ($(ARCH), ppc) 117 ARCH_DATA_MODEL = 32 118 PLATFORM = linux-ppc 119 VM_PLATFORM = linux_ppc 120 HS_ARCH = ppc 121 endif 122 123 # On 32 bit linux we build server and client, on 64 bit just server. 124 ifeq ($(JVM_VARIANTS),) 125 ifeq ($(ARCH_DATA_MODEL), 32) 126 JVM_VARIANTS:=client,server 127 JVM_VARIANT_CLIENT:=true 128 JVM_VARIANT_SERVER:=true 129 else 130 JVM_VARIANTS:=server 131 JVM_VARIANT_SERVER:=true 132 endif 133 endif 134 135 # determine if HotSpot is being built in JDK6 or earlier version 136 JDK6_OR_EARLIER=0 137 ifeq "$(shell expr \( '$(JDK_MAJOR_VERSION)' != '' \& '$(JDK_MINOR_VERSION)' != '' \& '$(JDK_MICRO_VERSION)' != '' \))" "1" 138 # if the longer variable names (newer build style) are set, then check those 139 ifeq "$(shell expr \( $(JDK_MAJOR_VERSION) = 1 \& $(JDK_MINOR_VERSION) \< 7 \))" "1" 140 JDK6_OR_EARLIER=1 141 endif 142 else 143 # the longer variables aren't set so check the shorter variable names 144 ifeq "$(shell expr \( '$(JDK_MAJOR_VER)' = 1 \& '$(JDK_MINOR_VER)' \< 7 \))" "1" 145 JDK6_OR_EARLIER=1 146 endif 147 endif 148 149 ifeq ($(JDK6_OR_EARLIER),0) 150 # Full Debug Symbols is supported on JDK7 or newer. 151 # The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product 152 # builds is enabled with debug info files ZIP'ed to save space. For 153 # BUILD_FLAVOR != product builds, FDS is always enabled, after all a 154 # debug build without debug info isn't very useful. 155 # The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled. 156 # 157 # If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be 158 # disabled for a BUILD_FLAVOR == product build. 159 # 160 # Note: Use of a different variable name for the FDS override option 161 # versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS 162 # versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass 163 # in options via environment variables, use of distinct variables 164 # prevents strange behaviours. For example, in a BUILD_FLAVOR != 165 # product build, the FULL_DEBUG_SYMBOLS environment variable will be 166 # 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If 167 # the same variable name is used, then different values can be picked 168 # up by different parts of the build. Just to be clear, we only need 169 # two variable names because the incoming option value can be 170 # overridden in some situations, e.g., a BUILD_FLAVOR != product 171 # build. 172 173 ifeq ($(BUILD_FLAVOR), product) 174 FULL_DEBUG_SYMBOLS ?= 1 175 ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) 176 else 177 # debug variants always get Full Debug Symbols (if available) 178 ENABLE_FULL_DEBUG_SYMBOLS = 1 179 endif 180 _JUNK_ := $(shell \ 181 echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") 182 # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later 183 184 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 185 # Default OBJCOPY comes from GNU Binutils on Linux: 186 DEF_OBJCOPY=/usr/bin/objcopy 187 ifdef CROSS_COMPILE_ARCH 188 # don't try to generate .debuginfo files when cross compiling 189 _JUNK_ := $(shell \ 190 echo >&2 "INFO: cross compiling for ARCH $(CROSS_COMPILE_ARCH)," \ 191 "skipping .debuginfo generation.") 192 OBJCOPY= 193 else 194 OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) 195 ifneq ($(ALT_OBJCOPY),) 196 _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") 197 OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) 198 endif 199 endif 200 else 201 OBJCOPY= 202 endif 203 204 ifeq ($(OBJCOPY),) 205 _JUNK_ := $(shell \ 206 echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.") 207 ENABLE_FULL_DEBUG_SYMBOLS=0 208 _JUNK_ := $(shell \ 209 echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") 210 else 211 _JUNK_ := $(shell \ 212 echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") 213 214 # Library stripping policies for .debuginfo configs: 215 # all_strip - strips everything from the library 216 # min_strip - strips most stuff from the library; leaves minimum symbols 217 # no_strip - does not strip the library at all 218 # 219 # Oracle security policy requires "all_strip". A waiver was granted on 220 # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. 221 # 222 # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. 223 # 224 STRIP_POLICY ?= min_strip 225 226 _JUNK_ := $(shell \ 227 echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") 228 229 ZIP_DEBUGINFO_FILES ?= 1 230 231 _JUNK_ := $(shell \ 232 echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") 233 endif 234 endif 235 236 JDK_INCLUDE_SUBDIR=linux 237 238 # Library suffix 239 LIBRARY_SUFFIX=so 240 241 # FIXUP: The subdirectory for a debug build is NOT the same on all platforms 242 VM_DEBUG=jvmg 243 244 EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html 245 246 # client and server subdirectories have symbolic links to ../libjsig.so 247 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) 248 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 249 ifeq ($(ZIP_DEBUGINFO_FILES),1) 250 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.diz 251 else 252 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo 253 endif 254 endif 255 EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server 256 EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client 257 EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal 258 259 #EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar 260 261 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) 262 EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt 263 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) 264 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 265 ifeq ($(ZIP_DEBUGINFO_FILES),1) 266 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz 267 else 268 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo 269 endif 270 endif 271 endif 272 273 ifeq ($(JVM_VARIANT_CLIENT),true) 274 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt 275 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) 276 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 277 ifeq ($(ZIP_DEBUGINFO_FILES),1) 278 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz 279 else 280 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo 281 endif 282 endif 283 endif 284 285 ifeq ($(JVM_VARIANT_MINIMAL1),true) 286 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt 287 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX) 288 289 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 290 ifeq ($(ZIP_DEBUGINFO_FILES),1) 291 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.diz 292 else 293 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.debuginfo 294 endif 295 endif 296 endif 297 298 # Serviceability Binaries 299 # No SA Support for PPC, IA64, ARM or zero 300 ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ 301 $(EXPORT_LIB_DIR)/sa-jdi.jar 302 ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ 303 $(EXPORT_LIB_DIR)/sa-jdi.jar 304 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 305 ifeq ($(ZIP_DEBUGINFO_FILES),1) 306 ADD_SA_BINARIES/x86 += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz 307 ADD_SA_BINARIES/sparc += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz 308 else 309 ADD_SA_BINARIES/x86 += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo 310 ADD_SA_BINARIES/sparc += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo 311 endif 312 endif 313 ADD_SA_BINARIES/ppc = 314 ADD_SA_BINARIES/ia64 = 315 ADD_SA_BINARIES/arm = 316 ADD_SA_BINARIES/zero = 317 318 -include $(HS_ALT_MAKE)/linux/makefiles/defs.make 319 320 EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH)) 321 322