mount /proc earlier in /sbin/mount_root
[openwrt.git] / toolchain / uClibc / Makefile
1 include $(TOPDIR)/rules.mk
2
3 #############################################################
4 #
5 # uClibc (the C library)
6 #
7 #############################################################
8
9 ifeq ($(CONFIG_UCLIBC_VERSION_SNAPSHOT),y)
10 # Be aware that this changes daily....
11 UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc
12 UCLIBC_SOURCE:=uClibc-$(strip $(subst ",, $(CONFIG_USE_UCLIBC_SNAPSHOT))).tar.bz2#"))
13 UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots
14 UCLIBC_VER:=PKG_VERSION:=0.${shell date +"%G%m%d"}
15 UCLIBC_MD5SUM:=x
16 else
17 UCLIBC_VER:=0.9.28
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
21 UCLIBC_MD5SUM:=1ada58d919a82561061e4741fb6abd29
22 endif
23
24 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
25 -e 's/i.86/i386/' \
26 -e 's/sparc.*/sparc/' \
27 -e 's/arm.*/arm/g' \
28 -e 's/m68k.*/m68k/' \
29 -e 's/ppc/powerpc/g' \
30 -e 's/v850.*/v850/g' \
31 -e 's/sh64/sh/' \
32 -e 's/sh[234].*/sh/' \
33 -e 's/mips.*/mips/' \
34 -e 's/mipsel.*/mips/' \
35 -e 's/cris.*/cris/' \
36 )
37
38
39 $(DL_DIR)/$(UCLIBC_SOURCE):
40 mkdir -p $(DL_DIR)
41 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(UCLIBC_SOURCE) $(UCLIBC_MD5SUM) $(UCLIBC_SITE)
42
43 $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE)
44 mkdir -p $(TOOL_BUILD_DIR)
45 bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
46 $(PATCH) $(UCLIBC_DIR) ./patches
47 touch $(UCLIBC_DIR)/.unpacked
48
49 $(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked
50 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(UCLIBC_DIR)/Rules.mak
51 $(CP) ./files/config.$(ARCH) $(UCLIBC_DIR)/.config
52 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
53 $(UCLIBC_DIR)/.config
54 ifeq ($(CONFIG_LARGEFILE),y)
55 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(UCLIBC_DIR)/.config
56 else
57 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(UCLIBC_DIR)/.config
58 endif
59 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.config
60 ifeq ($(CONFIG_SOFT_FLOAT),y)
61 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(UCLIBC_DIR)/.config
62 endif
63 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/include
64 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/lib
65 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/lib
66 $(MAKE) -C $(UCLIBC_DIR) \
67 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
68 DEVEL_PREFIX=/usr/ \
69 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
70 HOSTCC="$(HOSTCC)" \
71 CPU_CFLAGS="$(TARGET_CFLAGS)" \
72 pregen install_dev;
73 touch $(UCLIBC_DIR)/.configured
74
75 $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(LIBFLOAT_TARGET)
76 $(MAKE) -C $(UCLIBC_DIR) \
77 PREFIX= \
78 DEVEL_PREFIX=/ \
79 RUNTIME_PREFIX=/ \
80 HOSTCC="$(HOSTCC)" \
81 CPU_CFLAGS="$(TARGET_CFLAGS)" \
82 all
83 touch -c $(UCLIBC_DIR)/lib/libc.a
84
85 $(STAGING_DIR)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
86 $(MAKE) -C $(UCLIBC_DIR) \
87 PREFIX=$(STAGING_DIR)/ \
88 DEVEL_PREFIX=/ \
89 RUNTIME_PREFIX=/ \
90 install_runtime
91 $(MAKE) -C $(UCLIBC_DIR) \
92 PREFIX=$(STAGING_DIR)/ \
93 DEVEL_PREFIX=/ \
94 RUNTIME_PREFIX=/ \
95 install_dev
96 echo $(UCLIBC_VER) > $(STAGING_DIR)/uclibc_version
97 touch -c $(STAGING_DIR)/lib/libc.a
98
99 source: $(DL_DIR)/$(UCLIBC_SOURCE)
100 prepare: $(UCLIBC_DIR)/.configured
101 compile: $(UCLIBC_DIR)/lib/libc.a
102 install: $(STAGING_DIR)/lib/libc.a $(UCLIBC_TARGETS)
103 clean: FORCE
104 rm -rf $(UCLIBC_DIR) $(TOOL_BUILD_DIR)/uClibc_dev
This page took 0.085504 seconds and 5 git commands to generate.