build: remove separate /install step for host builds

Reduces the number of recursive make invocations

Signed-off-by: Felix Fietkau <nbd@nbd.name>
master
Felix Fietkau 8 years ago
parent 7a523569f7
commit 131db366a3
  1. 6
      Makefile
  2. 3
      include/host-build.mk
  3. 45
      toolchain/Makefile
  4. 81
      tools/Makefile

@ -39,8 +39,8 @@ else
include tools/Makefile
include toolchain/Makefile
$(toolchain/stamp-install): $(tools/stamp-install)
$(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
$(toolchain/stamp-compile): $(tools/stamp-compile)
$(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared
$(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
$(package/stamp-install): $(package/stamp-compile)
$(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
@ -91,7 +91,7 @@ diffconfig: FORCE
mkdir -p $(BIN_DIR)
$(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
$(_SINGLE)$(SUBMAKE) -r package/index
$(_SINGLE)$(SUBMAKE) -r diffconfig

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

@ -7,21 +7,21 @@
# Main makefile for the toolchain
#
# Steps:
# 1) toolchain/binutils/install
# 1) toolchain/binutils/compile
# build & install binutils
# 2) toolchain/gcc/minimal/install
# 2) toolchain/gcc/minimal/compile
# 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
# 4) toolchain/libc/headers/install
# 4) toolchain/libc/headers/compile
# 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
# 6) toolchain/libc/install
# 6) toolchain/libc/compile
# build & install the final libc
# 7) toolchain/gcc/final/install
# 7) toolchain/gcc/final/compile
# build & install the final gcc
# 8) toolchain/libc/utils/install
# 8) toolchain/libc/utils/compile
# build & install libc utilities
#
# For musl, steps 2 and 4 are skipped, and step 3 is done after 5
@ -37,28 +37,27 @@ endif
# builddir dependencies
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
ifdef CONFIG_USE_MUSL
$(curdir)/kernel-headers/compile:=$(curdir)/gcc/initial/install
$(curdir)/$(LIBC)/compile:=$(curdir)/kernel-headers/install
$(curdir)/kernel-headers/compile:=$(curdir)/gcc/initial/compile
$(curdir)/$(LIBC)/compile:=$(curdir)/kernel-headers/compile
else
$(curdir)/builddirs += $(LIBC)/headers gcc/minimal
$(curdir)/gcc/minimal/compile:=$(curdir)/binutils/install
$(curdir)/kernel-headers/compile:=$(curdir)/gcc/minimal/install
$(curdir)/gcc/minimal/compile:=$(curdir)/binutils/compile
$(curdir)/kernel-headers/compile:=$(curdir)/gcc/minimal/compile
$(curdir)/gcc/initial/prepare:=$(curdir)/gcc/minimal/prepare
$(curdir)/$(LIBC)/prepare:=$(curdir)/$(LIBC)/headers/prepare
$(curdir)/$(LIBC)/headers/compile:=$(curdir)/kernel-headers/install
$(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/install
$(curdir)/$(LIBC)/headers/compile:=$(curdir)/kernel-headers/compile
$(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/compile
endif
$(curdir)/gcc/initial/compile+=$(curdir)/binutils/install
$(curdir)/gcc/initial/compile+=$(curdir)/binutils/compile
$(curdir)/gcc/final/prepare:=$(curdir)/gcc/initial/prepare
$(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/install
$(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/install
$(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/install
$(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/compile
$(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/compile
$(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/compile
$(curdir)/$(LIBC)/utils/prepare:=$(curdir)/$(LIBC)/headers/prepare
endif
$(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare)
$(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
ifndef DUMP_TARGET_DB
ifneq ($(ARCH),)
@ -78,15 +77,17 @@ endif
# prerequisites for the individual targets
$(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)//install = $(1)/compile
$(curdir)//compile = $(1)/compile
ifndef DUMP_TARGET_DB
$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed:
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 subdir,$(curdir)))

@ -40,64 +40,64 @@ tools-$(CONFIG_USE_SPARSE) += sparse
tools-$(CONFIG_TARGET_apm821xx) += genext2fs
# builddir dependencies
$(curdir)/bison/compile := $(curdir)/flex/install
$(curdir)/flex/compile := $(curdir)/libtool/install
$(curdir)/libtool/compile := $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/automake/install $(curdir)/missing-macros/install
$(curdir)/squashfs/compile := $(curdir)/lzma-old/install
$(curdir)/squashfs4/compile := $(curdir)/xz/install
$(curdir)/quilt/compile := $(curdir)/autoconf/install $(curdir)/findutils/install
$(curdir)/autoconf/compile := $(curdir)/m4/install
$(curdir)/automake/compile := $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/pkg-config/install $(curdir)/xz/install
$(curdir)/gmp/compile := $(curdir)/libtool/install
$(curdir)/mpc/compile := $(curdir)/mpfr/install $(curdir)/gmp/install
$(curdir)/mpfr/compile := $(curdir)/gmp/install
$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/install
$(curdir)/mklibs/compile := $(curdir)/libtool/install
$(curdir)/qemu/compile := $(curdir)/e2fsprogs/install
$(curdir)/upslug2/compile := $(curdir)/libtool/install
$(curdir)/mm-macros/compile := $(curdir)/libtool/install
$(curdir)/missing-macros/compile := $(curdir)/autoconf/install
$(curdir)/e2fsprogs/compile := $(curdir)/libtool/install
$(curdir)/libelf/compile := $(curdir)/libtool/install
$(curdir)/sdcc/compile := $(curdir)/bison/install
$(curdir)/b43-tools/compile := $(curdir)/bison/install
$(curdir)/padjffs2/compile := $(curdir)/findutils/install
$(curdir)/isl/compile := $(curdir)/gmp/install
$(curdir)/bc/compile := $(curdir)/bison/install
$(curdir)/findutils/compile := $(curdir)/bison/install
$(curdir)/gengetopt/compile := $(curdir)/libtool/install
$(curdir)/patchelf/compile := $(curdir)/libtool/install
$(curdir)/dosfstools/compile := $(curdir)/autoconf/install $(curdir)/automake/install
$(curdir)/libressl/compile := $(curdir)/pkg-config/install
$(curdir)/mkimage/compile += $(curdir)/libressl/install
$(curdir)/firmware-utils/compile += $(curdir)/libressl/install
$(curdir)/cmake/compile += $(curdir)/libressl/install
$(curdir)/bison/compile := $(curdir)/flex/compile
$(curdir)/flex/compile := $(curdir)/libtool/compile
$(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
$(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
$(curdir)/squashfs4/compile := $(curdir)/xz/compile
$(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile
$(curdir)/autoconf/compile := $(curdir)/m4/compile
$(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkg-config/compile $(curdir)/xz/compile
$(curdir)/gmp/compile := $(curdir)/libtool/compile
$(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile
$(curdir)/mpfr/compile := $(curdir)/gmp/compile
$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile
$(curdir)/mklibs/compile := $(curdir)/libtool/compile
$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile
$(curdir)/upslug2/compile := $(curdir)/libtool/compile
$(curdir)/mm-macros/compile := $(curdir)/libtool/compile
$(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
$(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile
$(curdir)/libelf/compile := $(curdir)/libtool/compile
$(curdir)/sdcc/compile := $(curdir)/bison/compile
$(curdir)/b43-tools/compile := $(curdir)/bison/compile
$(curdir)/padjffs2/compile := $(curdir)/findutils/compile
$(curdir)/isl/compile := $(curdir)/gmp/compile
$(curdir)/bc/compile := $(curdir)/bison/compile
$(curdir)/findutils/compile := $(curdir)/bison/compile
$(curdir)/gengetopt/compile := $(curdir)/libtool/compile
$(curdir)/patchelf/compile := $(curdir)/libtool/compile
$(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile
$(curdir)/libressl/compile := $(curdir)/pkg-config/compile
$(curdir)/mkimage/compile += $(curdir)/libressl/compile
$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile
$(curdir)/cmake/compile += $(curdir)/libressl/compile
ifneq ($(HOST_OS),Linux)
tools-y += coreutils
endif
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
endif
# in case there is no patch tool on the host we need to make patch tool a
# 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
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)
# 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
$(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
$(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))
$(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 subdir,$(curdir)))

Loading…
Cancel
Save