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