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     ifeq ($(COPY_DEBUG_SYMBOLS), true)
 126       ifneq ($(OBJCOPY),)
 127         # OBJCOPY version check:
 128         # - version number is last blank separate word on first line
 129         # - version number formats that have been seen:
 130         #   - <major>.<minor>
 131         #   - <major>.<minor>.<micro>
 132         #
 133         # Full Debug Symbols on Solaris needs version 2.21.1 or newer.
 134         #
 135         OBJCOPY_VERS_CHK := $(shell \
 136           $(OBJCOPY) --version \
 137             | sed -n \
 138                   -e 's/.* //' \
 139                   -e '/^[01]\./b bad' \
 140                   -e '/^2\./{' \
 141                   -e '  s/^2\.//' \
 142                   -e '  /^[0-9]$$/b bad' \
 143                   -e '  /^[0-9]\./b bad' \
 144                   -e '  /^1[0-9]$$/b bad' \
 145                   -e '  /^1[0-9]\./b bad' \
 146                   -e '  /^20\./b bad' \
 147                   -e '  /^21\.0$$/b bad' \
 148                   -e '  /^21\.0\./b bad' \
 149                   -e '}' \
 150                   -e ':good' \
 151                   -e 's/.*/VALID_VERSION/p' \
 152                   -e 'q' \
 153                   -e ':bad' \
 154                   -e 's/.*/BAD_VERSION/p' \
 155                   -e 'q' \
 156           )
 157         ifeq ($(OBJCOPY_VERS_CHK),BAD_VERSION)
 158           _JUNK_ := $(shell \
 159             echo >&2 "WARNING: $(OBJCOPY) --version info:"; \
 160             $(OBJCOPY) --version | sed -n -e 's/^/WARNING: /p' -e 'q' >&2; \
 161             echo >&2 "WARNING: an objcopy version of 2.21.1 or newer" \
 162               "is needed to create valid .debuginfo files."; \
 163             echo >&2 "WARNING: ignoring above objcopy command."; \
 164             echo >&2 "WARNING: patch 149063-01 or newer contains the" \
 165               "correct Solaris 10 SPARC version."; \
 166             echo >&2 "WARNING: patch 149064-01 or newer contains the" \
 167               "correct Solaris 10 X86 version."; \
 168             echo >&2 "WARNING: Solaris 11 Update 1 contains the" \
 169               "correct version."; \
 170             )
 171           OBJCOPY=
 172         endif
 173       endif
 174 
 175       ifeq ($(OBJCOPY),)
 176         $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files."))
 177         ENABLE_FULL_DEBUG_SYMBOLS=0
 178         COPY_DEBUG_SYMBOLS=false
 179         $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)"))
 180       else
 181         $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files."))
 182 
 183         # Library stripping policies for .debuginfo configs:
 184         #   all_strip - strips everything from the library
 185         #   min_strip - strips most stuff from the library; leaves minimum symbols
 186         #   no_strip  - does not strip the library at all
 187         #
 188         # Oracle security policy requires "all_strip". A waiver was granted on
 189         # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE.
 190         #
 191         # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled.
 192         #
 193         STRIP_POLICY ?= min_strip
 194 
 195         $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)"))
 196 
 197         ZIP_DEBUGINFO_FILES ?= 1
 198 
 199         $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)"))
 200       endif
 201     endif # COPY_DEBUG_SYMBOLS=true
 202   endif # ENABLE_FULL_DEBUG_SYMBOLS=1
 203 endif # BUILD_FLAVOR
 204 
 205 JDK_INCLUDE_SUBDIR=solaris
 206 
 207 # Library suffix
 208 LIBRARY_SUFFIX=so
 209 
 210 EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html
 211 
 212 # client and server subdirectories have symbolic links to ../libjsig.$(LIBRARY_SUFFIX)
 213 EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
 214 ifeq ($(COPY_DEBUG_SYMBOLS),true)
 215   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 216     EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.diz
 217   else
 218     EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.debuginfo
 219   endif
 220 endif
 221 
 222 EXPORT_SERVER_DIR = $(EXPORT_LIB_ARCH_DIR)/server
 223 EXPORT_CLIENT_DIR = $(EXPORT_LIB_ARCH_DIR)/client
 224 
 225 ifeq ($(JVM_VARIANT_SERVER),true)
 226   EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
 227   EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
 228   EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.$(LIBRARY_SUFFIX)
 229   EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX)
 230   ifeq ($(ARCH_DATA_MODEL),32)
 231     EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX)
 232     EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX)
 233   endif
 234   ifeq ($(COPY_DEBUG_SYMBOLS),true)
 235     ifeq ($(ZIP_DEBUGINFO_FILES),1)
 236       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz
 237       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.diz
 238       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.diz
 239       ifeq ($(ARCH_DATA_MODEL),32)
 240         EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.diz
 241         EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.diz
 242       endif
 243     else
 244       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo
 245       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.debuginfo
 246       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.debuginfo
 247       ifeq ($(ARCH_DATA_MODEL),32)
 248         EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.debuginfo
 249         EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.debuginfo
 250       endif
 251     endif
 252   endif
 253 endif
 254 ifeq ($(JVM_VARIANT_CLIENT),true)
 255   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
 256   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
 257   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.$(LIBRARY_SUFFIX)
 258   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX)
 259   ifeq ($(ARCH_DATA_MODEL),32)
 260     EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX)
 261     EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX)
 262   endif
 263   ifeq ($(COPY_DEBUG_SYMBOLS),true)
 264     ifeq ($(ZIP_DEBUGINFO_FILES),1)
 265       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz
 266       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.diz
 267       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.diz
 268       ifeq ($(ARCH_DATA_MODEL),32)
 269         EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.diz
 270         EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.diz
 271       endif
 272     else
 273       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo
 274       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.debuginfo
 275       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.debuginfo
 276       ifeq ($(ARCH_DATA_MODEL),32)
 277         EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.debuginfo
 278         EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.debuginfo
 279       endif
 280     endif
 281   endif
 282 endif