--- a/make/common/NativeCompilation.gmk Tue Oct 29 14:22:18 2019 -0400
+++ b/make/common/NativeCompilation.gmk Tue Oct 29 12:01:14 2019 -0700
@@ -453,6 +453,28 @@
endif
endif
+ $$(call SetIfEmpty, $1_COMPILE_WITH_DEBUG_SYMBOLS, $$(COMPILE_WITH_DEBUG_SYMBOLS))
+
+ # STATIC_LIBS is set from Main.gmk when building static versions of certain
+ # native libraries.
+ ifeq ($(STATIC_LIBS), true)
+ $1_TYPE := STATIC_LIBRARY
+ # The static versions need to be redirected to different output dirs, both
+ # to not interfere with the main build as well as to not end up inside the
+ # jmods.
+ $1_OBJECT_DIR := $$($1_OBJECT_DIR)/static
+ $1_OUTPUT_DIR := $$($1_OBJECT_DIR)
+ # For release builds where debug symbols are configured to be moved to
+ # separate debuginfo files, disable debug symbols for static libs instead.
+ # We don't currently support this configuration and we don't want symbol
+ # information in release builds unless explicitly asked to provide it.
+ ifeq ($(DEBUG_LEVEL), release)
+ ifeq ($(COPY_DEBUG_SYMBOLS), true)
+ $1_COMPILE_WITH_DEBUG_SYMBOLS := false
+ endif
+ endif
+ endif
+
ifeq ($$($1_TYPE), EXECUTABLE)
$1_PREFIX :=
ifeq ($$($1_SUFFIX), )
@@ -592,6 +614,9 @@
$1_EXTRA_CFLAGS += $$($1_CFLAGS_$(OPENJDK_TARGET_OS)_release)
$1_EXTRA_CFLAGS += $$($1_CFLAGS_$(OPENJDK_TARGET_OS)_$(OPENJDK_TARGET_CPU)_release)
endif
+ ifeq ($(STATIC_LIBS), true)
+ $1_EXTRA_CFLAGS += $$(STATIC_LIBS_CFLAGS)
+ endif
# Pickup extra OPENJDK_TARGET_OS_TYPE and/or OPENJDK_TARGET_OS dependent variables for CXXFLAGS.
$1_EXTRA_CXXFLAGS := $$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_CXXFLAGS_$(OPENJDK_TARGET_OS))
@@ -605,6 +630,9 @@
$1_EXTRA_CXXFLAGS += $$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_TYPE)_release)
$1_EXTRA_CXXFLAGS += $$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_release)
endif
+ ifeq ($(STATIC_LIBS), true)
+ $1_EXTRA_CXXFLAGS += $$(STATIC_LIB_CFLAGS)
+ endif
# If no C++ flags are explicitly set, default to using the C flags.
# After that, we can set additional C++ flags that should not interfere
@@ -616,7 +644,7 @@
$1_EXTRA_CXXFLAGS := $$($1_EXTRA_CFLAGS)
endif
- ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
+ ifeq ($$($1_COMPILE_WITH_DEBUG_SYMBOLS), true)
$1_EXTRA_CFLAGS += $$(CFLAGS_DEBUG_SYMBOLS)
$1_EXTRA_CXXFLAGS += $$(CFLAGS_DEBUG_SYMBOLS)
$1_EXTRA_ASFLAGS += $$(ASFLAGS_DEBUG_SYMBOLS)