Do not update previous_XXX.mk when there is no change
I'm adding a rule which regenerates ninja files to kati:
https://github.com/shinh/kati/commit/8666cfba20bf4ff0e59053dcfa7bcac9896bcf16
With this regeneration rule, unnecessary re-generation will happen
when these .mk files are updated even if there are no changes in
their contents. With this patch, these .mk files are updated only
when the contents will be actually changed.
Change-Id: I4c796f9454502f6bb25019b3806ca577ea5258c1
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 :=