make/linux/makefiles/defs.make

Mon, 05 Nov 2012 19:33:44 -0500

author
dholmes
date
Mon, 05 Nov 2012 19:33:44 -0500
changeset 4243
857f3ce858dd
parent 4165
fb19af007ffc
child 4637
1b0dc9f87e75
permissions
-rw-r--r--

8002034: Allow Full Debug Symbols when cross-compiling
8001756: Hotspot makefiles report missing OBJCOPY command in the wrong circumstances
Reviewed-by: dcubed, dsamersoff, erikj, collins

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

mercurial