# 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
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) \
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) \
GCC_VARIANT:=initial
+GCC_PREPARE=$(CONFIG_USE_MUSL)
include ../common.mk
--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 \
GCC_VARIANT:=minimal
+GCC_PREPARE=$(if $(CONFIG_USE_MUSL),,1)
include ../common.mk
--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
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); \
+++ /dev/null
-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))
-
ARCH="$(CONFIG_ARCH)" \
pregen \
install_headers
+ $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/
endef
$(eval $(call HostBuild))