am 0f1ca830: Merge "Rewrite the clean steps for TARGET_2ND_ARCH."
* commit '0f1ca830ce14277f2fe71c066b4e83ee53727f77':
Rewrite the clean steps for TARGET_2ND_ARCH.
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index 46a312a..8731457 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -81,6 +81,28 @@
$(info Clean step: $(INTERNAL_CLEAN_STEP.$(step))) \
$(shell $(INTERNAL_CLEAN_STEP.$(step))) \
)
+
+ # Rewrite the clean step for the second arch.
+ ifdef TARGET_2ND_ARCH
+ # $(1): the clean step cmd
+ # $(2): the prefix to search for
+ # $(3): the prefix to replace with
+ define -cs-rewrite-cleanstep
+ $(if $(filter $(2)/%,$(1)),\
+ $(eval _crs_new_cmd := $(patsubst $(2)/%,$(3)/%,$(1)))\
+ $(info Clean step: $(_crs_new_cmd))\
+ $(shell $(_crs_new_cmd)))
+ endef
+ $(foreach step,$(steps), \
+ $(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$(TARGET_OUT_INTERMEDIATES),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES))\
+ $(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$(TARGET_OUT_SHARED_LIBRARIES),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES))\
+ $(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$(TARGET_OUT_VENDOR_SHARED_LIBRARIES),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES))\
+ $(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES),$(TARGET_OUT_INTERMEDIATES))\
+ $(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES),$(TARGET_OUT_SHARED_LIBRARIES))\
+ $(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES),$(TARGET_OUT_VENDOR_SHARED_LIBRARIES))\
+ )
+ endif
+ _crs_new_cmd :=
steps :=
endif
CURRENT_CLEAN_BUILD_VERSION :=