jdk/make/common/Defs-windows.gmk
changeset 12309 49cad5b7b263
parent 12288 30d13a7dd03f
parent 12307 b34445ac110f
child 12445 9df4dd548612
--- a/jdk/make/common/Defs-windows.gmk	Wed Apr 04 12:35:44 2012 -0700
+++ b/jdk/make/common/Defs-windows.gmk	Wed Apr 04 13:16:52 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -80,6 +80,47 @@
 
 EXTRA_LFLAGS += /LIBPATH:$(DXSDK_LIB_PATH)
 
+# Full Debug Symbols has been enabled on Windows since JDK1.4.1.
+# The Full Debug Symbols (FDS) default for VARIANT == OPT builds is
+# enabled with debug info files ZIP'ed to save space. For VARIANT !=
+# OPT 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 VARIANT == OPT 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 VARIANT != OPT 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 VARIANT != OPT build.
+
+ifeq ($(VARIANT), OPT)
+  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)")
+
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+  # HACK: disable ZIP_DEBUGINFO_FILES by default until install repo
+  # changes are promoted
+  ZIP_DEBUGINFO_FILES ?= 0
+else
+  ZIP_DEBUGINFO_FILES=0
+endif
+_JUNK_ := $(shell echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
+
 # C Compiler flag definitions
 
 #
@@ -206,7 +247,10 @@
   #   /D _STATIC_CPPLIB
   #            Use static link for the C++ runtime (so msvcpnn.dll not needed)
   #   
-  CFLAGS_COMMON  += -Zi -nologo
+  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+    CFLAGS_COMMON  += -Zi
+  endif
+  CFLAGS_COMMON  += -nologo
   CFLAGS_OPT      = $(CC_OPT)
   CFLAGS_DBG      = -Od $(MS_RUNTIME_DEBUG_OPTION)
 
@@ -215,7 +259,9 @@
   # All builds get the same runtime setting
   CFLAGS_COMMON += $(MS_RUNTIME_OPTION) $(CFLAGS_$(COMPILER_VERSION))
 
-  LDEBUG = /debug
+  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+    LDEBUG = /debug
+  endif
   
   ifeq ($(VTUNE_SUPPORT), true)
     OTHER_CFLAGS = -Z7 -Ox 
@@ -249,7 +295,9 @@
 #
 # Output options (use specific filenames to avoid parallel compile errors)
 #
-CFLAGS_COMMON += -Fd$(OBJDIR)/$(basename $(@F)).pdb -Fm$(OBJDIR)/$(basename $(@F)).map
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+  CFLAGS_COMMON += -Fd$(OBJDIR)/$(basename $(@F)).pdb -Fm$(OBJDIR)/$(basename $(@F)).map
+endif
 
 #
 # Use -wdNNNN to disable warning NNNN.
@@ -310,6 +358,7 @@
 SALIB_NAME = $(LIB_PREFIX)sawindbg.$(LIBRARY_SUFFIX)
 SAMAP_NAME = $(LIB_PREFIX)sawindbg.map
 SAPDB_NAME = $(LIB_PREFIX)sawindbg.pdb
+SA_DIZ_NAME = $(LIB_PREFIX)sawindbg.diz
 
 ifeq ($(ARCH), ia64)
   # SA will never be supported here.