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

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

mercurial