prepare for multiple target arch
[openwrt.git] / openwrt / toolchain / uClibc / Makefile
1 include $(TOPDIR)/rules.mk
2
3 #############################################################
4 #
5 # uClibc (the C library)
6 #
7 #############################################################
8
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
13 #"
14 UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots
15 UCLIBC_VER:=PKG_VERSION:=0.${shell date +"%G%m%d"}
16 else
17 UCLIBC_VER:=0.9.27
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 endif
22
23 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
24 -e 's/i.86/i386/' \
25 -e 's/sparc.*/sparc/' \
26 -e 's/arm.*/arm/g' \
27 -e 's/m68k.*/m68k/' \
28 -e 's/ppc/powerpc/g' \
29 -e 's/v850.*/v850/g' \
30 -e 's/sh64/sh/' \
31 -e 's/sh[234].*/sh/' \
32 -e 's/mips.*/mips/' \
33 -e 's/mipsel.*/mips/' \
34 -e 's/cris.*/cris/' \
35 )
36
37
38 $(DL_DIR)/$(UCLIBC_SOURCE):
39 mkdir -p $(DL_DIR)
40 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(UCLIBC_SOURCE) x $(UCLIBC_SITE)
41
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
47
48 $(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked
49 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(UCLIBC_DIR)/Rules.mak
50 cp ./uclibc.config $(UCLIBC_DIR)/.config
51 $(SED) 's,^.*TARGET_$(UCLIBC_TARGET_ARCH).*,TARGET_$(UCLIBC_TARGET_ARCH)=y,g' \
52 $(UCLIBC_DIR)/.config
53 $(SED) 's,^TARGET_ARCH.*,TARGET_ARCH=\"$(UCLIBC_TARGET_ARCH)\",g' $(UCLIBC_DIR)/.config
54 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
55 $(UCLIBC_DIR)/.config
56 $(SED) 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \
57 $(UCLIBC_DIR)/.config
58 $(SED) 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \
59 $(UCLIBC_DIR)/.config
60 $(SED) 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \
61 $(UCLIBC_DIR)/.config
62 ifeq ($(BR2_LARGEFILE),y)
63 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(UCLIBC_DIR)/.config
64 else
65 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(UCLIBC_DIR)/.config
66 endif
67 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.config
68 ifeq ($(BR2_SOFT_FLOAT),y)
69 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(UCLIBC_DIR)/.config
70 endif
71 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/include
72 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/lib
73 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/lib
74 $(MAKE1) -C $(UCLIBC_DIR) \
75 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
76 DEVEL_PREFIX=/usr/ \
77 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
78 HOSTCC="$(HOSTCC)" \
79 pregen install_dev;
80 touch $(UCLIBC_DIR)/.configured
81
82 $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(LIBFLOAT_TARGET)
83 $(MAKE1) -C $(UCLIBC_DIR) \
84 PREFIX= \
85 DEVEL_PREFIX=/ \
86 RUNTIME_PREFIX=/ \
87 HOSTCC="$(HOSTCC)" \
88 all
89 touch -c $(UCLIBC_DIR)/lib/libc.a
90
91 $(STAGING_DIR)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
92 $(MAKE1) -C $(UCLIBC_DIR) \
93 PREFIX=$(STAGING_DIR)/ \
94 DEVEL_PREFIX=/ \
95 RUNTIME_PREFIX=/ \
96 install_runtime
97 $(MAKE1) -C $(UCLIBC_DIR) \
98 PREFIX=$(STAGING_DIR)/ \
99 DEVEL_PREFIX=/ \
100 RUNTIME_PREFIX=/ \
101 install_dev
102 echo $(UCLIBC_VER) > $(STAGING_DIR)/uclibc_version
103 touch -c $(STAGING_DIR)/lib/libc.a
104
105 source: $(DL_DIR)/$(UCLIBC_SOURCE)
106 prepare: $(UCLIBC_DIR)/.configured
107 compile: $(UCLIBC_DIR)/lib/libc.a
108 install: $(STAGING_DIR)/lib/libc.a $(UCLIBC_TARGETS)
109 clean:
110 rm -rf $(UCLIBC_DIR) $(TOOL_BUILD_DIR)/uClibc_dev
This page took 0.053634 seconds and 5 git commands to generate.