Skip to content

Commit

Permalink
toolchain: introduce a virtual package
Browse files Browse the repository at this point in the history
This commit introduces a virtual package called 'toolchain', located
in 'toolchain/toolchain', which simply depends on
'toolchain-buildroot' or 'toolchain-external' depending on the
selected toolchain backend.

For now, toolchain-buildroot and toolchain-external are still manual
make targets, but the following patches convert those backends to use
the package infrastructure as well.

In addition to this:

 * The main Makefile is modified to always make BASE_TARGETS point to
   this new toolchain virtual package.

 * The main Makefile is changed to include all the toolchain/*/*.mk
   files: the toolchain virtual package, and the toolchain-buildroot
   and toolchain-external directories.

 * The dependency of the toolchain on prepare dirs and dependencies is
   moved to the toolchain virtual package. It is moved as a
   prerequisite of the "toolchain-source" rule to ensure that all
   directories are prepared before we even start extracting the
   toolchain.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
Acked-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  • Loading branch information
tpetazzoni authored and jacmet committed Oct 9, 2013
1 parent 2c13d5b commit 8b0905b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
19 changes: 4 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,7 @@ GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
#
################################################################################

ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
BASE_TARGETS += toolchain-buildroot
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
BASE_TARGETS += toolchain-external
endif
BASE_TARGETS = toolchain

TARGETS:=

Expand Down Expand Up @@ -317,11 +313,8 @@ include support/dependencies/dependencies.mk
# We also need the various per-package makefiles, which also add
# each selected package to TARGETS if that package was selected
# in the .config file.
ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
include toolchain/toolchain-buildroot.mk
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
include toolchain/toolchain-external.mk
endif
include toolchain/helpers.mk
include toolchain/*/*.mk

# Include the package override file if one has been provided in the
# configuration.
Expand Down Expand Up @@ -388,16 +381,12 @@ $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
$(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)

$(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake

$(BUILD_DIR)/buildroot-config/auto.conf: $(BUILDROOT_CONFIG)
$(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig

prepare: $(BUILD_DIR)/buildroot-config/auto.conf

toolchain: prepare dirs dependencies $(BASE_TARGETS)

world: toolchain $(TARGETS_ALL)
world: $(BASE_TARGETS) $(TARGETS_ALL)

.PHONY: all world toolchain dirs clean distclean source outputmakefile \
legal-info legal-info-prepare legal-info-clean printvars \
Expand Down
18 changes: 18 additions & 0 deletions toolchain/toolchain/toolchain.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
################################################################################
#
# toolchain
#
################################################################################

TOOLCHAIN_SOURCE =

ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
TOOLCHAIN_DEPENDENCIES += toolchain-buildroot
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
TOOLCHAIN_DEPENDENCIES += toolchain-external
endif

$(eval $(generic-package))

toolchain-source: prepare dirs dependencies $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake

0 comments on commit 8b0905b

Please sign in to comment.