make/linux/makefiles/defs.make

changeset 3726
74c359c4a9e5
parent 3649
3d7ea1dbe0de
parent 3725
744728c16316
child 4028
a9fed06c01d2
     1.1 --- a/make/linux/makefiles/defs.make	Mon Apr 23 11:03:30 2012 -0700
     1.2 +++ b/make/linux/makefiles/defs.make	Tue Apr 24 15:20:40 2012 -0700
     1.3 @@ -141,32 +141,70 @@
     1.4  endif
     1.5  
     1.6  ifeq ($(JDK6_OR_EARLIER),0)
     1.7 -  # Full Debug Symbols is supported on JDK7 or newer
     1.8 +  # Full Debug Symbols is supported on JDK7 or newer.
     1.9 +  # The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product
    1.10 +  # builds is enabled with debug info files ZIP'ed to save space. For
    1.11 +  # BUILD_FLAVOR != product builds, FDS is always enabled, after all a
    1.12 +  # debug build without debug info isn't very useful.
    1.13 +  # The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled.
    1.14 +  #
    1.15 +  # If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be
    1.16 +  # disabled for a BUILD_FLAVOR == product build.
    1.17 +  #
    1.18 +  # Note: Use of a different variable name for the FDS override option
    1.19 +  # versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS
    1.20 +  # versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass
    1.21 +  # in options via environment variables, use of distinct variables
    1.22 +  # prevents strange behaviours. For example, in a BUILD_FLAVOR !=
    1.23 +  # product build, the FULL_DEBUG_SYMBOLS environment variable will be
    1.24 +  # 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If
    1.25 +  # the same variable name is used, then different values can be picked
    1.26 +  # up by different parts of the build. Just to be clear, we only need
    1.27 +  # two variable names because the incoming option value can be
    1.28 +  # overridden in some situations, e.g., a BUILD_FLAVOR != product
    1.29 +  # build.
    1.30  
    1.31 -  # Default OBJCOPY comes from GNU Binutils on Linux:
    1.32 -  DEF_OBJCOPY=/usr/bin/objcopy
    1.33 -  ifdef CROSS_COMPILE_ARCH
    1.34 -    # don't try to generate .debuginfo files when cross compiling
    1.35 -    _JUNK_ := $(shell \
    1.36 -      echo >&2 "INFO: cross compiling for ARCH $(CROSS_COMPILE_ARCH)," \
    1.37 -        "skipping .debuginfo generation.")
    1.38 +  ifeq ($(BUILD_FLAVOR), product)
    1.39 +    FULL_DEBUG_SYMBOLS ?= 1
    1.40 +    ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
    1.41 +  else
    1.42 +    # debug variants always get Full Debug Symbols (if available)
    1.43 +    ENABLE_FULL_DEBUG_SYMBOLS = 1
    1.44 +  endif
    1.45 +  _JUNK_ := $(shell \
    1.46 +    echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
    1.47 +  # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
    1.48 +
    1.49 +  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    1.50 +    # Default OBJCOPY comes from GNU Binutils on Linux:
    1.51 +    DEF_OBJCOPY=/usr/bin/objcopy
    1.52 +    ifdef CROSS_COMPILE_ARCH
    1.53 +      # don't try to generate .debuginfo files when cross compiling
    1.54 +      _JUNK_ := $(shell \
    1.55 +        echo >&2 "INFO: cross compiling for ARCH $(CROSS_COMPILE_ARCH)," \
    1.56 +          "skipping .debuginfo generation.")
    1.57 +      OBJCOPY=
    1.58 +    else
    1.59 +      OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
    1.60 +      ifneq ($(ALT_OBJCOPY),)
    1.61 +        _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
    1.62 +        OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
    1.63 +      endif
    1.64 +    endif
    1.65 +  else
    1.66      OBJCOPY=
    1.67 -  else
    1.68 -    OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
    1.69 -    ifneq ($(ALT_OBJCOPY),)
    1.70 -      _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
    1.71 -      # disable .debuginfo support by setting ALT_OBJCOPY to a non-existent path
    1.72 -      OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
    1.73 -    endif
    1.74    endif
    1.75 -  
    1.76 +
    1.77    ifeq ($(OBJCOPY),)
    1.78      _JUNK_ := $(shell \
    1.79        echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.")
    1.80 +    ENABLE_FULL_DEBUG_SYMBOLS=0
    1.81 +    _JUNK_ := $(shell \
    1.82 +      echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
    1.83    else
    1.84      _JUNK_ := $(shell \
    1.85        echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.")
    1.86 -  
    1.87 +
    1.88      # Library stripping policies for .debuginfo configs:
    1.89      #   all_strip - strips everything from the library
    1.90      #   min_strip - strips most stuff from the library; leaves minimum symbols
    1.91 @@ -175,15 +213,17 @@
    1.92      # Oracle security policy requires "all_strip". A waiver was granted on
    1.93      # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE.
    1.94      #
    1.95 -    DEF_STRIP_POLICY="min_strip"
    1.96 -    ifeq ($(ALT_STRIP_POLICY),)
    1.97 -      STRIP_POLICY=$(DEF_STRIP_POLICY)
    1.98 -    else
    1.99 -      STRIP_POLICY=$(ALT_STRIP_POLICY)
   1.100 -    endif
   1.101 -  
   1.102 +    # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled.
   1.103 +    #
   1.104 +    STRIP_POLICY ?= min_strip
   1.105 +
   1.106      _JUNK_ := $(shell \
   1.107        echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
   1.108 +
   1.109 +    ZIP_DEBUGINFO_FILES ?= 1
   1.110 +
   1.111 +    _JUNK_ := $(shell \
   1.112 +      echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
   1.113    endif
   1.114  endif
   1.115  
   1.116 @@ -199,8 +239,12 @@
   1.117  
   1.118  # client and server subdirectories have symbolic links to ../libjsig.so
   1.119  EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
   1.120 -ifneq ($(OBJCOPY),)
   1.121 -  EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo
   1.122 +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   1.123 +  ifeq ($(ZIP_DEBUGINFO_FILES),1)
   1.124 +    EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.diz
   1.125 +  else
   1.126 +    EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo
   1.127 +  endif
   1.128  endif
   1.129  EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
   1.130  EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
   1.131 @@ -210,16 +254,24 @@
   1.132  ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
   1.133    EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
   1.134    EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
   1.135 -  ifneq ($(OBJCOPY),)
   1.136 -    EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo
   1.137 +  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   1.138 +    ifeq ($(ZIP_DEBUGINFO_FILES),1)
   1.139 +      EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz
   1.140 +    else
   1.141 +      EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo
   1.142 +    endif
   1.143    endif
   1.144  endif
   1.145  
   1.146  ifeq ($(JVM_VARIANT_CLIENT),true)
   1.147    EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
   1.148    EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
   1.149 -  ifneq ($(OBJCOPY),)
   1.150 -    EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo
   1.151 +  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   1.152 +    ifeq ($(ZIP_DEBUGINFO_FILES),1)
   1.153 +      EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz
   1.154 +    else
   1.155 +      EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo
   1.156 +    endif
   1.157    endif 
   1.158  endif
   1.159  
   1.160 @@ -229,9 +281,14 @@
   1.161                          $(EXPORT_LIB_DIR)/sa-jdi.jar 
   1.162  ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
   1.163                          $(EXPORT_LIB_DIR)/sa-jdi.jar 
   1.164 -ifneq ($(OBJCOPY),)
   1.165 -  ADD_SA_BINARIES/x86   += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
   1.166 -  ADD_SA_BINARIES/sparc += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
   1.167 +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   1.168 +  ifeq ($(ZIP_DEBUGINFO_FILES),1)
   1.169 +    ADD_SA_BINARIES/x86   += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz
   1.170 +    ADD_SA_BINARIES/sparc += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz
   1.171 +  else
   1.172 +    ADD_SA_BINARIES/x86   += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
   1.173 +    ADD_SA_BINARIES/sparc += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
   1.174 +  endif
   1.175  endif
   1.176  ADD_SA_BINARIES/ppc   = 
   1.177  ADD_SA_BINARIES/ia64  = 

mercurial