toolchain: skip gcc/minimal for musl
authorFelix Fietkau <nbd@nbd.name>
Thu, 7 Jul 2016 12:12:30 +0000 (14:12 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 7 Jul 2016 13:13:40 +0000 (15:13 +0200)
No extra libc header build step is done, so no extra toolchain is needed
for preparing it.
This saves a significant amount of build time and disk space

Signed-off-by: Felix Fietkau <nbd@nbd.name>
toolchain/Makefile
toolchain/gcc/common.mk
toolchain/gcc/initial/Makefile
toolchain/gcc/minimal/Makefile
toolchain/glibc/headers/Makefile
toolchain/musl/headers/Makefile [deleted file]
toolchain/uClibc/headers/Makefile

index cd5399e041a2d973390a1eeb45b21b57f814148e..7d2fddda31652a2f780d3eb536edbf5f778a3cac 100644 (file)
 # 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
index eab143cbc628c78f7b5a5fa961ca3779067b31d3..9bc849152bac6d3097c60974c75662a7e96ad59a 100644 (file)
@@ -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) \
index f0c65b528c8d313fd7b881b3e0038f9efa64845a..1ed548436ea26eaa1a54ea623f9c3dd663e51299 100644 (file)
@@ -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 \
index 0344e1a7eca3571005e9879f73711c06f1db88e8..31d6f675abe134e1b2e3ffe1bc5a681c09d2ad95 100644 (file)
@@ -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
index f9f411b1f0a4e3c8e827bbf75fd9a058dae63522..f1d8a8bc61e5730468959e21678f30ade624a79d 100644 (file)
@@ -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 (file)
index 21e6b3b..0000000
+++ /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))
-
index 67a2d95c378978f75978faca87b94d95413cdc67..abd3620d33edcbbd6b7a50a4c8365b292a81d109 100644 (file)
@@ -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))