make/linux/makefiles/defs.make

Wed, 14 Oct 2020 17:44:48 +0800

author
aoqi
date
Wed, 14 Oct 2020 17:44:48 +0800
changeset 9931
fd44df5e3bc3
parent 9448
73d689add964
permissions
-rw-r--r--

Merge

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

mercurial