aboutsummaryrefslogtreecommitdiffstats
path: root/toolchain
diff options
context:
space:
mode:
Diffstat (limited to 'toolchain')
-rw-r--r--toolchain/Makefile29
-rw-r--r--toolchain/gcc/common.mk26
-rw-r--r--toolchain/gcc/initial/Makefile2
-rw-r--r--toolchain/gcc/minimal/Makefile19
-rw-r--r--toolchain/glibc/headers/Makefile1
-rw-r--r--toolchain/musl/headers/Makefile16
-rw-r--r--toolchain/uClibc/headers/Makefile1
7 files changed, 46 insertions, 48 deletions
diff --git a/toolchain/Makefile b/toolchain/Makefile
index cd5399e041..7d2fddda31 100644
--- a/toolchain/Makefile
+++ b/toolchain/Makefile
@@ -24,33 +24,42 @@
# 8) toolchain/libc/utils/install
# build & install libc utilities
#
+# For musl, steps 2 and 4 are skipped, and step 3 is done after 5
curdir:=toolchain
# subdirectories to descend into
-$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/minimal gcc/initial gcc/final $(LIBC)/headers $(LIBC) fortify-headers)
+$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/initial gcc/final $(LIBC) fortify-headers)
ifdef CONFIG_USE_UCLIBC
$(curdir)/builddirs += $(LIBC)/utils
endif
-$(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare)
-$(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
# builddir dependencies
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
- $(curdir)/gcc/minimal/compile:=$(curdir)/binutils/install
- $(curdir)/kernel-headers/install:=$(curdir)/gcc/minimal/install
- $(curdir)/gcc/initial/prepare:=$(curdir)/gcc/minimal/prepare
- $(curdir)/gcc/final/prepare:=$(curdir)/gcc/initial/prepare
+ ifdef CONFIG_USE_MUSL
+ $(curdir)/kernel-headers/compile:=$(curdir)/gcc/initial/install
+ $(curdir)/$(LIBC)/compile:=$(curdir)/kernel-headers/install
+ else
+ $(curdir)/builddirs += $(LIBC)/headers gcc/minimal
+ $(curdir)/gcc/minimal/compile:=$(curdir)/binutils/install
+ $(curdir)/kernel-headers/compile:=$(curdir)/gcc/minimal/install
+ $(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
+ endif
- $(curdir)/$(LIBC)/headers/compile:=$(curdir)/kernel-headers/install
- $(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/install
+ $(curdir)/gcc/initial/compile+=$(curdir)/binutils/install
+ $(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)/prepare:=$(curdir)/$(LIBC)/headers/prepare
$(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),)
$(TOOLCHAIN_DIR)/info.mk: .config
diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index eab143cbc6..9bc849152b 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -170,10 +170,30 @@ GCC_MAKE:= \
CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS)"
-define Host/Prepare
- mkdir -p $(GCC_BUILD_DIR)
+define Host/SetToolchainInfo
+ $(SED) 's,TARGET_CROSS=.*,TARGET_CROSS=$(REAL_GNU_TARGET_NAME)-,' $(TOOLCHAIN_DIR)/info.mk
+ $(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(GCC_VERSION),' $(TOOLCHAIN_DIR)/info.mk
endef
+ifneq ($(GCC_PREPARE),)
+ define Host/Prepare
+ $(call Host/SetToolchainInfo)
+ $(call Host/Prepare/Default)
+ ln -snf $(GCC_DIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
+ $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_SOURCE_DIR)/
+ $(SED) 's,^MULTILIB_OSDIRNAMES,# MULTILIB_OSDIRNAMES,' $(HOST_SOURCE_DIR)/gcc/config/*/t-*
+ $(SED) 'd' $(HOST_SOURCE_DIR)/gcc/DEV-PHASE
+ $(SED) 's, DATESTAMP,,' $(HOST_SOURCE_DIR)/gcc/version.c
+ #(cd $(HOST_SOURCE_DIR)/libstdc++-v3; autoconf;);
+ $(SED) 's,gcc_no_link=yes,gcc_no_link=no,' $(HOST_SOURCE_DIR)/libstdc++-v3/configure
+ mkdir -p $(GCC_BUILD_DIR)
+ endef
+else
+ define Host/Prepare
+ mkdir -p $(GCC_BUILD_DIR)
+ endef
+endif
+
define Host/Configure
(cd $(GCC_BUILD_DIR) && rm -f config.cache; \
$(GCC_CONFIGURE) \
@@ -181,7 +201,7 @@ define Host/Configure
endef
define Host/Clean
- rm -rf \
+ rm -rf $(if $(GCC_PREPARE),$(HOST_SOURCE_DIR)) \
$(STAGING_DIR_HOST)/stamp/.gcc_* \
$(STAGING_DIR_HOST)/stamp/.binutils_* \
$(GCC_BUILD_DIR) \
diff --git a/toolchain/gcc/initial/Makefile b/toolchain/gcc/initial/Makefile
index f0c65b528c..1ed548436e 100644
--- a/toolchain/gcc/initial/Makefile
+++ b/toolchain/gcc/initial/Makefile
@@ -1,4 +1,5 @@
GCC_VARIANT:=initial
+GCC_PREPARE=$(CONFIG_USE_MUSL)
include ../common.mk
@@ -10,7 +11,6 @@ GCC_CONFIGURE += \
--disable-threads \
define Host/Compile
- $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
all-build-libiberty \
all-gcc \
diff --git a/toolchain/gcc/minimal/Makefile b/toolchain/gcc/minimal/Makefile
index 0344e1a7ec..31d6f675ab 100644
--- a/toolchain/gcc/minimal/Makefile
+++ b/toolchain/gcc/minimal/Makefile
@@ -1,4 +1,5 @@
GCC_VARIANT:=minimal
+GCC_PREPARE=$(if $(CONFIG_USE_MUSL),,1)
include ../common.mk
@@ -11,24 +12,6 @@ GCC_CONFIGURE += \
--disable-shared \
--disable-threads
-define Host/SetToolchainInfo
- $(SED) 's,TARGET_CROSS=.*,TARGET_CROSS=$(REAL_GNU_TARGET_NAME)-,' $(TOOLCHAIN_DIR)/info.mk
- $(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(GCC_VERSION),' $(TOOLCHAIN_DIR)/info.mk
-endef
-
-define Host/Prepare
- $(call Host/SetToolchainInfo)
- $(call Host/Prepare/Default)
- ln -snf $(GCC_DIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
- $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
- $(SED) 's,^MULTILIB_OSDIRNAMES,# MULTILIB_OSDIRNAMES,' $(HOST_BUILD_DIR)/gcc/config/*/t-*
- $(SED) 'd' $(HOST_BUILD_DIR)/gcc/DEV-PHASE
- $(SED) 's, DATESTAMP,,' $(HOST_BUILD_DIR)/gcc/version.c
- #(cd $(HOST_BUILD_DIR)/libstdc++-v3; autoconf;);
- $(SED) 's,gcc_no_link=yes,gcc_no_link=no,' $(HOST_BUILD_DIR)/libstdc++-v3/configure
- mkdir -p $(GCC_BUILD_DIR)
-endef
-
define Host/Compile
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) all-gcc all-target-libgcc
endef
diff --git a/toolchain/glibc/headers/Makefile b/toolchain/glibc/headers/Makefile
index f9f411b1f0..f1d8a8bc61 100644
--- a/toolchain/glibc/headers/Makefile
+++ b/toolchain/glibc/headers/Makefile
@@ -15,6 +15,7 @@ define Host/Install
install_root="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev" \
install-bootstrap-headers=yes \
install-headers
+ $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/
$(MAKE) -C $(CUR_BUILD_DIR) \
csu/subdir_lib
( cd $(CUR_BUILD_DIR); \
diff --git a/toolchain/musl/headers/Makefile b/toolchain/musl/headers/Makefile
deleted file mode 100644
index 21e6b3bd15..0000000000
--- a/toolchain/musl/headers/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-PATH_PREFIX:=..
-
-include ../common.mk
-
-HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.headers_built
-HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.uclibc_headers_installed
-
-define Host/Compile
-
-endef
-
-define Host/Install
-endef
-
-$(eval $(call HostBuild))
-
diff --git a/toolchain/uClibc/headers/Makefile b/toolchain/uClibc/headers/Makefile
index 67a2d95c37..abd3620d33 100644
--- a/toolchain/uClibc/headers/Makefile
+++ b/toolchain/uClibc/headers/Makefile
@@ -20,6 +20,7 @@ define Host/Install
ARCH="$(CONFIG_ARCH)" \
pregen \
install_headers
+ $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/
endef
$(eval $(call HostBuild))