From a4447e8c89ca193ffdb4678de78998f9857ae7c7 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 28 Sep 2015 16:26:00 -0700 Subject: [PATCH] Don't add dependencies on Makefiles when using ninja Ninja has an implicit dependency on the command being run, and kati will regenerate the ninja manifest if any read makefile changes, so there is no need to have dependencies on makefiles. This won't catch all the cases where LOCAL_ADDITIONAL_DEPENDENCIES contains a .mk file, because a few users of LOCAL_ADDITIONAL_DEPENDENCIES don't include base_rules.mk, but it will fix the most common ones. Bug: 23566977 Change-Id: I66de882421376303ab7233c8ce7274548f6b2199 --- core/base_rules.mk | 10 ++++++++++ core/binary.mk | 6 +++--- core/definitions.mk | 1 + core/droiddoc.mk | 2 +- core/executable_prefer_symlink.mk | 2 +- core/host_dalvik_java_library.mk | 6 +++--- core/host_dalvik_static_java_library.mk | 2 +- core/host_java_library.mk | 2 +- core/host_shared_library_internal.mk | 2 +- core/java.mk | 6 +++--- core/phony_package.mk | 2 +- core/prebuilt_internal.mk | 6 +++--- core/shared_library_internal.mk | 2 +- 13 files changed, 30 insertions(+), 19 deletions(-) diff --git a/core/base_rules.mk b/core/base_rules.mk index 21b59a3b7e..a0a3582a34 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -56,6 +56,16 @@ ifeq ($(my_host_cross),true) my_module_tags := endif +ifdef BUILDING_WITH_NINJA +# Ninja has an implicit dependency on the command being run, and kati will +# regenerate the ninja manifest if any read makefile changes, so there is no +# need to have dependencies on makefiles. +# This won't catch all the cases where LOCAL_ADDITIONAL_DEPENDENCIES contains +# a .mk file, because a few users of LOCAL_ADDITIONAL_DEPENDENCIES don't include +# base_rules.mk, but it will fix the most common ones. +LOCAL_ADDITIONAL_DEPENDENCIES := $(filter-out %.mk,$(LOCAL_ADDITIONAL_DEPENDENCIES)) +endif + ########################################################### ## Validate and define fallbacks for input LOCAL_* variables. ########################################################### diff --git a/core/binary.mk b/core/binary.mk index 403cff5c77..96e1c8d266 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -52,7 +52,7 @@ my_cxx_wrapper := $(CXX_WRAPPER) 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) +my_additional_dependencies := $(LOCAL_MODULE_MAKEFILE_DEP) $(LOCAL_ADDITIONAL_DEPENDENCIES) my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS) ifdef LOCAL_IS_HOST_MODULE @@ -1029,7 +1029,7 @@ import_includes_deps := $(strip \ $(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes)) $(import_includes): PRIVATE_IMPORT_EXPORT_INCLUDES := $(import_includes_deps) -$(import_includes) : $(LOCAL_MODULE_MAKEFILE) $(import_includes_deps) +$(import_includes) : $(LOCAL_MODULE_MAKEFILE_DEP) $(import_includes_deps) @echo Import includes file: $@ $(hide) mkdir -p $(dir $@) && rm -f $@ ifdef import_includes_deps @@ -1237,7 +1237,7 @@ $(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets) export_includes := $(intermediates)/export_includes $(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(my_export_c_include_dirs) # Make sure .pb.h are already generated before any dependent source files get compiled. -$(export_includes) : $(LOCAL_MODULE_MAKEFILE) $(proto_generated_headers) $(dbus_generated_headers) +$(export_includes) : $(LOCAL_MODULE_MAKEFILE_DEP) $(proto_generated_headers) $(dbus_generated_headers) @echo Export includes file: $< -- $@ $(hide) mkdir -p $(dir $@) && rm -f $@ ifdef my_export_c_include_dirs diff --git a/core/definitions.mk b/core/definitions.mk index ec1cfdebb8..5a8fc8d892 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -132,6 +132,7 @@ endef define my-dir $(strip \ $(eval LOCAL_MODULE_MAKEFILE := $$(lastword $$(MAKEFILE_LIST))) \ + $(eval LOCAL_MODULE_MAKEFILE_DEP := $(if $(BUILDING_WITH_NINJA),,$$(LOCAL_MODULE_MAKEFILE))) \ $(if $(filter $(BUILD_SYSTEM)/% $(OUT_DIR)/%,$(LOCAL_MODULE_MAKEFILE)), \ $(error my-dir must be called before including any other makefile.) \ , \ diff --git a/core/droiddoc.mk b/core/droiddoc.mk index 893461aead..ab2254fb93 100644 --- a/core/droiddoc.mk +++ b/core/droiddoc.mk @@ -161,7 +161,7 @@ $(full_target): \ $(droiddoc) \ $(html_dir_files) \ $(full_java_lib_deps) \ - $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_MODULE_MAKEFILE_DEP) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) @echo Docs droiddoc: $(PRIVATE_OUT_DIR) $(hide) mkdir -p $(dir $@) diff --git a/core/executable_prefer_symlink.mk b/core/executable_prefer_symlink.mk index 2326e83a0d..888db88776 100644 --- a/core/executable_prefer_symlink.mk +++ b/core/executable_prefer_symlink.mk @@ -39,7 +39,7 @@ $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32) endif endif -$(my_symlink): $(LOCAL_INSTALLED_MODULE) $(LOCAL_MODULE_MAKEFILE) +$(my_symlink): $(LOCAL_INSTALLED_MODULE) $(LOCAL_MODULE_MAKEFILE_DEP) @echo "Symlink: $@ -> $(PRIVATE_SRC_BINARY_NAME)" @mkdir -p $(dir $@) @rm -rf $@ diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index aa700e1898..37355b5a19 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -75,7 +75,7 @@ $(full_classes_compiled_jar): \ $(full_java_lib_deps) \ $(jar_manifest_file) \ $(proto_java_sources_file_stamp) \ - $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_MODULE_MAKEFILE_DEP) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(transform-host-java-to-package) @@ -124,8 +124,8 @@ endif $(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack) $(built_dex): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS) $(built_dex): $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \ - $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_MODULE_MAKEFILE) \ - $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK_JAR) $(JACK_LAUNCHER_JAR) + $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_MODULE_MAKEFILE_DEP) \ + $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK_JAR) $(JACK_LAUNCHER_JAR) @echo Building with Jack: $@ $(jack-java-to-dex) diff --git a/core/host_dalvik_static_java_library.mk b/core/host_dalvik_static_java_library.mk index c6ba915a8c..8255e5ea1c 100644 --- a/core/host_dalvik_static_java_library.mk +++ b/core/host_dalvik_static_java_library.mk @@ -46,7 +46,7 @@ $(full_classes_jack): \ PRIVATE_JACK_INCREMENTAL_DIR := endif $(full_classes_jack): $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \ - $(jar_manifest_file) $(layers_file) $(LOCAL_MODULE_MAKEFILE) \ + $(jar_manifest_file) $(layers_file) $(LOCAL_MODULE_MAKEFILE_DEP) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \ $(JACK_JAR) $(JACK_LAUNCHER_JAR) @echo Building with Jack: $@ diff --git a/core/host_java_library.mk b/core/host_java_library.mk index 0a1119ff67..052c571b10 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -88,6 +88,6 @@ $(full_classes_compiled_jar): \ $(full_java_lib_deps) \ $(jar_manifest_file) \ $(proto_java_sources_file_stamp) \ - $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_MODULE_MAKEFILE_DEP) \ $(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 740c9414cb..272e76f439 100644 --- a/core/host_shared_library_internal.mk +++ b/core/host_shared_library_internal.mk @@ -44,7 +44,7 @@ $(LOCAL_BUILD_MODULE): PRIVATE_HOST_LIBPROFILE_RT := $(my_host_libprofile_rt) $(LOCAL_BUILT_MODULE): \ $(all_objects) \ $(all_libraries) \ - $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_MODULE_MAKEFILE_DEP) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(transform-host-o-to-shared-lib) diff --git a/core/java.mk b/core/java.mk index 66825d1926..ad406d0393 100644 --- a/core/java.mk +++ b/core/java.mk @@ -292,7 +292,7 @@ $(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(addprefix -p,$(aidl_preprocess_ $(aidl_java_sources): $(intermediates.COMMON)/src/%.java: \ $(LOCAL_PATH)/%.aidl \ - $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_MODULE_MAKEFILE_DEP) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) \ $(AIDL) \ $(aidl_preprocess_import) @@ -400,7 +400,7 @@ $(full_classes_compiled_jar): \ $(layers_file) \ $(RenderScript_file_stamp) \ $(proto_java_sources_file_stamp) \ - $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_MODULE_MAKEFILE_DEP) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(transform-java-to-classes.jar) @@ -615,7 +615,7 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \ $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) $(proguard_flag_files) \ $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \ - $(LOCAL_MODULE_MAKEFILE) $(JACK_JAR) $(JACK_LAUNCHER_JAR) + $(LOCAL_MODULE_MAKEFILE_DEP) $(JACK_JAR) $(JACK_LAUNCHER_JAR) ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true) $(full_classes_jack): $(jack_all_deps) diff --git a/core/phony_package.mk b/core/phony_package.mk index 30e198c65e..866b13c8e3 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_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES) +$(LOCAL_BUILT_MODULE): $(LOCAL_MODULE_MAKEFILE_DEP) $(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 d36782892d..2388ab91a1 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -88,7 +88,7 @@ else # LOCAL_STRIP_MODULE and LOCAL_PACK_MODULE_RELOCATIONS not true ifdef prebuilt_module_is_a_library export_includes := $(intermediates)/export_includes $(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS) -$(export_includes) : $(LOCAL_MODULE_MAKEFILE) +$(export_includes) : $(LOCAL_MODULE_MAKEFILE_DEP) @echo Export includes file: $< -- $@ $(hide) mkdir -p $(dir $@) && rm -f $@ ifdef LOCAL_EXPORT_C_INCLUDE_DIRS @@ -304,12 +304,12 @@ endif # TARGET JAVA_LIBRARIES ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) $(intermediates.COMMON)/classes.jack : PRIVATE_JILL_FLAGS:=$(LOCAL_JILL_FLAGS) -$(intermediates.COMMON)/classes.jack : $(my_prebuilt_src_file) $(LOCAL_MODULE_MAKEFILE) \ +$(intermediates.COMMON)/classes.jack : $(my_prebuilt_src_file) $(LOCAL_MODULE_MAKEFILE_DEP) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JILL_JAR) $(JACK_JAR) $(JACK_LAUNCHER_JAR) $(transform-jar-to-jack) endif # JAVA_LIBRARIES -$(built_module) : $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES) +$(built_module) : $(LOCAL_MODULE_MAKEFILE_DEP) $(LOCAL_ADDITIONAL_DEPENDENCIES) my_prebuilt_src_file := diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk index 1507502613..075bd02aad 100644 --- a/core/shared_library_internal.mk +++ b/core/shared_library_internal.mk @@ -80,7 +80,7 @@ $(linked_module): \ $(all_libraries) \ $(my_target_crtbegin_so_o) \ $(my_target_crtend_so_o) \ - $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_MODULE_MAKEFILE_DEP) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(transform-o-to-shared-lib)