summaryrefslogtreecommitdiffstats
path: root/core/dynamic_binary.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2014-08-10 16:19:04 -0700
committerYing Wang <wangying@google.com>2014-08-10 16:19:04 -0700
commitd8c5ca9e0d21bfd60d8d7e189accb7a5ea97258c (patch)
tree5a5fc705a336ee3d02464091da80a95ad2a0311b /core/dynamic_binary.mk
parentcced082f5d8e6386815a5cfba125789e78c5e7ca (diff)
downloadbuild-d8c5ca9e0d21bfd60d8d7e189accb7a5ea97258c.zip
build-d8c5ca9e0d21bfd60d8d7e189accb7a5ea97258c.tar.gz
build-d8c5ca9e0d21bfd60d8d7e189accb7a5ea97258c.tar.bz2
Allow to strip everything for only some build variants.
When LOCAL_STRIP_MODULE is keep_symbols, you can still use STRIP_EVERYTHING_BUILD_VARIANTS in product configuration to strip everything for some build variants, such as user build to save image space. Bug: 16897368 Change-Id: I2a1b7204e5c976387ddea8846c82e11a7b478d8d
Diffstat (limited to 'core/dynamic_binary.mk')
-rw-r--r--core/dynamic_binary.mk9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 396199c..3d6ad4a 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -110,6 +110,15 @@ $(strip_output): PRIVATE_OBJCOPY := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY
$(strip_output): PRIVATE_READELF := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_READELF)
$(strip_output): $(strip_input) | $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
$(transform-to-stripped-keep-symbols)
+
+# A product may be configured to strip everything in some build variants.
+# We do the stripping as a post-install command so that LOCAL_BUILT_MODULE
+# is still with the symbols and we don't need to clean it (and relink) when
+# you switch build variant.
+ifneq ($(filter $(STRIP_EVERYTHING_BUILD_VARIANTS),$(TARGET_BUILD_VARIANT)),)
+$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP) --strip-all $(LOCAL_INSTALLED_MODULE)
+endif
else
# Don't strip the binary, just copy it. We can't skip this step
# because a copy of the binary must appear at LOCAL_BUILT_MODULE.