diff options
author | Khalid Zubair <kzubair@cyngn.com> | 2015-11-18 17:13:09 -0800 |
---|---|---|
committer | Ethan Chen <intervigil@gmail.com> | 2016-01-04 11:27:24 -0800 |
commit | 2a70972835ad79349f60727a819879a59e532df0 (patch) | |
tree | d787215e4983f24329264b5a404c1030716220d2 /core/tasks | |
parent | 9a91748c871670d4a6dabf95e6bfe44837687734 (diff) | |
download | build-2a70972835ad79349f60727a819879a59e532df0.zip build-2a70972835ad79349f60727a819879a59e532df0.tar.gz build-2a70972835ad79349f60727a819879a59e532df0.tar.bz2 |
kernel: prevent targets from being rebuilt needlessly
Fix some rules that listed directories as their dependencies.
Directories are always out-of-date because the rules that depend on
them touch file under the directories they depend on them.
Replace the directory dependencies with stamp file rules that handle
directory creation.
Change-Id: I2b36c846b6565b7f9aba5bb7583576ad300983b8
Diffstat (limited to 'core/tasks')
-rw-r--r-- | core/tasks/kernel.mk | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/core/tasks/kernel.mk b/core/tasks/kernel.mk index 140964c..cc1b5ce 100644 --- a/core/tasks/kernel.mk +++ b/core/tasks/kernel.mk @@ -28,6 +28,7 @@ SELINUX_DEFCONFIG := $(TARGET_KERNEL_SELINUX_CONFIG) ## Internal variables KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ KERNEL_CONFIG := $(KERNEL_OUT)/.config +KERNEL_OUT_STAMP := $(KERNEL_OUT)/.mkdir_stamp TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH)) ifeq ($(TARGET_KERNEL_ARCH),) @@ -35,6 +36,7 @@ KERNEL_ARCH := $(TARGET_ARCH) else KERNEL_ARCH := $(TARGET_KERNEL_ARCH) endif +KERNEL_DEFCONFIG_SRC := $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_DEFCONFIG) TARGET_KERNEL_HEADER_ARCH := $(strip $(TARGET_KERNEL_HEADER_ARCH)) ifeq ($(TARGET_KERNEL_HEADER_ARCH),) @@ -160,6 +162,7 @@ endif ifeq ($(FULL_KERNEL_BUILD),true) KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr +KERNEL_HEADERS_INSTALL_STAMP := $(KERNEL_OUT)/.headers_install_stamp KERNEL_MODULES_INSTALL := system KERNEL_MODULES_OUT := $(TARGET_OUT)/lib/modules @@ -214,11 +217,12 @@ ifeq ($(TARGET_KERNEL_MODULES),) TARGET_KERNEL_MODULES := no-external-modules endif -$(KERNEL_OUT): - mkdir -p $(KERNEL_OUT) - mkdir -p $(KERNEL_MODULES_OUT) +$(KERNEL_OUT_STAMP): + $(hide) mkdir -p $(KERNEL_OUT) + $(hide) mkdir -p $(KERNEL_MODULES_OUT) + $(hide) touch $@ -$(KERNEL_CONFIG): $(KERNEL_OUT) +$(KERNEL_CONFIG): $(KERNEL_OUT_STAMP) $(KERNEL_DEFCONFIG_SRC) $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_DEFCONFIG) $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \ echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \ @@ -229,7 +233,7 @@ $(KERNEL_CONFIG): $(KERNEL_OUT) $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig; fi -TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL) +TARGET_KERNEL_BINARIES: $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL_STAMP) @echo -e ${CL_GRN}"Building Kernel"${CL_RST} $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE) $(hide) if grep -q 'CONFIG_OF=y' $(KERNEL_CONFIG) ; \ @@ -257,7 +261,7 @@ $(TARGET_PREBUILT_INT_KERNEL): $(TARGET_KERNEL_MODULES) $(mv-modules) $(clean-module-folder) -$(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT) $(KERNEL_CONFIG) +$(KERNEL_HEADERS_INSTALL_STAMP): $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG) $(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \ rm -f ../$(KERNEL_CONFIG); \ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_HEADER_DEFCONFIG); \ @@ -274,13 +278,17 @@ $(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT) $(KERNEL_CONFIG) echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \ $(KERNEL_SRC)/scripts/kconfig/merge_config.sh -m -O $(KERNEL_OUT) $(KERNEL_OUT)/.config $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG); \ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) KCONFIG_ALLCONFIG=$(KERNEL_OUT)/.config alldefconfig; fi + $(hide) touch $@ -kerneltags: $(KERNEL_OUT) $(KERNEL_CONFIG) +# provide this rule because there are dependencies on this throughout the repo +$(KERNEL_HEADERS_INSTALL): $(KERNEL_HEADERS_INSTALL_STAMP) + +kerneltags: $(KERNEL_OUT_STAMP) $(KERNEL_CONFIG) $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) tags kernelconfig: KERNELCONFIG_MODE := menuconfig kernelxconfig: KERNELCONFIG_MODE := xconfig -kernelxconfig kernelconfig: $(KERNEL_OUT) +kernelxconfig kernelconfig: $(KERNEL_OUT_STAMP) $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_DEFCONFIG) $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \ echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \ @@ -289,9 +297,9 @@ kernelxconfig kernelconfig: $(KERNEL_OUT) $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNELCONFIG_MODE) env KCONFIG_NOTIMESTAMP=true \ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig - cp $(KERNEL_OUT)/defconfig $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_DEFCONFIG) + cp $(KERNEL_OUT)/defconfig $(KERNEL_DEFCONFIG_SRC) -alldefconfig: $(KERNEL_OUT) +alldefconfig: $(KERNEL_OUT_STAMP) env KCONFIG_NOTIMESTAMP=true \ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) alldefconfig |