previous_aidl_config := $(TARGET_OUT_COMMON_INTERMEDIATES)/previous_aidl_config.mk
current_aidl_config := $(TARGET_OUT_COMMON_INTERMEDIATES)/current_aidl_config.mk
-$(shell rm -rf $(current_aidl_config) && mkdir -p $(dir $(current_aidl_config)))
+$(shell rm -rf $(current_aidl_config) \
+ && mkdir -p $(dir $(current_aidl_config))\
+ && touch $(current_aidl_config))
-include $(previous_aidl_config)
intermediates_to_clean :=
+modules_with_aidl_files :=
$(foreach p, $(ALL_MODULES), \
$(if $(ALL_MODULES.$(p).AIDL_FILES),\
+ $(eval modules_with_aidl_files += $(p))\
$(shell echo 'AIDL_FILES.$(p) := $(ALL_MODULES.$(p).AIDL_FILES)' >> $(current_aidl_config)))\
$(if $(filter-out $(ALL_MODULES.$(p).AIDL_FILES),$(AIDL_FILES.$(p))),\
$(eval intermediates_to_clean += $(ALL_MODULES.$(p).INTERMEDIATE_SOURCE_DIR))))
intermediates_to_clean :=
endif
+# For modules not loaded by the current build (e.g. you are running mm/mmm),
+# we copy the info from the previous bulid.
+$(foreach p, $(filter-out $(modules_with_aidl_files),$(MODULES_WITH_AIDL_FILES)),\
+ $(shell echo 'AIDL_FILES.$(p) := $(AIDL_FILES.$(p))' >> $(current_aidl_config)))
+MODULES_WITH_AIDL_FILES := $(sort $(MODULES_WITH_AIDL_FILES) $(modules_with_aidl_files))
+$(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))
+MODULES_WITH_AIDL_FILES :=
+modules_with_aidl_files :=
previous_aidl_config :=
current_aidl_config :=