2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/target.mk
14 PKG_SOURCE:=uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.uclibc.org/downloads
16 PKG_MD5SUM:=959f25286e317f0d9e2103445c5a14c2
19 PKG_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)/uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION)
21 include $(INCLUDE_DIR)/host-build.mk
23 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
25 -e 's/sparc.*/sparc/' \
27 -e 's/avr32.*/avr32/g' \
29 -e 's/ppc/powerpc/g' \
30 -e 's/v850.*/v850/g' \
32 -e 's/sh[234].*/sh/' \
34 -e 's/mipsel.*/mips/' \
39 $(call Build/Prepare/Default)
40 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR)/Rules.mak
41 if [ -e config/$(ARCH).$(BOARD) ]; then \
42 $(CP) config/$(ARCH).$(BOARD) $(PKG_BUILD_DIR)/.config; \
44 $(CP) config/$(ARCH) $(PKG_BUILD_DIR)/.config; \
46 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
47 $(PKG_BUILD_DIR)/.config
48 ifeq ($(CONFIG_LARGEFILE),y)
49 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(PKG_BUILD_DIR)/.config
51 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(PKG_BUILD_DIR)/.config
53 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(PKG_BUILD_DIR)/.config
54 ifeq ($(CONFIG_SOFT_FLOAT),y)
55 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(PKG_BUILD_DIR)/.config
57 ifeq ($(CONFIG_C99_MATH),y)
58 $(SED) 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' $(PKG_BUILD_DIR)/.config
60 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/include
61 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/lib
62 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/lib
63 PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
64 PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
66 RUNTIME_PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
68 CPU_CFLAGS="$(TARGET_CFLAGS)" \
72 define Build/Configure
76 PATH=$(TARGET_PATH) $(MAKE) -j $(CONFIG_JLEVEL) -C $(PKG_BUILD_DIR) \
81 CPU_CFLAGS="$(TARGET_CFLAGS)" \
86 $(MAKE) -C $(PKG_BUILD_DIR) \
87 PREFIX=$(STAGING_DIR)/ \
91 $(MAKE) -C $(PKG_BUILD_DIR) \
92 PREFIX=$(STAGING_DIR)/ \
96 echo $(PKG_VERSION) > $(STAGING_DIR)/uclibc_version
97 echo $(PKG_VERSION)$(PKG_EXTRAVERSION) > $(STAGING_DIR)/uclibc_extra_version
101 rm -rf $(PKG_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR)/uClibc_dev
104 $(eval $(call HostBuild))