1 include $(TOPDIR)/rules.mk
3 #############################################################
5 # uClibc (the C library)
7 #############################################################
9 ifeq ($(BR2_UCLIBC_VERSION_SNAPSHOT),y)
10 # Be aware that this changes daily....
11 UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc
12 UCLIBC_SOURCE:=uClibc-$(strip $(subst ",, $(BR2_USE_UCLIBC_SNAPSHOT))).tar.bz2
14 UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots
15 UCLIBC_VER:=PKG_VERSION:=0.${shell date +"%G%m%d"}
18 UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc-$(UCLIBC_VER)
19 UCLIBC_SOURCE:=uClibc-$(UCLIBC_VER).tar.bz2
20 UCLIBC_SITE:=http://www.uclibc.org/downloads
23 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
25 -e 's/sparc.*/sparc/' \
28 -e 's/ppc/powerpc/g' \
29 -e 's/v850.*/v850/g' \
31 -e 's/sh[234].*/sh/' \
33 -e 's/mipsel.*/mips/' \
38 $(DL_DIR)/$(UCLIBC_SOURCE):
40 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(UCLIBC_SOURCE) x $(UCLIBC_SITE)
42 $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE)
43 mkdir -p $(TOOL_BUILD_DIR)
44 bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
45 $(PATCH) $(UCLIBC_DIR) ./patches
46 touch $(UCLIBC_DIR)/.unpacked
48 $(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked
49 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(UCLIBC_DIR)/Rules.mak
50 $(CP) ./files/config.$(ARCH) $(UCLIBC_DIR)/.config
51 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
53 ifeq ($(BR2_LARGEFILE),y)
54 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(UCLIBC_DIR)/.config
56 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(UCLIBC_DIR)/.config
58 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.config
59 ifeq ($(BR2_SOFT_FLOAT),y)
60 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(UCLIBC_DIR)/.config
62 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/include
63 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/lib
64 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/lib
65 $(MAKE1) -C $(UCLIBC_DIR) \
66 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
68 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
70 CPU_CFLAGS="$(TARGET_CFLAGS)" \
72 touch $(UCLIBC_DIR)/.configured
74 $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(LIBFLOAT_TARGET)
75 $(MAKE1) -C $(UCLIBC_DIR) \
80 CPU_CFLAGS="$(TARGET_CFLAGS)" \
82 touch -c $(UCLIBC_DIR)/lib/libc.a
84 $(STAGING_DIR)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
85 $(MAKE1) -C $(UCLIBC_DIR) \
86 PREFIX=$(STAGING_DIR)/ \
90 $(MAKE1) -C $(UCLIBC_DIR) \
91 PREFIX=$(STAGING_DIR)/ \
95 echo $(UCLIBC_VER) > $(STAGING_DIR)/uclibc_version
96 touch -c $(STAGING_DIR)/lib/libc.a
98 source: $(DL_DIR)/$(UCLIBC_SOURCE)
99 prepare: $(UCLIBC_DIR)/.configured
100 compile: $(UCLIBC_DIR)/lib/libc.a
101 install: $(STAGING_DIR)/lib/libc.a $(UCLIBC_TARGETS)
103 rm -rf $(UCLIBC_DIR) $(TOOL_BUILD_DIR)/uClibc_dev