From ad7fd29b312bf588b2be3f799715f34ff8a6d46b Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Thu, 8 Aug 2013 16:34:29 -0700 Subject: [PATCH] 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 --- core/Makefile | 20 +++++++++++++++++++- core/cleanbuild.mk | 4 ++-- core/config.mk | 20 ++++++++++++++++++++ core/help.mk | 8 -------- core/main.mk | 35 ++++++++++++++++++----------------- target/board/Android.mk | 18 ------------------ 6 files changed, 59 insertions(+), 46 deletions(-) diff --git a/core/Makefile b/core/Makefile index 83e7e7c03..cf22b113d 100644 --- a/core/Makefile +++ b/core/Makefile @@ -385,6 +385,10 @@ $(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP) $(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 @@ $(INSTALLED_BOOTIMAGE_TARGET): $(MKEXT2IMG) $(INTERNAL_BOOTIMAGE_FILES) $(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_XML_TARGET): $(ALL_FINDBUGS_FILES) $(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 f32d0d1f0..fa673320c 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 @@ clean_steps_file := 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 8be539c70..96993c08e 100644 --- a/core/config.mk +++ b/core/config.mk @@ -159,6 +159,26 @@ endif 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 9e37f82bf..6e0b2c02e 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 @@ help: .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 7b6ec2ab0..7ba9a7f1c 100644 --- a/core/main.mk +++ b/core/main.mk @@ -71,6 +71,22 @@ $(DEFAULT_GOAL): .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 @@ include $(BUILD_SYSTEM)/config.mk # 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 @@ ifdef is_sdk_build $(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 @@ include $(BUILD_SYSTEM)/Makefile 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. diff --git a/target/board/Android.mk b/target/board/Android.mk index 7d94ee036..f8ecc4ef3 100644 --- a/target/board/Android.mk +++ b/target/board/Android.mk @@ -2,24 +2,6 @@ # Set up product-global definitions and include product-specific rules. # -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 - -include $(TARGET_DEVICE_DIR)/AndroidBoard.mk # Generate a file that contains various information about the