Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8c5ca9e authored by Ying Wang's avatar Ying Wang
Browse files

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
parent cced082f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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.