1 # 2 # Copyright (c) 2006, 2014, 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 define print_info 32 ifneq ($$(LOG_LEVEL), warn) 33 $$(shell echo >&2 "INFO: $1") 34 endif 35 endef 36 37 # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name 38 39 # ARCH can be set explicitly in spec.gmk 40 ifndef ARCH 41 ARCH := $(shell uname -m) 42 # Fold little endian PowerPC64 into big-endian (if ARCH is set in 43 # hotspot-spec.gmk, this will be done by the configure script). 44 ifeq ($(ARCH),ppc64le) 45 ARCH := ppc64 46 endif 47 endif 48 49 PATH_SEP ?= : 50 51 ifeq ($(LP64), 1) 52 ARCH_DATA_MODEL ?= 64 53 else 54 ARCH_DATA_MODEL ?= 32 55 endif 56 57 # zero 58 ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) 59 ifeq ($(ARCH_DATA_MODEL), 64) 60 MAKE_ARGS += LP64=1 61 endif 62 PLATFORM = linux-zero 63 VM_PLATFORM = linux_$(subst i386,i486,$(ZERO_LIBARCH)) 64 HS_ARCH = zero 65 ARCH = zero 66 endif 67 68 # ia64 69 ifeq ($(ARCH), ia64) 70 ARCH_DATA_MODEL = 64 71 MAKE_ARGS += LP64=1 72 PLATFORM = linux-ia64 73 VM_PLATFORM = linux_ia64 74 HS_ARCH = ia64 75 endif 76 77 # sparc 78 ifneq (,$(findstring $(ARCH), sparc)) 79 ifeq ($(ARCH_DATA_MODEL), 64) 80 ARCH_DATA_MODEL = 64 81 MAKE_ARGS += LP64=1 82 PLATFORM = linux-sparcv9 83 VM_PLATFORM = linux_sparcv9 84 else 85 ARCH_DATA_MODEL = 32 86 PLATFORM = linux-sparc 87 VM_PLATFORM = linux_sparc 88 endif 89 HS_ARCH = sparc 90 endif 91 92 # i686/i586 and amd64/x86_64 93 ifneq (,$(findstring $(ARCH), amd64 x86_64 i686 i586)) 94 ifeq ($(ARCH_DATA_MODEL), 64) 95 ARCH_DATA_MODEL = 64 96 MAKE_ARGS += LP64=1 97 PLATFORM = linux-amd64 98 VM_PLATFORM = linux_amd64 99 else 100 ARCH_DATA_MODEL = 32 101 PLATFORM = linux-i586 102 VM_PLATFORM = linux_i486 103 endif 104 105 HS_ARCH = x86 106 endif 107 108 # ARM 109 ifeq ($(ARCH), arm) 110 ARCH_DATA_MODEL = 32 111 PLATFORM = linux-arm 112 VM_PLATFORM = linux_arm 113 HS_ARCH = arm 114 endif 115 116 # PPC 117 # Notice: after 8046471 ARCH will be 'ppc' for top-level ppc64 builds but 118 # 'ppc64' for HotSpot-only ppc64 builds. Need to detect both variants here! 119 ifneq (,$(findstring $(ARCH), ppc ppc64)) 120 ifeq ($(ARCH_DATA_MODEL), 64) 121 MAKE_ARGS += LP64=1 122 PLATFORM = linux-ppc64 123 VM_PLATFORM = linux_ppc64 124 else 125 ARCH_DATA_MODEL = 32 126 PLATFORM = linux-ppc 127 VM_PLATFORM = linux_ppc 128 endif 129 130 HS_ARCH = ppc 131 endif 132 133 # AARCH64 134 ifeq ($(ARCH), aarch64) 135 ARCH_DATA_MODEL = 64 136 MAKE_ARGS += LP64=1 137 PLATFORM = linux-aarch64 138 VM_PLATFORM = linux_aarch64 139 HS_ARCH = aarch64 140 endif 141 142 # On 32 bit linux we build server and client, on 64 bit just server. 143 ifeq ($(JVM_VARIANTS),) 144 ifeq ($(ARCH_DATA_MODEL), 32) 145 JVM_VARIANTS:=client,server 146 JVM_VARIANT_CLIENT:=true 147 JVM_VARIANT_SERVER:=true 148 else 149 JVM_VARIANTS:=server 150 JVM_VARIANT_SERVER:=true 151 endif 152 endif 153 154 # determine if HotSpot is being built in JDK6 or earlier version 155 JDK6_OR_EARLIER=0 156 ifeq "$(shell expr \( '$(JDK_MAJOR_VERSION)' != '' \& '$(JDK_MINOR_VERSION)' != '' \& '$(JDK_MICRO_VERSION)' != '' \))" "1" 157 # if the longer variable names (newer build style) are set, then check those 158 ifeq "$(shell expr \( $(JDK_MAJOR_VERSION) = 1 \& $(JDK_MINOR_VERSION) \< 7 \))" "1" 159 JDK6_OR_EARLIER=1 160 endif 161 else 162 # the longer variables aren't set so check the shorter variable names 163 ifeq "$(shell expr \( '$(JDK_MAJOR_VER)' = 1 \& '$(JDK_MINOR_VER)' \< 7 \))" "1" 164 JDK6_OR_EARLIER=1 165 endif 166 endif 167 168 ifeq ($(JDK6_OR_EARLIER),0) 169 # Full Debug Symbols is supported on JDK7 or newer. 170 # The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product 171 # builds is enabled with debug info files ZIP'ed to save space. For 172 # BUILD_FLAVOR != product builds, FDS is always enabled, after all a 173 # debug build without debug info isn't very useful. 174 # The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled. 175 # 176 # If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be 177 # disabled for a BUILD_FLAVOR == product build. 178 # 179 # Note: Use of a different variable name for the FDS override option 180 # versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS 181 # versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass 182 # in options via environment variables, use of distinct variables 183 # prevents strange behaviours. For example, in a BUILD_FLAVOR != 184 # product build, the FULL_DEBUG_SYMBOLS environment variable will be 185 # 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If 186 # the same variable name is used, then different values can be picked 187 # up by different parts of the build. Just to be clear, we only need 188 # two variable names because the incoming option value can be 189 # overridden in some situations, e.g., a BUILD_FLAVOR != product 190 # build. 191 192 # Due to the multiple sub-make processes that occur this logic gets 193 # executed multiple times. We reduce the noise by at least checking that 194 # BUILD_FLAVOR has been set. 195 ifneq ($(BUILD_FLAVOR),) 196 ifeq ($(BUILD_FLAVOR), product) 197 FULL_DEBUG_SYMBOLS ?= 1 198 ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) 199 else 200 # debug variants always get Full Debug Symbols (if available) 201 ENABLE_FULL_DEBUG_SYMBOLS = 1 202 endif 203 $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) 204 # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later 205 206 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 207 # Default OBJCOPY comes from GNU Binutils on Linux 208 ifeq ($(CROSS_COMPILE_ARCH),) 209 DEF_OBJCOPY=/usr/bin/objcopy 210 else 211 # Assume objcopy is part of the cross-compilation toolset 212 ifneq ($(ALT_COMPILER_PATH),) 213 DEF_OBJCOPY=$(ALT_COMPILER_PATH)/objcopy 214 endif 215 endif 216 OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) 217 ifneq ($(ALT_OBJCOPY),) 218 $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)")) 219 OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) 220 endif 221 222 ifeq ($(OBJCOPY),) 223 $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.")) 224 ENABLE_FULL_DEBUG_SYMBOLS=0 225 $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) 226 else 227 $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files.")) 228 229 # Library stripping policies for .debuginfo configs: 230 # all_strip - strips everything from the library 231 # min_strip - strips most stuff from the library; leaves minimum symbols 232 # no_strip - does not strip the library at all 233 # 234 # Oracle security policy requires "all_strip". A waiver was granted on 235 # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. 236 # 237 # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. 238 # 239 STRIP_POLICY ?= min_strip 240 241 $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)")) 242 243 ZIP_DEBUGINFO_FILES ?= 1 244 245 $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")) 246 endif 247 endif # ENABLE_FULL_DEBUG_SYMBOLS=1 248 endif # BUILD_FLAVOR 249 endif # JDK_6_OR_EARLIER 250 251 JDK_INCLUDE_SUBDIR=linux 252 253 # Library suffix 254 LIBRARY_SUFFIX=so 255 256 EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html 257 258 # client and server subdirectories have symbolic links to ../libjsig.so 259 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) 260 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 261 ifeq ($(ZIP_DEBUGINFO_FILES),1) 262 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.diz 263 else 264 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo 265 endif 266 endif 267 EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server 268 EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client 269 EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal 270 271 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK) $(JVM_VARIANT_CORE)), true) 272 EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt 273 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) 274 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 275 ifeq ($(ZIP_DEBUGINFO_FILES),1) 276 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz 277 else 278 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo 279 endif 280 endif 281 endif 282 283 ifeq ($(JVM_VARIANT_CLIENT),true) 284 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt 285 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) 286 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 287 ifeq ($(ZIP_DEBUGINFO_FILES),1) 288 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz 289 else 290 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo 291 endif 292 endif 293 endif 294 295 ifeq ($(JVM_VARIANT_MINIMAL1),true) 296 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt 297 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX) 298 299 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 300 ifeq ($(ZIP_DEBUGINFO_FILES),1) 301 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.diz 302 else 303 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.debuginfo 304 endif 305 endif 306 endif 307 308 # Serviceability Binaries 309 310 ADD_SA_BINARIES/DEFAULT = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ 311 $(EXPORT_LIB_DIR)/sa-jdi.jar 312 313 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 314 ifeq ($(ZIP_DEBUGINFO_FILES),1) 315 ADD_SA_BINARIES/DEFAULT += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz 316 else 317 ADD_SA_BINARIES/DEFAULT += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo 318 endif 319 endif 320 321 ADD_SA_BINARIES/$(HS_ARCH) = $(ADD_SA_BINARIES/DEFAULT) 322 323 # No SA Support for zero 324 ADD_SA_BINARIES/zero = 325 326 -include $(HS_ALT_MAKE)/linux/makefiles/defs.make 327 328 EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))