Don't bother going through the source tree
Don't bother going through the source tree in more circumstances:
all cleaning goals, helping goals, no-deps goals.
Bug: 10244578
Change-Id: Id53a249085c62838e4193962a85e0ac34f46954f
diff --git a/core/main.mk b/core/main.mk
index 7b6ec2a..7ba9a7f 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -71,6 +71,22 @@
.PHONY: FORCE
FORCE:
+# These goals don't need to collect and include Android.mks/CleanSpec.mks
+# in the source tree.
+dont_bother_goals := clean clobber dataclean installclean \
+ help out \
+ snod systemimage-nodeps \
+ stnod systemtarball-nodeps \
+ userdataimage-nodeps userdatatarball-nodeps \
+ cacheimage-nodeps \
+ vendorimage-nodeps \
+ ramdisk-nodeps \
+ bootimage-nodeps
+
+ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),)
+dont_bother := true
+endif
+
# Targets that provide quick help on the build system.
include $(BUILD_SYSTEM)/help.mk
@@ -84,21 +100,6 @@
# be generated correctly
include $(BUILD_SYSTEM)/cleanbuild.mk
-# These targets are going to delete stuff, don't bother including
-# the whole directory tree if that's all we're going to do
-ifeq ($(MAKECMDGOALS),clean)
-dont_bother := true
-endif
-ifeq ($(MAKECMDGOALS),clobber)
-dont_bother := true
-endif
-ifeq ($(MAKECMDGOALS),dataclean)
-dont_bother := true
-endif
-ifeq ($(MAKECMDGOALS),installclean)
-dont_bother := true
-endif
-
# Include the google-specific config
-include vendor/google/build/config.mk
@@ -675,6 +676,8 @@
$(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_TESTS has nothing to install!)))
endif
+endif # dont_bother
+
# build/core/Makefile contains extra stuff that we don't want to pollute this
# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
# contains everything that's built during the current make, but it also further
@@ -684,8 +687,6 @@
modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
ALL_DEFAULT_INSTALLED_MODULES :=
-endif # dont_bother
-
# These are additional goals that we build, in order to make sure that there
# is as little code as possible in the tree that doesn't build.