aa45e638562583353af0627d6e1c778928ad96ea
[openwrt.git] / obsolete-buildroot / make / uclibc.mk
1 #############################################################
2 #
3 # uClibc (the C library)
4 #
5 #############################################################
6 ifneq ($(strip $(USE_UCLIBC_SNAPSHOT)),)
7 # Be aware that this changes daily....
8 UCLIBC_DIR:=$(BUILD_DIR)/uClibc
9 UCLIBC_SOURCE:=uClibc-$(strip $(USE_UCLIBC_SNAPSHOT)).tar.bz2
10 UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots
11 else
12 UCLIBC_DIR:=$(BUILD_DIR)/uClibc-0.9.26
13 UCLIBC_SOURCE:=uClibc-0.9.26.tar.bz2
14 UCLIBC_SITE:=http://www.uclibc.org/downloads
15 endif
16
17 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
18 -e 's/i.86/i386/' \
19 -e 's/sparc.*/sparc/' \
20 -e 's/arm.*/arm/g' \
21 -e 's/m68k.*/m68k/' \
22 -e 's/ppc/powerpc/g' \
23 -e 's/v850.*/v850/g' \
24 -e 's/sh64/sh/' \
25 -e 's/sh[234]/sh/' \
26 -e 's/mips.*/mips/' \
27 -e 's/mipsel.*/mips/' \
28 -e 's/cris.*/cris/' \
29 )
30
31
32 $(DL_DIR)/$(UCLIBC_SOURCE):
33 $(WGET) -P $(DL_DIR) $(UCLIBC_SITE)/$(UCLIBC_SOURCE)
34
35 $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE)
36 ifeq ($(SOFT_FLOAT),true)
37 # Make sure we have a soft float specs file for this arch
38 if [ ! -f $(SOURCE_DIR)/specs-$(ARCH)-soft-float ] ; then \
39 echo soft float configured but no specs file for this arch ; \
40 /bin/false ; \
41 fi;
42 endif
43 bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(BUILD_DIR) -xvf -
44 #(cd $(BUILD_DIR) ; ln -s $(DL_DIR)/uClibc)
45 #-mkdir $(UCLIBC_DIR)
46 #(cd $(DL_DIR)/uClibc && tar cf - .) | (cd $(UCLIBC_DIR) && tar xvfp - )
47 ifeq ($(strip $(USE_UCLIBC_LDSO_0_9_24)),true)
48 $(SOURCE_DIR)/patch-kernel.sh $(UCLIBC_DIR) $(SOURCE_DIR) uClibc-ldso-0.9.24.patch
49 endif
50 $(SOURCE_DIR)/patch-kernel.sh $(UCLIBC_DIR) $(SOURCE_DIR) uClibc-ftruncate.patch
51 touch $(UCLIBC_DIR)/.unpacked
52
53 $(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked $(LINUX_DIR)/.configured
54 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(UCLIBC_DIR)/Rules.mak
55 ifeq ($(ENABLE_LOCALE),true)
56 cp $(SOURCE_DIR)/uClibc.config-locale $(UCLIBC_DIR)/.config
57 else
58 cp $(SOURCE_DIR)/uClibc.config $(UCLIBC_DIR)/.config
59 endif
60 $(SED) 's,^.*TARGET_$(UCLIBC_TARGET_ARCH).*,TARGET_$(UCLIBC_TARGET_ARCH)=y,g' \
61 $(UCLIBC_DIR)/.config
62 $(SED) 's,^TARGET_ARCH.*,TARGET_ARCH=\"$(UCLIBC_TARGET_ARCH)\",g' $(UCLIBC_DIR)/.config
63 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_DIR)\",g' \
64 $(UCLIBC_DIR)/.config
65 $(SED) 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \
66 $(UCLIBC_DIR)/.config
67 $(SED) 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \
68 $(UCLIBC_DIR)/.config
69 $(SED) 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \
70 $(UCLIBC_DIR)/.config
71 ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true)
72 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(UCLIBC_DIR)/.config
73 else
74 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(UCLIBC_DIR)/.config
75 endif
76 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.config
77 ifeq ($(strip $(SOFT_FLOAT)),true)
78 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(UCLIBC_DIR)/.config
79 endif
80 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/include
81 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/lib
82 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/lib
83 $(MAKE) -C $(UCLIBC_DIR) \
84 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
85 DEVEL_PREFIX=/usr/ \
86 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
87 HOSTCC="$(HOSTCC)" \
88 pregen install_dev;
89 touch $(UCLIBC_DIR)/.configured
90
91 $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(LIBFLOAT_TARGET)
92 $(MAKE) -C $(UCLIBC_DIR) \
93 PREFIX= \
94 DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \
95 RUNTIME_PREFIX=/ \
96 HOSTCC="$(HOSTCC)" \
97 all
98 ifeq ($(strip $(USE_UCLIBC_LDSO_0_9_24)),true)
99 #rm -rf $(UCLIBC_DIR)/ld-uClibc* $(UCLIBC_DIR)/libdl*
100 $(MAKE) -C $(UCLIBC_DIR)/ldso-0.9.24 \
101 PREFIX= \
102 DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \
103 RUNTIME_PREFIX=/ \
104 HOSTCC="$(HOSTCC)" \
105 all shared
106 endif
107
108 $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
109 $(MAKE) -C $(UCLIBC_DIR) \
110 PREFIX=$(STAGING_DIR)/ \
111 DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \
112 RUNTIME_PREFIX=$(REAL_GNU_TARGET_NAME)/ \
113 install_runtime
114 $(MAKE) -C $(UCLIBC_DIR) \
115 PREFIX=$(STAGING_DIR)/ \
116 DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \
117 RUNTIME_PREFIX=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/ \
118 install_dev
119 $(MAKE) -C $(UCLIBC_DIR) \
120 PREFIX=$(STAGING_DIR) \
121 HOSTCC="$(HOSTCC)" \
122 utils install_utils
123 # Clean up the host compiled utils...
124 $(MAKE) -C $(UCLIBC_DIR)/utils clean
125
126 ifneq ($(TARGET_DIR),)
127 $(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a
128 $(MAKE) -C $(UCLIBC_DIR) \
129 PREFIX=$(TARGET_DIR) \
130 DEVEL_PREFIX=/usr/ \
131 RUNTIME_PREFIX=/ \
132 install_runtime
133
134 $(TARGET_DIR)/usr/bin/ldd: $(TARGET_DIR)/lib/libc.so.0
135 $(MAKE) -C $(UCLIBC_DIR) $(TARGET_CONFIGURE_OPTS) \
136 PREFIX=$(TARGET_DIR) utils install_utils
137
138 UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0 $(TARGET_DIR)/usr/bin/ldd
139 endif
140
141 uclibc-configured: $(UCLIBC_DIR)/.configured
142
143 uclibc: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a \
144 $(UCLIBC_TARGETS)
145
146 uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE)
147
148 uclibc-configured-source: uclibc-source
149
150 uclibc-clean:
151 -$(MAKE) -C $(UCLIBC_DIR) clean
152 rm -f $(UCLIBC_DIR)/.config
153
154 uclibc-dirclean:
155 rm -rf $(UCLIBC_DIR)
156
157
158
159
160 #############################################################
161 #
162 # uClibc for the target just needs its header files
163 # and whatnot installed.
164 #
165 #############################################################
166
167 $(TARGET_DIR)/usr/lib/libc.a: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a
168 $(MAKE) -C $(UCLIBC_DIR) \
169 PREFIX=$(TARGET_DIR) \
170 DEVEL_PREFIX=/usr/ \
171 RUNTIME_PREFIX=/ \
172 install_dev
173
174 ifeq ($(GCC_2_95_TOOLCHAIN),true)
175 uclibc_target: gcc2_95 uclibc $(TARGET_DIR)/usr/lib/libc.a
176 else
177 uclibc_target: gcc3_3 uclibc $(TARGET_DIR)/usr/lib/libc.a
178 endif
179
180 uclibc_target-clean:
181 rm -f $(TARGET_DIR)/include
182
183 uclibc_target-dirclean:
184 rm -f $(TARGET_DIR)/include
185
This page took 0.054713 seconds and 3 git commands to generate.