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/Makefile b/core/Makefile
index 83e7e7c..cf22b11 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -385,6 +385,10 @@
$(call pretty,"Target ram disk: $@")
$(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
+.PHONY: ramdisk-nodeps
+ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
+ @echo "make $@: ignoring dependencies"
+ $(hide) $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
@@ -422,12 +426,24 @@
$(call pretty,"Target boot image: $@")
$(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
+.PHONY: bootimage-nodeps
+bootimage-nodeps: $(MKEXT2IMG)
+ @echo "make $@: ignoring dependencies"
+ $(hide) $(MKEXT2BOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
+
else # TARGET_BOOTIMAGE_USE_EXT2 != true
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
$(call pretty,"Target boot image: $@")
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
$(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
+
+.PHONY: bootimage-nodeps
+bootimage-nodeps: $(MKBOOTIMG)
+ @echo "make $@: ignoring dependencies"
+ $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
+ $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
+
endif # TARGET_BOOTIMAGE_USE_EXT2
else # TARGET_NO_KERNEL
@@ -1593,16 +1609,18 @@
$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
@echo ConvertXmlToText: $@
$(hide) prebuilt/common/findbugs/bin/convertXmlToText -html:fancy.xsl \
- $(INTERNAL_FINDBUGS_XML_TARGET) > $@
+ $(INTERNAL_FINDBUGS_XML_TARGET) > $@
# -----------------------------------------------------------------
# Findbugs
# -----------------------------------------------------------------
# These are some additional build tasks that need to be run.
+ifneq ($(dont_bother),true)
include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
-include $(sort $(wildcard device/*/build/tasks/*.mk))
+endif
# -----------------------------------------------------------------
# Create SDK repository packages. Must be done after tasks/* since
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index f32d0d1..fa67332 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -14,7 +14,7 @@
#
# Don't bother with the cleanspecs if you are running mm/mmm
-ifndef ONE_SHOT_MAKEFILE
+ifeq ($(ONE_SHOT_MAKEFILE)$(dont_bother),)
INTERNAL_CLEAN_STEPS :=
@@ -100,7 +100,7 @@
INTERNAL_CLEAN_STEPS :=
INTERNAL_CLEAN_BUILD_VERSION :=
-endif # ifndef ONE_SHOT_MAKEFILE
+endif # if not ONE_SHOT_MAKEFILE dont_bother
# Since products and build variants (unfortunately) share the same
# PRODUCT_OUT staging directory, things can get out of sync if different
diff --git a/core/config.mk b/core/config.mk
index 8be539c..96993c0 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -159,6 +159,26 @@
TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
board_config_mk :=
+# Perhaps we should move this block to build/core/Makefile,
+# once we don't have TARGET_NO_KERNEL reference in AndroidBoard.mk/Android.mk.
+ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
+ INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
+ ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
+ INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
+ else
+ INSTALLED_2NDBOOTLOADER_TARGET :=
+ endif
+else
+ INSTALLED_BOOTLOADER_MODULE :=
+ INSTALLED_2NDBOOTLOADER_TARGET :=
+endif # TARGET_NO_BOOTLOADER
+ifneq ($(strip $(TARGET_NO_KERNEL)),true)
+ INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
+else
+ INSTALLED_KERNEL_TARGET :=
+endif
+
+
# The build system exposes several variables for where to find the kernel
# headers:
# TARGET_DEVICE_KERNEL_HEADERS is automatically created for the current
diff --git a/core/help.mk b/core/help.mk
index 9e37f82..6e0b2c0 100644
--- a/core/help.mk
+++ b/core/help.mk
@@ -14,13 +14,6 @@
# limitations under the License.
#
-ifeq ($(MAKECMDGOALS),help)
-dont_bother := true
-endif
-ifeq ($(MAKECMDGOALS),out)
-dont_bother := true
-endif
-
.PHONY: help
help:
@echo
@@ -39,4 +32,3 @@
.PHONY: out
out:
@echo "I'm sure you're nice and all, but no thanks."
-
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.