-define Build/Prepare
- $(call Build/Prepare/Default)
- $(CP) config/$(ARCH)$(if $(wildcard config/$(ARCH).$(BOARD)),$(BOARD)) $(PKG_BUILD_DIR)/.config
- $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
- -e 's,.*HAS_FPU.*,HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,n),g' \
+
+define Host/SetToolchainInfo
+ $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
+ $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.uclibc.org/,' $(TOOLCHAIN_DIR)/info.mk
+ $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
+ $(SED) 's,^\(LIBC_PATCHVER\)=.*,\1=$(PKG_EXTRAVERSION),' $(TOOLCHAIN_DIR)/info.mk
+endef
+
+define Host/Prepare/Snapshot
+ $(PKG_UNPACK)
+ rm -Rf $(HOST_BUILD_DIR)
+ ln -snf $(BUILD_DIR_TOOLCHAIN)/uClibc $(HOST_BUILD_DIR)
+ $(Host/Patch)
+ $(if $(QUILT),touch $(HOST_BUILD_DIR)/.quilt_used)
+endef
+
+define Host/Prepare/V_0_9_28
+ $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(BUILD_DIR_TOOLCHAIN)/linux\",g' \
+ $(HOST_BUILD_DIR)/.config
+ ifeq ($(CONFIG_SOFT_FLOAT),y)
+ $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(HOST_BUILD_DIR)/.config
+ endif
+ ifeq ($(CONFIG_C99_MATH),y)
+ $(SED) 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' $(HOST_BUILD_DIR)/.config
+ endif
+endef
+
+define Host/Prepare
+ $(call Host/SetToolchainInfo)
+ @echo prepare uClibc version $(PKG_VERSION)$(PKG_EXTRAVERSION)
+ ifeq ($(PKG_VERSION_SNAPSHOT),y)
+ $(call Host/Prepare/Snapshot)
+ else
+ $(call Host/Prepare/Default)
+ ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
+ endif
+ $(CP) ./$(CONFIG_DIR)/$(ARCH)$(if $(wildcard $(CONFIG_DIR)/$(ARCH).$(BOARD)),.$(BOARD)) $(HOST_BUILD_DIR)/.config
+ ifeq ($(PKG_VERSION),0.9.28)
+ $(call Host/Prepare/V_0_9_28)
+ endif
+ $(SED) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include\",g' \
+ -e 's,^.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n,y),g' \
+ -e 's,^.*UCLIBC_HAS_SOFT_FLOAT.*,UCLIBC_HAS_SOFT_FLOAT=$(if $(CONFIG_SOFT_FLOAT),y,n),g' \