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 #
  24 
  25 # The common definitions for hotspot solaris 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 define print_info
  30   ifneq ($$(LOG_LEVEL), warn)
  31     $$(shell echo >&2 "INFO: $1")
  32   endif
  33 endef
  34 
  35 # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name
  36 SLASH_JAVA ?= /java
  37 ARCH:=$(shell uname -p)
  38 PATH_SEP = :
  39 ifeq ($(LP64), 1)
  40   ARCH_DATA_MODEL=64
  41 else
  42   ARCH_DATA_MODEL=32
  43 endif
  44 
  45 ifeq ($(ARCH),sparc)
  46   ifeq ($(ARCH_DATA_MODEL), 64)
  47     MAKE_ARGS += LP64=1
  48     PLATFORM=solaris-sparcv9
  49     VM_PLATFORM=solaris_sparcv9
  50   else
  51     PLATFORM=solaris-sparc
  52     VM_PLATFORM=solaris_sparc
  53   endif
  54   HS_ARCH=sparc
  55 else
  56   ifeq ($(ARCH_DATA_MODEL), 64)
  57     MAKE_ARGS += LP64=1
  58     PLATFORM=solaris-amd64
  59     VM_PLATFORM=solaris_amd64
  60     HS_ARCH=x86
  61   else
  62     PLATFORM=solaris-i586
  63     VM_PLATFORM=solaris_i486
  64     HS_ARCH=x86
  65   endif
  66 endif
  67 
  68 # On 32 bit solaris we build server and client, on 64 bit just server.
  69 ifeq ($(JVM_VARIANTS),)
  70   ifeq ($(ARCH_DATA_MODEL), 32)
  71     JVM_VARIANTS:=client,server
  72     JVM_VARIANT_CLIENT:=true
  73     JVM_VARIANT_SERVER:=true
  74   else
  75     JVM_VARIANTS:=server
  76     JVM_VARIANT_SERVER:=true
  77   endif
  78 endif
  79 
  80 # The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product
  81 # builds is enabled with debug info files ZIP'ed to save space. For
  82 # BUILD_FLAVOR != product builds, FDS is always enabled, after all a
  83 # debug build without debug info isn't very useful.
  84 # The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled.
  85 #
  86 # If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be
  87 # disabled for a BUILD_FLAVOR == product build.
  88 #
  89 # Note: Use of a different variable name for the FDS override option
  90 # versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS
  91 # versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass
  92 # in options via environment variables, use of distinct variables
  93 # prevents strange behaviours. For example, in a BUILD_FLAVOR !=
  94 # product build, the FULL_DEBUG_SYMBOLS environment variable will be
  95 # 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If
  96 # the same variable name is used, then different values can be picked
  97 # up by different parts of the build. Just to be clear, we only need
  98 # two variable names because the incoming option value can be
  99 # overridden in some situations, e.g., a BUILD_FLAVOR != product
 100 # build.
 101 
 102 # Due to the multiple sub-make processes that occur this logic gets
 103 # executed multiple times. We reduce the noise by at least checking that
 104 # BUILD_FLAVOR has been set.
 105 ifneq ($(BUILD_FLAVOR),)
 106   ifeq ($(BUILD_FLAVOR), product)
 107     FULL_DEBUG_SYMBOLS ?= 1
 108     ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
 109   else
 110     # debug variants always get Full Debug Symbols (if available)
 111     ENABLE_FULL_DEBUG_SYMBOLS = 1
 112   endif
 113   $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
 114   # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
 115 
 116   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 117     # Default OBJCOPY comes from the SUNWbinutils package:
 118     DEF_OBJCOPY=/usr/sfw/bin/gobjcopy
 119     OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
 120     ifneq ($(ALT_OBJCOPY),)
 121       $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)"))
 122       OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
 123     endif
 124 
 125     ifneq ($(OBJCOPY),)
 126       # OBJCOPY version check:
 127       # - version number is last blank separate word on first line
 128       # - version number formats that have been seen:
 129       #   - <major>.<minor>
 130       #   - <major>.<minor>.<micro>
 131       #
 132       # Full Debug Symbols on Solaris needs version 2.21.1 or newer.
 133       #
 134       OBJCOPY_VERS_CHK := $(shell \
 135         $(OBJCOPY) --version \
 136           | sed -n \
 137                 -e 's/.* //' \
 138                 -e '/^[01]\./b bad' \
 139                 -e '/^2\./{' \
 140                 -e '  s/^2\.//' \
 141                 -e '  /^[0-9]$$/b bad' \
 142                 -e '  /^[0-9]\./b bad' \
 143                 -e '  /^1[0-9]$$/b bad' \
 144                 -e '  /^1[0-9]\./b bad' \
 145                 -e '  /^20\./b bad' \
 146                 -e '  /^21\.0$$/b bad' \
 147                 -e '  /^21\.0\./b bad' \
 148                 -e '}' \
 149                 -e ':good' \
 150                 -e 's/.*/VALID_VERSION/p' \
 151                 -e 'q' \
 152                 -e ':bad' \
 153                 -e 's/.*/BAD_VERSION/p' \
 154                 -e 'q' \
 155         )
 156       ifeq ($(OBJCOPY_VERS_CHK),BAD_VERSION)
 157         _JUNK_ := $(shell \
 158           echo >&2 "WARNING: $(OBJCOPY) --version info:"; \
 159           $(OBJCOPY) --version | sed -n -e 's/^/WARNING: /p' -e 'q' >&2; \
 160           echo >&2 "WARNING: an objcopy version of 2.21.1 or newer" \
 161             "is needed to create valid .debuginfo files."; \
 162           echo >&2 "WARNING: ignoring above objcopy command."; \
 163           echo >&2 "WARNING: patch 149063-01 or newer contains the" \
 164             "correct Solaris 10 SPARC version."; \
 165           echo >&2 "WARNING: patch 149064-01 or newer contains the" \
 166             "correct Solaris 10 X86 version."; \
 167           echo >&2 "WARNING: Solaris 11 Update 1 contains the" \
 168             "correct version."; \
 169           )
 170         OBJCOPY=
 171       endif
 172     endif
 173 
 174     ifeq ($(OBJCOPY),)
 175       $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files."))
 176       ENABLE_FULL_DEBUG_SYMBOLS=0
 177       $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
 178     else
 179       $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files."))
 180 
 181       # Library stripping policies for .debuginfo configs:
 182       #   all_strip - strips everything from the library
 183       #   min_strip - strips most stuff from the library; leaves minimum symbols
 184       #   no_strip  - does not strip the library at all
 185       #
 186       # Oracle security policy requires "all_strip". A waiver was granted on
 187       # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE.
 188       #
 189       # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled.
 190       #
 191       STRIP_POLICY ?= min_strip
 192 
 193       $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)"))
 194 
 195       ZIP_DEBUGINFO_FILES ?= 1
 196 
 197       $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)"))
 198     endif
 199   endif # ENABLE_FULL_DEBUG_SYMBOLS=1
 200 endif # BUILD_FLAVOR
 201 
 202 JDK_INCLUDE_SUBDIR=solaris
 203 
 204 # Library suffix
 205 LIBRARY_SUFFIX=so
 206 
 207 EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html
 208 
 209 # client and server subdirectories have symbolic links to ../libjsig.$(LIBRARY_SUFFIX)
 210 EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
 211 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 212   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 213     EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.diz
 214   else
 215     EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.debuginfo
 216   endif
 217 endif
 218 
 219 EXPORT_SERVER_DIR = $(EXPORT_LIB_ARCH_DIR)/server
 220 EXPORT_CLIENT_DIR = $(EXPORT_LIB_ARCH_DIR)/client
 221 
 222 ifeq ($(JVM_VARIANT_SERVER),true)
 223   EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
 224   EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
 225   EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.$(LIBRARY_SUFFIX)
 226   EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX)
 227   ifeq ($(ARCH_DATA_MODEL),32)
 228     EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX)
 229     EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX)
 230   endif
 231   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 232     ifeq ($(ZIP_DEBUGINFO_FILES),1)
 233       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz
 234       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.diz
 235       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.diz
 236       ifeq ($(ARCH_DATA_MODEL),32)
 237         EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.diz
 238         EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.diz
 239       endif
 240     else
 241       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo
 242       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.debuginfo
 243       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.debuginfo
 244       ifeq ($(ARCH_DATA_MODEL),32)
 245         EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.debuginfo
 246         EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.debuginfo
 247       endif
 248     endif
 249   endif
 250 endif
 251 ifeq ($(JVM_VARIANT_CLIENT),true)
 252   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
 253   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
 254   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.$(LIBRARY_SUFFIX)
 255   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX)
 256   ifeq ($(ARCH_DATA_MODEL),32)
 257     EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX)
 258     EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX)
 259   endif
 260   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 261     ifeq ($(ZIP_DEBUGINFO_FILES),1)
 262       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz
 263       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.diz
 264       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.diz
 265       ifeq ($(ARCH_DATA_MODEL),32)
 266         EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.diz
 267         EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.diz
 268       endif
 269     else
 270       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo
 271       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.debuginfo
 272       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.debuginfo
 273       ifeq ($(ARCH_DATA_MODEL),32)
 274         EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.debuginfo
 275         EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.debuginfo
 276       endif
 277     endif
 278   endif
 279 endif
 280 
 281 EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX)
 282 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 283   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 284     EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libsaproc.diz
 285   else
 286     EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libsaproc.debuginfo
 287   endif
 288 endif
 289 EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar