summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2012-01-10 22:13:22 +0100
committerAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2012-01-10 22:13:22 +0100
commit276275e7bec0d58f12f8d95cef03ba6db0dc41d9 (patch)
treea42f3bd50de32698541eb36e154521279381c1b9 /mk
parent62dcdea01ab4fe9e27f0b4dfca2ec7a41430b1d4 (diff)
downloadembtoolkit-276275e7bec0d58f12f8d95cef03ba6db0dc41d9.tar.gz
embtoolkit-276275e7bec0d58f12f8d95cef03ba6db0dc41d9.tar.bz2
embtoolkit-276275e7bec0d58f12f8d95cef03ba6db0dc41d9.tar.xz
Toolchain: after toolchain build, compress it and create associated .embtk.toolchain.kconfig file
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
Diffstat (limited to 'mk')
-rw-r--r--mk/macros.packages.mk3
-rw-r--r--mk/toolchain.mk42
2 files changed, 39 insertions, 6 deletions
diff --git a/mk/macros.packages.mk b/mk/macros.packages.mk
index c40b782..33950d5 100644
--- a/mk/macros.packages.mk
+++ b/mk/macros.packages.mk
@@ -168,6 +168,9 @@ __embtk_pkg_dotconfigured_f = $(__embtk_pkg_builddir)/.configured
__embtk_pkg_dotinstalled_f = $(__embtk_pkg_builddir)/.installed
__embtk_pkg_dotpkgkconfig_f = $(__embtk_pkg_builddir)/.embtk.$(__embtk_pkg_name).kconfig
+# Some useful macros about packages
+__embtk_rootfs_packages = $(patsubst %_install,%,$(ROOTFS_COMPONENTS-y))
+__embtk_hosttools_packages = $(patsubst %_install,%,$(HOSTTOOLS_COMPONENTS-y))
#
# A macro to get packages version from .config file.
diff --git a/mk/toolchain.mk b/mk/toolchain.mk
index d45c693..8a87678 100644
--- a/mk/toolchain.mk
+++ b/mk/toolchain.mk
@@ -86,6 +86,11 @@ AUTOTOOLS_INSTALL += automake_install
include $(EMBTK_ROOT)/mk/cmake.mk
EMBTK_CMAKE_INSTALL := $(if $(CONFIG_EMBTK_HOST_HAVE_CMAKE),cmake_install)
+TOOLCHAIN_NAME := toolchain
+TOOLCHAIN_PACKAGE := toolchain-$(GNU_TARGET)-$(EMBTK_MCU_FLAG).tar.bz2
+TOOLCHAIN_DIR := $(EMBTK_GENERATED)/toolchain-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)
+TOOLCHAIN_BUILD_DIR := $(TOOLCHAIN_DIR)
+
TOOLCHAIN_CLIB := $(if $(CONFIG_EMBTK_CLIB_EGLIBC),eglibc,uclibc)
TOOLCHAIN_POST_DEPS := mkinitialpath ccache_install $(AUTOTOOLS_INSTALL)
TOOLCHAIN_POST_DEPS += $(EMBTK_CMAKE_INSTALL)
@@ -97,17 +102,42 @@ TOOLCHAIN_DEPS += gcc2_install $(TOOLCHAIN_CLIB)_install gcc3_install
include $(EMBTK_ROOT)/mk/$(TOOLCHAIN_CLIB).mk
-buildtoolchain: $(TOOLCHAIN_POST_DEPS) $(TOOLCHAIN_DEPS)
- $(Q)$(__embtk_toolchain_symlinktools)
- $(call embtk_pinfo,"$(STRICT_GNU_TARGET) toolchain successfully built!")
-
-__embtk_toolchain_symlinktools = $(shell \
+define __embtk_toolchain_symlinktools
cd $(TOOLS)/bin; \
tools=$$(ls $(STRICT_GNU_TARGET)-*); \
toolsnames=$$(echo $$tools | sed 's/$(STRICT_GNU_TARGET)-*//g'); \
for tool in $$toolsnames; do \
ln -sf $(STRICT_GNU_TARGET)-$$tool $(GNU_TARGET)-$$tool; \
- done)
+ done
+endef
+
+define __embtk_toolchain_compress
+ tar -cjf $(TOOLCHAIN_PACKAGE) \
+ $(notdir $(SYSROOT)) $(notdir $(TOOLS)) && \
+ mv $(TOOLCHAIN_PACKAGE) $(TOOLCHAIN_DIR)/$(TOOLCHAIN_PACKAGE)
+endef
+
+define __embtk_toolchain_decompress
+ cd $(EMBTK_ROOT) && tar xjf $(TOOLCHAIN_DIR)/$(TOOLCHAIN_PACKAGE)
+endef
+
+define __embtk_toolchain_build
+ $(call embtk_pinfo,"Building new $(GNU_TARGET)/$(EMBTK_MCU_FLAG) toolchain - please wait...")
+ $(foreach dep,$(patsubst %_install,%,$(TOOLCHAIN_DEPS)), \
+ rm -rf $(call __embtk_pkg_builddir,$(dep));)
+ $(foreach pkg,$(__embtk_rootfs_packages),$(MAKE) $(pkg)_clean;)
+ rm -rf $(SYSROOT)
+ $(__embtk_mk_initsysrootdirs)
+ $(MAKE) $(TOOLCHAIN_POST_DEPS) $(TOOLCHAIN_DEPS)
+ $(__embtk_toolchain_symlinktools)
+ $(__embtk_toolchain_compress)
+ touch $(TOOLCHAIN_DIR)/.installed
+ $(call embtk_pinfo,"New $(GNU_TARGET)/$(EMBTK_MCU_FLAG) toolchain successfully built!")
+endef
+
+buildtoolchain:
+ $(Q)$(if $(call __embtk_pkg_installed-y,toolchain),true, \
+ $(__embtk_toolchain_build))
# Download target for offline build
packages_fetch:: $(patsubst %_install,download_%,$(TOOLCHAINBUILD))