- pregen install_dev;
- touch $(UCLIBC_DIR)/.configured
-
-$(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(LIBFLOAT_TARGET)
- $(MAKE) -C $(UCLIBC_DIR) \
- PREFIX= \
- DEVEL_PREFIX=/ \
- RUNTIME_PREFIX=/ \
- HOSTCC="$(HOSTCC)" \
- CPU_CFLAGS="$(TARGET_CFLAGS)" \
- all
- touch -c $(UCLIBC_DIR)/lib/libc.a
-
-$(STAGING_DIR)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
- $(MAKE) -C $(UCLIBC_DIR) \
- PREFIX=$(STAGING_DIR)/ \
- DEVEL_PREFIX=/ \
- RUNTIME_PREFIX=/ \
- install_runtime
- $(MAKE) -C $(UCLIBC_DIR) \
- PREFIX=$(STAGING_DIR)/ \
- DEVEL_PREFIX=/ \
- RUNTIME_PREFIX=/ \
- install_dev
- echo $(UCLIBC_VER) > $(STAGING_DIR)/uclibc_version
- touch -c $(STAGING_DIR)/lib/libc.a
-
-source: $(DL_DIR)/$(UCLIBC_SOURCE)
-prepare: $(UCLIBC_DIR)/.configured
-compile: $(UCLIBC_DIR)/lib/libc.a
-install: $(STAGING_DIR)/lib/libc.a $(UCLIBC_TARGETS)
-clean: FORCE
- rm -rf $(UCLIBC_DIR) $(TOOL_BUILD_DIR)/uClibc_dev
+ ARCH="$(CONFIG_ARCH)" \
+ pregen \
+ install_headers
+endef
+
+define Host/Configure
+endef
+
+UCLIBC_MAKE = PATH='$(TARGET_PATH)' $(MAKE) -C $(HOST_BUILD_DIR) \
+ $(TARGET_CONFIGURE_OPTS) \
+ DEVEL_PREFIX=/usr/ \
+ RUNTIME_PREFIX=/ \
+ HOSTCC="$(HOSTCC)" \
+ CPU_CFLAGS="$(TARGET_CFLAGS)" \
+ ARCH="$(CONFIG_ARCH)" \
+ LIBGCC="$(subst libgcc.a,libgcc_initial.a,$(shell $(TARGET_CC) -print-libgcc-file-name))" \
+ DOSTRIP=""
+
+define Host/Compile
+ $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(HOST_BUILD_DIR)/Rules.mak
+ $(UCLIBC_MAKE) PREFIX= all
+ $(UCLIBC_MAKE) PREFIX="$(TOOLCHAIN_DIR)/" install_runtime install_dev
+ ln -sf ../../lib/libc.so.0 $(TOOLCHAIN_DIR)/usr/lib/libc.so
+ $(CP) $(HOST_BUILD_DIR)/libc/libc_so.a $(TOOLCHAIN_DIR)/usr/lib/
+ $(CP) $(HOST_BUILD_DIR)/libpthread/*/libpthread_so.a $(TOOLCHAIN_DIR)/usr/lib/
+ ( cd $(TOOLCHAIN_DIR) ; \
+ for d in lib usr/lib ; do \
+ for f in libc.so libpthread.so libgcc_s.so ; do \
+ if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
+ $(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
+ fi \
+ done \
+ done \
+ )
+endef
+
+define Host/Install
+ $(UCLIBC_MAKE) PREFIX= utils
+ $(INSTALL_DIR) $(TOOLCHAIN_DIR)/bin
+ $(INSTALL_DIR) $(TOOLCHAIN_DIR)/usr/bin
+ $(INSTALL_BIN) \
+ $(HOST_BUILD_DIR)/utils/ldd \
+ $(TOOLCHAIN_DIR)/usr/bin/
+ $(INSTALL_DIR) $(TOOLCHAIN_DIR)/sbin
+ $(INSTALL_BIN) \
+ $(HOST_BUILD_DIR)/utils/ldconfig \
+ $(TOOLCHAIN_DIR)/sbin/
+endef
+
+define Host/Clean
+ rm -rf \
+ $(HOST_BUILD_DIR) \
+ $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
+ $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
+endef
+
+$(eval $(call HostBuild))