From 954b5bdcf4c3621c10666a09bbfc3fe1cf785950 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sat, 8 Nov 2014 22:20:03 -0800 Subject: [PATCH] Make modules depend on their makefile. This should obviate much of the need for cleanspecs, and also make it unnecessary to continue adding LOCAL_ADDITIONAL_DEPENDENCIES for this sort of thing all over the tree. Change-Id: I97aa8fd280ae868a5f6364f8b7bf3c2fe235d6ce --- core/base_rules.mk | 7 ++++++- core/binary.mk | 27 ++++++++++++++------------- core/droiddoc.mk | 9 ++++++++- core/host_dalvik_java_library.mk | 10 ++++++++-- core/host_java_library.mk | 10 ++++++++-- core/host_shared_library_internal.mk | 6 +++++- core/java.mk | 13 ++++++++++--- core/phony_package.mk | 2 +- core/prebuilt_internal.mk | 2 +- core/shared_library_internal.mk | 10 +++++++--- 10 files changed, 68 insertions(+), 28 deletions(-) diff --git a/core/base_rules.mk b/core/base_rules.mk index a70936554..acbecc4b3 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -218,7 +218,12 @@ LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS) endif # LOCAL_SDK_VERSION $(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(addprefix -p,$(aidl_preprocess_import)) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES)) -$(aidl_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.aidl $(LOCAL_ADDITIONAL_DEPENDENCIES) $(AIDL) $(aidl_preprocess_import) +$(aidl_java_sources): $(intermediates.COMMON)/src/%.java: \ + $(TOPDIR)$(LOCAL_PATH)/%.aidl \ + $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_ADDITIONAL_DEPENDENCIES) \ + $(AIDL) \ + $(aidl_preprocess_import) $(transform-aidl-to-java) -include $(aidl_java_sources:%.java=%.P) diff --git a/core/binary.mk b/core/binary.mk index 455c64b2b..9f17fd515 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -114,6 +114,7 @@ my_cxx := $(LOCAL_CXX) my_c_includes := $(LOCAL_C_INCLUDES) my_generated_sources := $(LOCAL_GENERATED_SOURCES) my_native_coverage := $(LOCAL_NATIVE_COVERAGE) +my_additional_dependencies := $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES) # MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because # all code is position independent, and then those warnings get promoted to @@ -601,7 +602,7 @@ yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o) ifneq ($(strip $(y_yacc_cpps)),) $(y_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ $(TOPDIR)$(LOCAL_PATH)/%.y \ - $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(lex_cpps) $(my_additional_dependencies) $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION)) $(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION) endif @@ -609,7 +610,7 @@ endif ifneq ($(strip $(yy_yacc_cpps)),) $(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ $(TOPDIR)$(LOCAL_PATH)/%.yy \ - $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(lex_cpps) $(my_additional_dependencies) $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION)) $(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION) endif @@ -653,7 +654,7 @@ $(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) $(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) $(lex_objects): $(intermediates)/%.o: \ $(intermediates)/%$(LOCAL_CPP_EXTENSION) \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) \ + $(my_additional_dependencies) \ $(yacc_headers) $(transform-$(PRIVATE_HOST)cpp-to-o) endif @@ -681,7 +682,7 @@ ifneq ($(strip $(cpp_objects)),) $(cpp_objects): $(intermediates)/%.o: \ $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \ $(yacc_cpps) $(proto_generated_headers) \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(my_additional_dependencies) $(transform-$(PRIVATE_HOST)cpp-to-o) -include $(cpp_objects:%.o=%.P) endif @@ -701,7 +702,7 @@ $(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) $(gen_cpp_objects): $(intermediates)/%.o: \ $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \ $(proto_generated_headers) \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(my_additional_dependencies) $(transform-$(PRIVATE_HOST)cpp-to-o) -include $(gen_cpp_objects:%.o=%.P) endif @@ -715,7 +716,7 @@ gen_S_objects := $(gen_S_sources:%.S=%.o) ifneq ($(strip $(gen_S_sources)),) $(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(my_additional_dependencies) $(transform-$(PRIVATE_HOST)s-to-o) -include $(gen_S_objects:%.o=%.P) endif @@ -725,7 +726,7 @@ gen_s_objects := $(gen_s_sources:%.s=%.o) ifneq ($(strip $(gen_s_objects)),) $(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(my_additional_dependencies) $(transform-$(PRIVATE_HOST)s-to-o-no-deps) -include $(gen_s_objects:%.o=%.P) endif @@ -757,7 +758,7 @@ c_objects := $(c_arm_objects) $(c_normal_objects) ifneq ($(strip $(c_objects)),) $(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(my_additional_dependencies) $(transform-$(PRIVATE_HOST)c-to-o) -include $(c_objects:%.o=%.P) endif @@ -775,7 +776,7 @@ ifneq ($(strip $(gen_c_objects)),) $(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) $(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) $(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(my_additional_dependencies) $(transform-$(PRIVATE_HOST)c-to-o) -include $(gen_c_objects:%.o=%.P) endif @@ -789,7 +790,7 @@ objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o)) ifneq ($(strip $(objc_objects)),) $(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(my_additional_dependencies) $(transform-$(PRIVATE_HOST)m-to-o) -include $(objc_objects:%.o=%.P) endif @@ -803,7 +804,7 @@ asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o)) ifneq ($(strip $(asm_objects_S)),) $(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(my_additional_dependencies) $(transform-$(PRIVATE_HOST)s-to-o) -include $(asm_objects_S:%.o=%.P) endif @@ -813,7 +814,7 @@ asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o)) ifneq ($(strip $(asm_objects_s)),) $(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(my_additional_dependencies) $(transform-$(PRIVATE_HOST)s-to-o-no-deps) -include $(asm_objects_s:%.o=%.P) endif @@ -827,7 +828,7 @@ asm_sources_asm := $(filter %.asm,$(my_src_files)) ifneq ($(strip $(asm_sources_asm)),) asm_objects_asm := $(addprefix $(intermediates)/,$(asm_sources_asm:.asm=.o)) $(asm_objects_asm): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.asm \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) + $(my_additional_dependencies) $(transform-asm-to-o) asm_objects += $(asm_objects_asm) diff --git a/core/droiddoc.mk b/core/droiddoc.mk index d3e61d57c..41f135c65 100644 --- a/core/droiddoc.mk +++ b/core/droiddoc.mk @@ -154,7 +154,14 @@ endif # TODO: not clear if this is used any more $(full_target): PRIVATE_LOCAL_PATH := $(LOCAL_PATH) -$(full_target): $(full_src_files) $(droiddoc_templates) $(droiddoc) $(html_dir_files) $(full_java_lib_deps) $(LOCAL_ADDITIONAL_DEPENDENCIES) +$(full_target): \ + $(full_src_files) \ + $(droiddoc_templates) \ + $(droiddoc) \ + $(html_dir_files) \ + $(full_java_lib_deps) \ + $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_ADDITIONAL_DEPENDENCIES) @echo Docs droiddoc: $(PRIVATE_OUT_DIR) $(hide) mkdir -p $(dir $@) $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \ diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index 61eb3ffa4..6583dd72e 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -69,8 +69,14 @@ $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS := -$(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \ - $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) +$(full_classes_compiled_jar): \ + $(java_sources) \ + $(java_resource_sources) \ + $(full_java_lib_deps) \ + $(jar_manifest_file) \ + $(proto_java_sources_file_stamp) \ + $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_ADDITIONAL_DEPENDENCIES) $(transform-host-java-to-package) # Run jarjar if necessary, otherwise just copy the file. diff --git a/core/host_java_library.mk b/core/host_java_library.mk index 7e0e4372e..b751c5ff3 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -79,6 +79,12 @@ $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS := -$(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \ - $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) +$(full_classes_compiled_jar): \ + $(java_sources) \ + $(java_resource_sources) \ + $(full_java_lib_deps) \ + $(jar_manifest_file) \ + $(proto_java_sources_file_stamp) \ + $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_ADDITIONAL_DEPENDENCIES) $(transform-host-java-to-package) diff --git a/core/host_shared_library_internal.mk b/core/host_shared_library_internal.mk index d9769d384..f1b3311ec 100644 --- a/core/host_shared_library_internal.mk +++ b/core/host_shared_library_internal.mk @@ -40,7 +40,11 @@ OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIAT include $(BUILD_SYSTEM)/binary.mk -$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES) +$(LOCAL_BUILT_MODULE): \ + $(all_objects) \ + $(all_libraries) \ + $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_ADDITIONAL_DEPENDENCIES) $(transform-host-o-to-shared-lib) endif # skip_build_from_source diff --git a/core/java.mk b/core/java.mk index 49375a618..98d5138a8 100644 --- a/core/java.mk +++ b/core/java.mk @@ -349,9 +349,16 @@ $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES) $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES) $(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS) $(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF) -$(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \ - $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) \ - $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) +$(full_classes_compiled_jar): \ + $(java_sources) \ + $(java_resource_sources) \ + $(full_java_lib_deps) \ + $(jar_manifest_file) \ + $(layers_file) \ + $(RenderScript_file_stamp) \ + $(proto_java_sources_file_stamp) \ + $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_ADDITIONAL_DEPENDENCIES) $(transform-java-to-classes.jar) $(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g diff --git a/core/phony_package.mk b/core/phony_package.mk index b5343352f..30e198c65 100644 --- a/core/phony_package.mk +++ b/core/phony_package.mk @@ -7,7 +7,7 @@ LOCAL_MODULE_SUFFIX := -timestamp include $(BUILD_SYSTEM)/base_rules.mk -$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES) +$(LOCAL_BUILT_MODULE): $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(hide) echo "Fake: $@" $(hide) mkdir -p $(dir $@) $(hide) touch $@ diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index 7e1ea4bca..2e0d2ef5c 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -263,6 +263,6 @@ $(common_javalib_jar) : $(common_classes_jar) | $(ACP) $(built_module) : $(common_javalib_jar) endif # TARGET JAVA_LIBRARIES -$(built_module) : $(LOCAL_ADDITIONAL_DEPENDENCIES) +$(built_module) : $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES) my_prebuilt_src_file := diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk index baedb3b8c..1fda7942b 100644 --- a/core/shared_library_internal.mk +++ b/core/shared_library_internal.mk @@ -64,9 +64,13 @@ $(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic) $(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o) $(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o) -$(linked_module): $(all_objects) $(all_libraries) \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) \ - $(my_target_crtbegin_so_o) $(my_target_crtend_so_o) +$(linked_module): \ + $(all_objects) \ + $(all_libraries) \ + $(my_target_crtbegin_so_o) \ + $(my_target_crtend_so_o) \ + $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_ADDITIONAL_DEPENDENCIES) $(transform-o-to-shared-lib) endif # skip_build_from_source