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 bsd 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 ARCH:=$(shell uname -m)
  39 PATH_SEP = :
  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         = bsd-zero
  52   VM_PLATFORM      = bsd_$(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        = bsd-ia64
  62   VM_PLATFORM     = bsd_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         = bsd-sparcv9
  72     VM_PLATFORM      = bsd_sparcv9
  73   else
  74     ARCH_DATA_MODEL  = 32
  75     PLATFORM         = bsd-sparc
  76     VM_PLATFORM      = bsd_sparc
  77   endif
  78   HS_ARCH            = sparc
  79 endif
  80 
  81 # amd64
  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        = bsd-amd64
  87     VM_PLATFORM     = bsd_amd64
  88     HS_ARCH         = x86
  89   else
  90     ARCH_DATA_MODEL = 32
  91     PLATFORM        = bsd-i586
  92     VM_PLATFORM     = bsd_i486
  93     HS_ARCH         = x86
  94     # We have to reset ARCH to i386 since SRCARCH relies on it
  95     ARCH            = i386
  96   endif
  97 endif
  98 
  99 # i386
 100 ifeq ($(ARCH), i386)
 101   ifeq ($(ARCH_DATA_MODEL), 64)
 102     ARCH_DATA_MODEL = 64
 103     MAKE_ARGS       += LP64=1
 104     PLATFORM        = bsd-amd64
 105     VM_PLATFORM     = bsd_amd64
 106     HS_ARCH         = x86
 107     # We have to reset ARCH to amd64 since SRCARCH relies on it
 108     ARCH            = amd64
 109   else
 110     ARCH_DATA_MODEL  = 32
 111     PLATFORM         = bsd-i586
 112     VM_PLATFORM      = bsd_i486
 113     HS_ARCH          = x86
 114   endif
 115 endif
 116 
 117 # ARM
 118 ifeq ($(ARCH), arm)
 119   ARCH_DATA_MODEL  = 32
 120   PLATFORM         = bsd-arm
 121   VM_PLATFORM      = bsd_arm
 122   HS_ARCH          = arm
 123 endif
 124 
 125 # PPC
 126 ifeq ($(ARCH), ppc)
 127   ARCH_DATA_MODEL  = 32
 128   PLATFORM         = bsd-ppc
 129   VM_PLATFORM      = bsd_ppc
 130   HS_ARCH          = ppc
 131 endif
 132 
 133 # On 32 bit bsd 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 OS_VENDOR:=$(shell uname -s)
 146 
 147 # determine if HotSpot is being built in JDK6 or earlier version
 148 JDK6_OR_EARLIER=0
 149 ifeq "$(shell expr \( '$(JDK_MAJOR_VERSION)' != '' \& '$(JDK_MINOR_VERSION)' != '' \& '$(JDK_MICRO_VERSION)' != '' \))" "1"
 150   # if the longer variable names (newer build style) are set, then check those
 151   ifeq "$(shell expr \( $(JDK_MAJOR_VERSION) = 1 \& $(JDK_MINOR_VERSION) \< 7 \))" "1"
 152     JDK6_OR_EARLIER=1
 153   endif
 154 else
 155   # the longer variables aren't set so check the shorter variable names
 156   ifeq "$(shell expr \( '$(JDK_MAJOR_VER)' = 1 \& '$(JDK_MINOR_VER)' \< 7 \))" "1"
 157     JDK6_OR_EARLIER=1
 158   endif
 159 endif
 160 
 161 ifeq ($(JDK6_OR_EARLIER),0)
 162   # Full Debug Symbols is supported on JDK7 or newer.
 163   # The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product
 164   # builds is enabled with debug info files ZIP'ed to save space. For
 165   # BUILD_FLAVOR != product builds, FDS is always enabled, after all a
 166   # debug build without debug info isn't very useful.
 167   # The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled.
 168   #
 169   # If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be
 170   # disabled for a BUILD_FLAVOR == product build.
 171   #
 172   # Note: Use of a different variable name for the FDS override option
 173   # versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS
 174   # versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass
 175   # in options via environment variables, use of distinct variables
 176   # prevents strange behaviours. For example, in a BUILD_FLAVOR !=
 177   # product build, the FULL_DEBUG_SYMBOLS environment variable will be
 178   # 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If
 179   # the same variable name is used, then different values can be picked
 180   # up by different parts of the build. Just to be clear, we only need
 181   # two variable names because the incoming option value can be
 182   # overridden in some situations, e.g., a BUILD_FLAVOR != product
 183   # build.
 184 
 185   # Due to the multiple sub-make processes that occur this logic gets
 186   # executed multiple times. We reduce the noise by at least checking that
 187   # BUILD_FLAVOR has been set.
 188   ifneq ($(BUILD_FLAVOR),)
 189     ifeq ($(BUILD_FLAVOR), product)
 190       FULL_DEBUG_SYMBOLS ?= 1
 191       ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
 192     else
 193       # debug variants always get Full Debug Symbols (if available)
 194       ENABLE_FULL_DEBUG_SYMBOLS = 1
 195     endif
 196     $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
 197     # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
 198 
 199     ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 200       ifeq ($(OS_VENDOR), Darwin)
 201           # MacOS X doesn't use OBJCOPY or STRIP_POLICY
 202           OBJCOPY=
 203           STRIP_POLICY=
 204           ZIP_DEBUGINFO_FILES ?= 1
 205       else
 206         # Default OBJCOPY comes from GNU Binutils on BSD
 207         ifeq ($(CROSS_COMPILE_ARCH),)
 208           DEF_OBJCOPY=/usr/bin/objcopy
 209         else
 210           # Assume objcopy is part of the cross-compilation toolset
 211           ifneq ($(ALT_COMPILER_PATH),)
 212             DEF_OBJCOPY=$(ALT_COMPILER_PATH)/objcopy
 213           endif
 214         endif
 215         OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
 216         ifneq ($(ALT_OBJCOPY),)
 217           $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)"))
 218           OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
 219         endif
 220 
 221         ifeq ($(OBJCOPY),)
 222           $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo" \
 223               "files. You may need to set ALT_OBJCOPY."))
 224           ENABLE_FULL_DEBUG_SYMBOLS=0
 225           $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
 226         else
 227           $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo" \
 228               "files."))
 229 
 230           # Library stripping policies for .debuginfo configs:
 231           #   all_strip - strips everything from the library
 232           #   min_strip - strips most stuff from the library; leaves
 233           #               minimum symbols
 234           #   no_strip  - does not strip the library at all
 235           #
 236           # Oracle security policy requires "all_strip". A waiver was
 237           # granted on 2011.09.01 that permits using "min_strip" in the
 238           # Java JDK and Java JRE.
 239           #
 240           # Currently, STRIP_POLICY is only used when Full Debug Symbols
 241           # is enabled.
 242           #
 243           STRIP_POLICY ?= min_strip
 244 
 245           $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)"))
 246 
 247           ZIP_DEBUGINFO_FILES ?= 1
 248         endif
 249 
 250         $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)"))
 251       endif
 252     endif # ENABLE_FULL_DEBUG_SYMBOLS=1
 253   endif # BUILD_FLAVOR
 254 endif # JDK_6_OR_EARLIER
 255 
 256 JDK_INCLUDE_SUBDIR=bsd
 257 
 258 # Library suffix
 259 ifeq ($(OS_VENDOR),Darwin)
 260   LIBRARY_SUFFIX=dylib
 261 else
 262   LIBRARY_SUFFIX=so
 263 endif
 264 
 265 EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html
 266 
 267 # client and server subdirectories have symbolic links to ../libjsig.so
 268 EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
 269 
 270 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 271   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 272       EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.diz
 273   else
 274     ifeq ($(OS_VENDOR), Darwin)
 275         EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX).dSYM
 276     else
 277         EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.debuginfo
 278     endif
 279   endif
 280 endif
 281 
 282 EXPORT_SERVER_DIR = $(EXPORT_LIB_ARCH_DIR)/server
 283 EXPORT_CLIENT_DIR = $(EXPORT_LIB_ARCH_DIR)/client
 284 EXPORT_MINIMAL_DIR = $(EXPORT_LIB_ARCH_DIR)/minimal
 285 
 286 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
 287   EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
 288   EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
 289 
 290   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 291     ifeq ($(ZIP_DEBUGINFO_FILES),1)
 292         EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz
 293     else
 294       ifeq ($(OS_VENDOR), Darwin)
 295           EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX).dSYM
 296       else
 297           EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo
 298       endif
 299     endif
 300   endif
 301 endif
 302 
 303 ifeq ($(JVM_VARIANT_CLIENT),true)
 304   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
 305   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
 306 
 307   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 308     ifeq ($(ZIP_DEBUGINFO_FILES),1)
 309         EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz
 310     else
 311       ifeq ($(OS_VENDOR), Darwin)
 312           EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX).dSYM
 313       else
 314           EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo
 315       endif
 316     endif
 317   endif
 318 endif
 319 
 320 ifeq ($(JVM_VARIANT_MINIMAL1),true)
 321   EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt
 322   EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX)
 323 endif
 324 
 325 # Serviceability Binaries
 326 # No SA Support for PPC, IA64, ARM or zero
 327 ADD_SA_BINARIES/x86   = $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
 328                         $(EXPORT_LIB_DIR)/sa-jdi.jar
 329 
 330 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 331   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 332       ADD_SA_BINARIES/x86 += $(EXPORT_LIB_ARCH_DIR)/libsaproc.diz
 333   else
 334     ifeq ($(OS_VENDOR), Darwin)
 335         ADD_SA_BINARIES/x86 += $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
 336     else
 337         ADD_SA_BINARIES/x86 += $(EXPORT_LIB_ARCH_DIR)/libsaproc.debuginfo
 338     endif
 339   endif
 340 endif
 341 
 342 ADD_SA_BINARIES/sparc = $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
 343                         $(EXPORT_LIB_DIR)/sa-jdi.jar
 344 ADD_SA_BINARIES/universal = $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
 345                             $(EXPORT_LIB_DIR)/sa-jdi.jar
 346 
 347 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 348   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 349       ADD_SA_BINARIES/universal += $(EXPORT_LIB_ARCH_DIR)/libsaproc.diz
 350   else
 351     ifeq ($(OS_VENDOR), Darwin)
 352         ADD_SA_BINARIES/universal += $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
 353     else
 354         ADD_SA_BINARIES/universal += $(EXPORT_LIB_ARCH_DIR)/libsaproc.debuginfo
 355     endif
 356   endif
 357 endif
 358 
 359 ADD_SA_BINARIES/ppc   =
 360 ADD_SA_BINARIES/ia64  =
 361 ADD_SA_BINARIES/arm   =
 362 ADD_SA_BINARIES/zero  =
 363 
 364 EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))
 365 
 366 # Universal build settings
 367 ifeq ($(OS_VENDOR), Darwin)
 368   # Build universal binaries by default on Mac OS X
 369   MACOSX_UNIVERSAL = true
 370   ifneq ($(ALT_MACOSX_UNIVERSAL),)
 371     MACOSX_UNIVERSAL = $(ALT_MACOSX_UNIVERSAL)
 372   endif
 373   MAKE_ARGS += MACOSX_UNIVERSAL=$(MACOSX_UNIVERSAL)
 374 
 375   # Universal settings
 376   ifeq ($(MACOSX_UNIVERSAL), true)
 377 
 378     # Set universal export path but avoid using ARCH or PLATFORM subdirs
 379     EXPORT_PATH=$(OUTPUTDIR)/export-universal$(EXPORT_SUBDIR)
 380     ifneq ($(ALT_EXPORT_PATH),)
 381       EXPORT_PATH=$(ALT_EXPORT_PATH)
 382     endif
 383 
 384     # Set universal image dir
 385     JDK_IMAGE_DIR=$(OUTPUTDIR)/jdk-universal$(EXPORT_SUBDIR)
 386     ifneq ($(ALT_JDK_IMAGE_DIR),)
 387       JDK_IMAGE_DIR=$(ALT_JDK_IMAGE_DIR)
 388     endif
 389 
 390     # Binaries to 'universalize' if built
 391     UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX)
 392     UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/libsaproc.$(LIBRARY_SUFFIX)
 393     UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/server/libjvm.$(LIBRARY_SUFFIX)
 394     UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/client/libjvm.$(LIBRARY_SUFFIX)
 395 
 396     # Files to simply copy in place
 397     UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/Xusage.txt
 398     UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/Xusage.txt
 399     ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 400       ifeq ($(ZIP_DEBUGINFO_FILES),1)
 401           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/libjvm.diz
 402           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/libjvm.diz
 403           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libjsig.diz
 404           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libsaproc.diz
 405       else
 406           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/libjvm.$(LIBRARY_SUFFIX).dSYM
 407           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/libjvm.$(LIBRARY_SUFFIX).dSYM
 408           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX).dSYM
 409           UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
 410       endif
 411     endif
 412 
 413   endif
 414 endif