diff make/linux/makefiles/defs.make @ 6021:744728c16316

7158067: FDS: ENABLE_FULL_DEBUG_SYMBOLS flag should only affect product builds Summary: Build option FULL_DEBUG_SYMBOLS=0 only affects product builds. Reviewed-by: ohair, jmelvin, sspitsyn
author dcubed
date Tue, 03 Apr 2012 09:48:34 -0700
parents d652a62d6e03
children 74c359c4a9e5
line wrap: on
line diff
--- a/make/linux/makefiles/defs.make	Fri Mar 23 11:50:33 2012 -0700
+++ b/make/linux/makefiles/defs.make	Tue Apr 03 09:48:34 2012 -0700
@@ -130,9 +130,37 @@
 
 ifeq ($(JDK6_OR_EARLIER),0)
   # Full Debug Symbols is supported on JDK7 or newer.
-  # Default is enabled with .debuginfo files ZIP'ed to save space.
+  # The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product
+  # builds is enabled with debug info files ZIP'ed to save space. For
+  # BUILD_FLAVOR != product builds, FDS is always enabled, after all a
+  # debug build without debug info isn't very useful.
+  # The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled.
+  #
+  # If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be
+  # disabled for a BUILD_FLAVOR == product build.
+  #
+  # Note: Use of a different variable name for the FDS override option
+  # versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS
+  # versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass
+  # in options via environment variables, use of distinct variables
+  # prevents strange behaviours. For example, in a BUILD_FLAVOR !=
+  # product build, the FULL_DEBUG_SYMBOLS environment variable will be
+  # 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If
+  # the same variable name is used, then different values can be picked
+  # up by different parts of the build. Just to be clear, we only need
+  # two variable names because the incoming option value can be
+  # overridden in some situations, e.g., a BUILD_FLAVOR != product
+  # build.
 
-  ENABLE_FULL_DEBUG_SYMBOLS ?= 1
+  ifeq ($(BUILD_FLAVOR), product)
+    FULL_DEBUG_SYMBOLS ?= 1
+    ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
+  else
+    # debug variants always get Full Debug Symbols (if available)
+    ENABLE_FULL_DEBUG_SYMBOLS = 1
+  endif
+  _JUNK_ := $(shell \
+    echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
   # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
 
   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
@@ -159,6 +187,8 @@
     _JUNK_ := $(shell \
       echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.")
     ENABLE_FULL_DEBUG_SYMBOLS=0
+    _JUNK_ := $(shell \
+      echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
   else
     _JUNK_ := $(shell \
       echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.")