Merge "Use a dependency file to replace the list file."

This commit is contained in:
Ying Wang
2012-06-11 15:32:52 -07:00
committed by android code review
+14 -10
View File
@@ -50,18 +50,19 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
inc := $(call intermediates-dir-for,PACKAGING,updater_extensions)/register.inc inc := $(call intermediates-dir-for,PACKAGING,updater_extensions)/register.inc
# During the first pass of reading the makefiles, we dump the list of # Encode the value of TARGET_RECOVERY_UPDATER_LIBS into the filename of the dependency.
# extension libs to a temp file, then copy that to the ".list" file if # So if TARGET_RECOVERY_UPDATER_LIBS is changed, a new dependency file will be generated.
# it is different than the existing .list (if any). The register.inc # Note that we have to remove any existing depency files before creating new one,
# file then uses the .list as a prerequisite, so it is only rebuilt # so no obsolete dependecy file gets used if you switch back to an old value.
# (and updater.o recompiled) when the list of extension libs changes. inc_dep_file := $(inc).dep.$(subst $(space),-,$(sort $(TARGET_RECOVERY_UPDATER_LIBS)))
$(inc_dep_file): stem := $(inc).dep
junk := $(shell mkdir -p $(dir $(inc));\ $(inc_dep_file) :
echo $(TARGET_RECOVERY_UPDATER_LIBS) > $(inc).temp;\ $(hide) mkdir -p $(dir $@)
diff -q $(inc).temp $(inc).list 2>/dev/null || cp -f $(inc).temp $(inc).list) $(hide) rm -f $(stem).*
$(hide) touch $@
$(inc) : libs := $(TARGET_RECOVERY_UPDATER_LIBS) $(inc) : libs := $(TARGET_RECOVERY_UPDATER_LIBS)
$(inc) : $(inc).list $(inc) : $(inc_dep_file)
$(hide) mkdir -p $(dir $@) $(hide) mkdir -p $(dir $@)
$(hide) echo "" > $@ $(hide) echo "" > $@
$(hide) $(foreach lib,$(libs),echo "extern void Register_$(lib)(void);" >> $@;) $(hide) $(foreach lib,$(libs),echo "extern void Register_$(lib)(void);" >> $@;)
@@ -72,6 +73,9 @@ $(inc) : $(inc).list
$(call intermediates-dir-for,EXECUTABLES,updater)/updater.o : $(inc) $(call intermediates-dir-for,EXECUTABLES,updater)/updater.o : $(inc)
LOCAL_C_INCLUDES += $(dir $(inc)) LOCAL_C_INCLUDES += $(dir $(inc))
inc :=
inc_dep_file :=
LOCAL_MODULE := updater LOCAL_MODULE := updater
LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_FORCE_STATIC_EXECUTABLE := true