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 # On 32 bit linux we build server and client, on 64 bit just server. 134 ifeq ($(JVM_VARIANTS),) 135 ifeq ($(ARCH_DATA_MODEL), 32) 136 JVM_VARIANTS:=client,server 137 JVM_VARIANT_CLIENT:=true 138 JVM_VARIANT_SERVER:=true 139 else 140 JVM_VARIANTS:=server 141 JVM_VARIANT_SERVER:=true 142 endif 143 endif 144 145 # determine if HotSpot is being built in JDK6 or earlier version 146 JDK6_OR_EARLIER=0 147 ifeq "$(shell expr \( '$(JDK_MAJOR_VERSION)' != '' \& '$(JDK_MINOR_VERSION)' != '' \& '$(JDK_MICRO_VERSION)' != '' \))" "1" 148 # if the longer variable names (newer build style) are set, then check those 149 ifeq "$(shell expr \( $(JDK_MAJOR_VERSION) = 1 \& $(JDK_MINOR_VERSION) \< 7 \))" "1" 150 JDK6_OR_EARLIER=1 151 endif 152 else 153 # the longer variables aren't set so check the shorter variable names 154 ifeq "$(shell expr \( '$(JDK_MAJOR_VER)' = 1 \& '$(JDK_MINOR_VER)' \< 7 \))" "1" 155 JDK6_OR_EARLIER=1 156 endif 157 endif 158 159 ifeq ($(JDK6_OR_EARLIER),0) 160 # Full Debug Symbols is supported on JDK7 or newer. 161 # The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product 162 # builds is enabled with debug info files ZIP'ed to save space. For 163 # BUILD_FLAVOR != product builds, FDS is always enabled, after all a 164 # debug build without debug info isn't very useful. 165 # The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled. 166 # 167 # If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be 168 # disabled for a BUILD_FLAVOR == product build. 169 # 170 # Note: Use of a different variable name for the FDS override option 171 # versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS 172 # versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass 173 # in options via environment variables, use of distinct variables 174 # prevents strange behaviours. For example, in a BUILD_FLAVOR != 175 # product build, the FULL_DEBUG_SYMBOLS environment variable will be 176 # 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If 177 # the same variable name is used, then different values can be picked 178 # up by different parts of the build. Just to be clear, we only need 179 # two variable names because the incoming option value can be 180 # overridden in some situations, e.g., a BUILD_FLAVOR != product 181 # build. 182 183 # Due to the multiple sub-make processes that occur this logic gets 184 # executed multiple times. We reduce the noise by at least checking that 185 # BUILD_FLAVOR has been set. 186 ifneq ($(BUILD_FLAVOR),) 187 ifeq ($(BUILD_FLAVOR), product) 188 FULL_DEBUG_SYMBOLS ?= 1 189 ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) 190 else 191 # debug variants always get Full Debug Symbols (if available) 192 ENABLE_FULL_DEBUG_SYMBOLS = 1 193 endif 194 $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) 195 # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later 196 197 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 198 # Default OBJCOPY comes from GNU Binutils on Linux 199 ifeq ($(CROSS_COMPILE_ARCH),) 200 DEF_OBJCOPY=/usr/bin/objcopy 201 else 202 # Assume objcopy is part of the cross-compilation toolset 203 ifneq ($(ALT_COMPILER_PATH),) 204 DEF_OBJCOPY=$(ALT_COMPILER_PATH)/objcopy 205 endif 206 endif 207 OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) 208 ifneq ($(ALT_OBJCOPY),) 209 $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)")) 210 OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) 211 endif 212 213 ifeq ($(OBJCOPY),) 214 $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.")) 215 ENABLE_FULL_DEBUG_SYMBOLS=0 216 $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) 217 else 218 $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files.")) 219 220 # Library stripping policies for .debuginfo configs: 221 # all_strip - strips everything from the library 222 # min_strip - strips most stuff from the library; leaves minimum symbols 223 # no_strip - does not strip the library at all 224 # 225 # Oracle security policy requires "all_strip". A waiver was granted on 226 # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. 227 # 228 # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. 229 # 230 STRIP_POLICY ?= min_strip 231 232 $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)")) 233 234 ZIP_DEBUGINFO_FILES ?= 1 235 236 $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")) 237 endif 238 endif # ENABLE_FULL_DEBUG_SYMBOLS=1 239 endif # BUILD_FLAVOR 240 endif # JDK_6_OR_EARLIER 241 242 JDK_INCLUDE_SUBDIR=linux 243 244 # Library suffix 245 LIBRARY_SUFFIX=so 246 247 EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html 248 249 # client and server subdirectories have symbolic links to ../libjsig.so 250 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) 251 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 252 ifeq ($(ZIP_DEBUGINFO_FILES),1) 253 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.diz 254 else 255 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo 256 endif 257 endif 258 EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server 259 EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client 260 EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal 261 262 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK) $(JVM_VARIANT_CORE)), true) 263 EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt 264 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) 265 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 266 ifeq ($(ZIP_DEBUGINFO_FILES),1) 267 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz 268 else 269 EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo 270 endif 271 endif 272 endif 273 274 ifeq ($(JVM_VARIANT_CLIENT),true) 275 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt 276 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) 277 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 278 ifeq ($(ZIP_DEBUGINFO_FILES),1) 279 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz 280 else 281 EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo 282 endif 283 endif 284 endif 285 286 ifeq ($(JVM_VARIANT_MINIMAL1),true) 287 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt 288 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX) 289 290 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 291 ifeq ($(ZIP_DEBUGINFO_FILES),1) 292 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.diz 293 else 294 EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.debuginfo 295 endif 296 endif 297 endif 298 299 # Serviceability Binaries 300 301 ADD_SA_BINARIES/DEFAULT = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \ 302 $(EXPORT_LIB_DIR)/sa-jdi.jar 303 304 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) 305 ifeq ($(ZIP_DEBUGINFO_FILES),1) 306 ADD_SA_BINARIES/DEFAULT += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz 307 else 308 ADD_SA_BINARIES/DEFAULT += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo 309 endif 310 endif 311 312 ADD_SA_BINARIES/$(HS_ARCH) = $(ADD_SA_BINARIES/DEFAULT) 313 314 # No SA Support for zero 315 ADD_SA_BINARIES/zero = 316 317 -include $(HS_ALT_MAKE)/linux/makefiles/defs.make 318 319 EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))