build: remove separate /install step for host builds

Reduces the number of recursive make invocations

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2017-01-18 17:56:13 +01:00
parent 7a523569f7
commit 131db366a3
4 changed files with 68 additions and 67 deletions

View File

@ -39,8 +39,8 @@ else
include tools/Makefile include tools/Makefile
include toolchain/Makefile include toolchain/Makefile
$(toolchain/stamp-install): $(tools/stamp-install) $(toolchain/stamp-compile): $(tools/stamp-compile)
$(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared $(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared
$(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
$(package/stamp-install): $(package/stamp-compile) $(package/stamp-install): $(package/stamp-compile)
$(target/stamp-install): $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
@ -91,7 +91,7 @@ diffconfig: FORCE
mkdir -p $(BIN_DIR) mkdir -p $(BIN_DIR)
$(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.seed $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.seed
prepare: .config $(tools/stamp-install) $(toolchain/stamp-install) prepare: .config $(tools/stamp-compile) $(toolchain/stamp-compile)
world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
$(_SINGLE)$(SUBMAKE) -r package/index $(_SINGLE)$(SUBMAKE) -r package/index
$(_SINGLE)$(SUBMAKE) -r diffconfig $(_SINGLE)$(SUBMAKE) -r diffconfig

View File

@ -177,8 +177,7 @@ ifndef DUMP
.host-prepare: $(HOST_STAMP_PREPARED) .host-prepare: $(HOST_STAMP_PREPARED)
.host-configure: $(HOST_STAMP_CONFIGURED) .host-configure: $(HOST_STAMP_CONFIGURED)
.host-compile: $(HOST_STAMP_BUILT) $(if $(STAMP_BUILT),$(HOST_STAMP_INSTALLED)) .host-compile: $(HOST_STAMP_BUILT) $(HOST_STAMP_INSTALLED)
.host-install: $(HOST_STAMP_INSTALLED)
host-clean: FORCE host-clean: FORCE
$(call Host/Clean) $(call Host/Clean)
$(call Host/Uninstall) $(call Host/Uninstall)

View File

@ -7,21 +7,21 @@
# Main makefile for the toolchain # Main makefile for the toolchain
# #
# Steps: # Steps:
# 1) toolchain/binutils/install # 1) toolchain/binutils/compile
# build & install binutils # build & install binutils
# 2) toolchain/gcc/minimal/install # 2) toolchain/gcc/minimal/compile
# build & install a minimal gcc, needed for steps 3 & 4 # build & install a minimal gcc, needed for steps 3 & 4
# 3) toolchain/kernel-headers/install # 3) toolchain/kernel-headers/compile
# install kernel headers, needed for step 4 # install kernel headers, needed for step 4
# 4) toolchain/libc/headers/install # 4) toolchain/libc/headers/compile
# build & install libc headers & support files, needed for step 5 # build & install libc headers & support files, needed for step 5
# 5) toolchain/gcc/initial/install # 5) toolchain/gcc/initial/compile
# build & install an initial gcc, needed for step 6 # build & install an initial gcc, needed for step 6
# 6) toolchain/libc/install # 6) toolchain/libc/compile
# build & install the final libc # build & install the final libc
# 7) toolchain/gcc/final/install # 7) toolchain/gcc/final/compile
# build & install the final gcc # build & install the final gcc
# 8) toolchain/libc/utils/install # 8) toolchain/libc/utils/compile
# build & install libc utilities # build & install libc utilities
# #
# For musl, steps 2 and 4 are skipped, and step 3 is done after 5 # For musl, steps 2 and 4 are skipped, and step 3 is done after 5
@ -37,28 +37,27 @@ endif
# builddir dependencies # builddir dependencies
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
ifdef CONFIG_USE_MUSL ifdef CONFIG_USE_MUSL
$(curdir)/kernel-headers/compile:=$(curdir)/gcc/initial/install $(curdir)/kernel-headers/compile:=$(curdir)/gcc/initial/compile
$(curdir)/$(LIBC)/compile:=$(curdir)/kernel-headers/install $(curdir)/$(LIBC)/compile:=$(curdir)/kernel-headers/compile
else else
$(curdir)/builddirs += $(LIBC)/headers gcc/minimal $(curdir)/builddirs += $(LIBC)/headers gcc/minimal
$(curdir)/gcc/minimal/compile:=$(curdir)/binutils/install $(curdir)/gcc/minimal/compile:=$(curdir)/binutils/compile
$(curdir)/kernel-headers/compile:=$(curdir)/gcc/minimal/install $(curdir)/kernel-headers/compile:=$(curdir)/gcc/minimal/compile
$(curdir)/gcc/initial/prepare:=$(curdir)/gcc/minimal/prepare $(curdir)/gcc/initial/prepare:=$(curdir)/gcc/minimal/prepare
$(curdir)/$(LIBC)/prepare:=$(curdir)/$(LIBC)/headers/prepare $(curdir)/$(LIBC)/prepare:=$(curdir)/$(LIBC)/headers/prepare
$(curdir)/$(LIBC)/headers/compile:=$(curdir)/kernel-headers/install $(curdir)/$(LIBC)/headers/compile:=$(curdir)/kernel-headers/compile
$(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/install $(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/compile
endif endif
$(curdir)/gcc/initial/compile+=$(curdir)/binutils/install $(curdir)/gcc/initial/compile+=$(curdir)/binutils/compile
$(curdir)/gcc/final/prepare:=$(curdir)/gcc/initial/prepare $(curdir)/gcc/final/prepare:=$(curdir)/gcc/initial/prepare
$(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/install $(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/compile
$(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/install $(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/compile
$(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/install $(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/compile
$(curdir)/$(LIBC)/utils/prepare:=$(curdir)/$(LIBC)/headers/prepare $(curdir)/$(LIBC)/utils/prepare:=$(curdir)/$(LIBC)/headers/prepare
endif endif
$(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare) $(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare)
$(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
ifndef DUMP_TARGET_DB ifndef DUMP_TARGET_DB
ifneq ($(ARCH),) ifneq ($(ARCH),)
@ -78,15 +77,17 @@ endif
# prerequisites for the individual targets # prerequisites for the individual targets
$(curdir)/ := .config prereq $(curdir)/ := .config prereq
$(curdir)//prepare = $(STAGING_DIR)/.prepared $(TOOLCHAIN_DIR)/info.mk $(tools/stamp-install) $(curdir)//prepare = $(STAGING_DIR)/.prepared $(TOOLCHAIN_DIR)/info.mk $(tools/stamp-compile)
$(curdir)//compile = $(1)/prepare $(curdir)//compile = $(1)/prepare
$(curdir)//install = $(1)/compile $(curdir)//compile = $(1)/compile
ifndef DUMP_TARGET_DB ifndef DUMP_TARGET_DB
$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed: $(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed:
endif endif
$(eval $(call stampfile,$(curdir),toolchain,install,$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed,,$(TOOLCHAIN_DIR))) $(curdir)/install: $(curdir)/compile
$(eval $(call stampfile,$(curdir),toolchain,compile,$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed,,$(TOOLCHAIN_DIR)))
$(eval $(call stampfile,$(curdir),toolchain,check,$(TMP_DIR)/.build)) $(eval $(call stampfile,$(curdir),toolchain,check,$(TMP_DIR)/.build))
$(eval $(call subdir,$(curdir))) $(eval $(call subdir,$(curdir)))

View File

@ -40,64 +40,64 @@ tools-$(CONFIG_USE_SPARSE) += sparse
tools-$(CONFIG_TARGET_apm821xx) += genext2fs tools-$(CONFIG_TARGET_apm821xx) += genext2fs
# builddir dependencies # builddir dependencies
$(curdir)/bison/compile := $(curdir)/flex/install $(curdir)/bison/compile := $(curdir)/flex/compile
$(curdir)/flex/compile := $(curdir)/libtool/install $(curdir)/flex/compile := $(curdir)/libtool/compile
$(curdir)/libtool/compile := $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/automake/install $(curdir)/missing-macros/install $(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
$(curdir)/squashfs/compile := $(curdir)/lzma-old/install $(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
$(curdir)/squashfs4/compile := $(curdir)/xz/install $(curdir)/squashfs4/compile := $(curdir)/xz/compile
$(curdir)/quilt/compile := $(curdir)/autoconf/install $(curdir)/findutils/install $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile
$(curdir)/autoconf/compile := $(curdir)/m4/install $(curdir)/autoconf/compile := $(curdir)/m4/compile
$(curdir)/automake/compile := $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/pkg-config/install $(curdir)/xz/install $(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkg-config/compile $(curdir)/xz/compile
$(curdir)/gmp/compile := $(curdir)/libtool/install $(curdir)/gmp/compile := $(curdir)/libtool/compile
$(curdir)/mpc/compile := $(curdir)/mpfr/install $(curdir)/gmp/install $(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile
$(curdir)/mpfr/compile := $(curdir)/gmp/install $(curdir)/mpfr/compile := $(curdir)/gmp/compile
$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/install $(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile
$(curdir)/mklibs/compile := $(curdir)/libtool/install $(curdir)/mklibs/compile := $(curdir)/libtool/compile
$(curdir)/qemu/compile := $(curdir)/e2fsprogs/install $(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile
$(curdir)/upslug2/compile := $(curdir)/libtool/install $(curdir)/upslug2/compile := $(curdir)/libtool/compile
$(curdir)/mm-macros/compile := $(curdir)/libtool/install $(curdir)/mm-macros/compile := $(curdir)/libtool/compile
$(curdir)/missing-macros/compile := $(curdir)/autoconf/install $(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
$(curdir)/e2fsprogs/compile := $(curdir)/libtool/install $(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile
$(curdir)/libelf/compile := $(curdir)/libtool/install $(curdir)/libelf/compile := $(curdir)/libtool/compile
$(curdir)/sdcc/compile := $(curdir)/bison/install $(curdir)/sdcc/compile := $(curdir)/bison/compile
$(curdir)/b43-tools/compile := $(curdir)/bison/install $(curdir)/b43-tools/compile := $(curdir)/bison/compile
$(curdir)/padjffs2/compile := $(curdir)/findutils/install $(curdir)/padjffs2/compile := $(curdir)/findutils/compile
$(curdir)/isl/compile := $(curdir)/gmp/install $(curdir)/isl/compile := $(curdir)/gmp/compile
$(curdir)/bc/compile := $(curdir)/bison/install $(curdir)/bc/compile := $(curdir)/bison/compile
$(curdir)/findutils/compile := $(curdir)/bison/install $(curdir)/findutils/compile := $(curdir)/bison/compile
$(curdir)/gengetopt/compile := $(curdir)/libtool/install $(curdir)/gengetopt/compile := $(curdir)/libtool/compile
$(curdir)/patchelf/compile := $(curdir)/libtool/install $(curdir)/patchelf/compile := $(curdir)/libtool/compile
$(curdir)/dosfstools/compile := $(curdir)/autoconf/install $(curdir)/automake/install $(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile
$(curdir)/libressl/compile := $(curdir)/pkg-config/install $(curdir)/libressl/compile := $(curdir)/pkg-config/compile
$(curdir)/mkimage/compile += $(curdir)/libressl/install $(curdir)/mkimage/compile += $(curdir)/libressl/compile
$(curdir)/firmware-utils/compile += $(curdir)/libressl/install $(curdir)/firmware-utils/compile += $(curdir)/libressl/compile
$(curdir)/cmake/compile += $(curdir)/libressl/install $(curdir)/cmake/compile += $(curdir)/libressl/compile
ifneq ($(HOST_OS),Linux) ifneq ($(HOST_OS),Linux)
tools-y += coreutils tools-y += coreutils
endif endif
ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),) ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),)
$(foreach tool, $(filter-out xz patch,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/install)) $(foreach tool, $(filter-out xz patch,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile))
tools-y += ccache tools-y += ccache
endif endif
# in case there is no patch tool on the host we need to make patch tool a # in case there is no patch tool on the host we need to make patch tool a
# dependency for tools which have patches directory # dependency for tools which have patches directory
$(foreach tool, $(tools-y), $(if $(wildcard $(curdir)/$(tool)/patches),$(eval $(curdir)/$(tool)/compile += $(curdir)/patch/install))) $(foreach tool, $(tools-y), $(if $(wildcard $(curdir)/$(tool)/patches),$(eval $(curdir)/$(tool)/compile += $(curdir)/patch/compile)))
$(foreach tool, $(filter-out xz,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/xz/install)) $(foreach tool, $(filter-out xz,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/xz/compile))
# make any tool depend on tar, xz and patch to ensure that archives can be unpacked and patched properly # make any tool depend on tar, xz and patch to ensure that archives can be unpacked and patched properly
tools-core := tar xz patch tools-core := tar xz patch
$(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(patsubst %,$(curdir)/%/install,$(tools-core)))) $(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(patsubst %,$(curdir)/%/compile,$(tools-core))))
tools-y += $(tools-core) tools-y += $(tools-core)
# make core tools depend on sed and flock # make core tools depend on sed and flock
$(foreach tool, $(tools-core), $(eval $(curdir)/$(tool)/compile += $(curdir)/sed/install)) $(foreach tool, $(tools-core), $(eval $(curdir)/$(tool)/compile += $(curdir)/sed/compile))
$(curdir)/sed/compile := $(curdir)/flock/install $(curdir)/sed/compile := $(curdir)/flock/compile
tools-y += flock sed tools-y += flock sed
$(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-) $(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-)
@ -139,9 +139,10 @@ $(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared
# prerequisites for the individual targets # prerequisites for the individual targets
$(curdir)/ := .config prereq $(curdir)/ := .config prereq
$(curdir)//install = $(1)/compile
$(curdir)/install: $(curdir)/compile
tools_enabled = $(foreach tool,$(sort $(tools-y) $(tools-)),$(if $(filter $(tool),$(tools-y)),y,n)) tools_enabled = $(foreach tool,$(sort $(tools-y) $(tools-)),$(if $(filter $(tool),$(tools-y)),y,n))
$(eval $(call stampfile,$(curdir),tools,install,,_$(subst $(space),,$(tools_enabled)))) $(eval $(call stampfile,$(curdir),tools,compile,,_$(subst $(space),,$(tools_enabled))))
$(eval $(call stampfile,$(curdir),tools,check,$(TMP_DIR)/.build)) $(eval $(call stampfile,$(curdir),tools,check,$(TMP_DIR)/.build))
$(eval $(call subdir,$(curdir))) $(eval $(call subdir,$(curdir)))