Merge "Do not update previous_XXX.mk when there is no change"
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index 938242c..c2386a4 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -105,11 +105,10 @@
_crs_new_cmd :=
steps :=
endif
-CURRENT_CLEAN_BUILD_VERSION :=
-CURRENT_CLEAN_STEPS :=
# Write the new state to the file.
#
+ifneq ($(CURRENT_CLEAN_BUILD_VERSION)-$(CURRENT_CLEAN_STEPS),$(INTERNAL_CLEAN_BUILD_VERSION)-$(INTERNAL_CLEAN_STEPS))
$(shell \
mkdir -p $(dir $(clean_steps_file)) && \
echo "CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)" > \
@@ -117,7 +116,10 @@
echo "CURRENT_CLEAN_STEPS := $(INTERNAL_CLEAN_STEPS)" >> \
$(clean_steps_file) \
)
+endif
+CURRENT_CLEAN_BUILD_VERSION :=
+CURRENT_CLEAN_STEPS :=
clean_steps_file :=
INTERNAL_CLEAN_STEPS :=
INTERNAL_CLEAN_BUILD_VERSION :=
@@ -164,7 +166,6 @@
endif
endif
endif # else, this is the first build, so no need to clean.
-PREVIOUS_BUILD_CONFIG :=
ifdef PREVIOUS_SANITIZE_TARGET
ifneq "$(current_sanitize_target)" "$(PREVIOUS_SANITIZE_TARGET)"
@@ -172,10 +173,10 @@
force_objclean := true
endif
endif # else, this is the first build, so no need to clean.
-PREVIOUS_SANITIZE_TARGET :=
# Write the new state to the file.
#
+ifneq ($(PREVIOUS_BUILD_CONFIG)-$(PREVIOUS_SANITIZE_TARGET),$(current_build_config)-$(current_sanitize_target))
$(shell \
mkdir -p $(dir $(previous_build_config_file)) && \
echo "PREVIOUS_BUILD_CONFIG := $(current_build_config)" > \
@@ -183,6 +184,9 @@
echo "PREVIOUS_SANITIZE_TARGET := $(current_sanitize_target)" >> \
$(previous_build_config_file) \
)
+endif
+PREVIOUS_BUILD_CONFIG :=
+PREVIOUS_SANITIZE_TARGET :=
previous_build_config_file :=
current_build_config :=
@@ -305,10 +309,12 @@
endif # else, this is the first build, so no need to clean.
# Write the new state to the file.
+ifneq ($(PREVIOUS_PREBUILT_TOOLS),$(current_prebuilt_tools))
$(shell \
mkdir -p $(dir $(previous_prebuilt_tools_config_file)) && \
echo "PREVIOUS_PREBUILT_TOOLS:=$(current_prebuilt_tools)" > \
$(previous_prebuilt_tools_config_file))
+endif
ifeq ($(force_tools_clean),true)
# For this list of prebuilt tools, see prebuilts/sdk/tools/Android.mk.
diff --git a/core/post_clean.mk b/core/post_clean.mk
index 0273ff2..7fafe4a 100644
--- a/core/post_clean.mk
+++ b/core/post_clean.mk
@@ -88,7 +88,7 @@
$(shell echo 'MODULES_WITH_AIDL_FILES := $(MODULES_WITH_AIDL_FILES)' >> $(current_aidl_config))
# Now current becomes previous.
-$(shell mv -f $(current_aidl_config) $(previous_aidl_config))
+$(shell cmp $(current_aidl_config) $(previous_aidl_config) > /dev/null 2>&1 || mv -f $(current_aidl_config) $(previous_aidl_config))
MODULES_WITH_AIDL_FILES :=
modules_with_aidl_files :=