-$(curdir)/uClibc/prepare:=$(curdir)/kernel-headers/prepare
-ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
- $(curdir)/binutils/prepare:=$(curdir)/uClibc/prepare
- $(curdir)/gcc/prepare:=$(curdir)/binutils/install
- $(curdir)/uClibc/compile:=$(curdir)/gcc/compile
+ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
+ 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)/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)/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
+ @for dir in $(TOOLCHAIN_DIR); do ( \
+ $(if $(QUIET),,set -x;) \
+ mkdir -p "$$dir"; \
+ cd "$$dir"; \
+ ln -nsf lib lib64; \
+ ln -nsf lib lib32; \
+ mkdir -p stamp lib usr/include usr/lib ; \
+ ); done
+ @grep GCC_VERSION $@ >/dev/null 2>&1 || $(INSTALL_DATA) $(TOPDIR)/toolchain/info.mk $@
+ @touch $@
+endif