5b4e0c6a02daff5a5c498a2d277eb628ca15aad5
[buildroot.git] / toolchain / uClibc / uclibc.mk
1 #############################################################
2 #
3 # uClibc (the C library)
4 #
5 #############################################################
6
7 ifeq ($(BR2_TOOLCHAIN_SOURCE)$(BR2_LIBC_FLAVOUR_uclibc),yy)
8
9 UCLIBC_SITE:=http://www.uclibc.org/downloads
10 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_SOURCE),y)
11 UCLIBC_SITE:=$(VENDOR_SITE)
12 endif
13
14 # specifying UCLIBC_CONFIG_FILE on the command-line overrides the .config
15 # setting.
16 ifndef UCLIBC_CONFIG_FILE
17 UCLIBC_CONFIG_FILE=$(subst ",, $(BR2_UCLIBC_CONFIG))
18 #")
19 endif
20
21 UCLIBC_VER:=$(subst ",,$(BR2_UCLIBC_VERSION_STRING))
22 #")
23 ifeq ($(BR2_UCLIBC_VERSION_SNAPSHOT),y)
24 UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc
25 UCLIBC_SOURCE:=uClibc-$(UCLIBC_VER).tar.bz2
26 UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots
27 UCLIBC_PATCH_DIR:=toolchain/uClibc/
28 endif
29
30 UCLIBC_OFFICIAL_VERSION:=$(UCLIBC_VER)$(VENDOR_SUFFIX)$(VENDOR_UCLIBC_RELEASE)
31
32 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
33 UCLIBC_PATCH_DIR:=toolchain/uClibc/
34 else
35 UCLIBC_PATCH_DIR:=$(VENDOR_PATCH_DIR)/uClibc-$(UCLIBC_OFFICIAL_VERSION)
36 endif
37
38 ifneq ($(BR2_UCLIBC_VERSION_SNAPSHOT),y)
39 UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc-$(UCLIBC_OFFICIAL_VERSION)
40 endif
41
42 UCLIBC_SOURCE:=uClibc-$(UCLIBC_OFFICIAL_VERSION).tar.bz2
43 UCLIBC_CAT:=$(BZCAT)
44
45 UCLIBC_TARGET_ARCH:=$(shell $(SHELL) -c "echo $(ARCH) | sed \
46 -e 's/-.*//' \
47 -e 's/i.86/i386/' \
48 -e 's/sparc.*/sparc/' \
49 -e 's/arm.*/arm/g' \
50 -e 's/bfin.*/bfin/g' \
51 -e 's/m68k.*/m68k/' \
52 -e 's/ppc/powerpc/g' \
53 -e 's/v850.*/v850/g' \
54 -e 's/sh[234].*/sh/' \
55 -e 's/mips.*/mips/' \
56 -e 's/mipsel.*/mips/' \
57 -e 's/cris.*/cris/' \
58 -e 's/nios2.*/nios2/' \
59 ")
60 # just handle the ones that can be big or little
61 UCLIBC_TARGET_ENDIAN:=$(shell $(SHELL) -c "echo $(ARCH) | sed \
62 -e 's/armeb/BIG/' \
63 -e 's/arm/LITTLE/' \
64 -e 's/mipsel/LITTLE/' \
65 -e 's/mips/BIG/' \
66 -e 's/sh[234].*eb/BIG/' \
67 -e 's/sh[234]/LITTLE/' \
68 -e 's/sparc.*/BIG/' \
69 ")
70
71 ifneq ($(UCLIBC_TARGET_ENDIAN),LITTLE)
72 ifneq ($(UCLIBC_TARGET_ENDIAN),BIG)
73 UCLIBC_TARGET_ENDIAN:=
74 endif
75 endif
76 ifeq ($(UCLIBC_TARGET_ENDIAN),LITTLE)
77 UCLIBC_NOT_TARGET_ENDIAN:=BIG
78 else
79 UCLIBC_NOT_TARGET_ENDIAN:=LITTLE
80 endif
81
82 UCLIBC_ARM_TYPE:=CONFIG_$(subst ",, $(BR2_ARM_TYPE))
83 #")
84 UCLIBC_SPARC_TYPE:=CONFIG_SPARC_$(subst ",, $(BR2_SPARC_TYPE))
85 #")
86
87 ifeq ($(BR2_GCC_USE_INTERWORKING),y)
88 __UCLIBC_EXTRA_TARGET_CFLAGS+=-mthumb-interwork
89 endif
90
91 $(DL_DIR)/$(UCLIBC_SOURCE):
92 $(WGET) -P $(DL_DIR) $(UCLIBC_SITE)/$(UCLIBC_SOURCE)
93
94 ifeq ($(BR2_ENABLE_LOCALE_PREGENERATED),y)
95 UCLIBC_SITE_LOCALE:=http://www.uclibc.org/downloads
96 UCLIBC_SOURCE_LOCALE:=uClibc-locale-030818.tgz
97
98 $(DL_DIR)/$(UCLIBC_SOURCE_LOCALE):
99 $(WGET) -P $(DL_DIR) $(UCLIBC_SITE_LOCALE)/$(UCLIBC_SOURCE_LOCALE)
100
101 UCLIBC_LOCALE_DATA:=$(DL_DIR)/$(UCLIBC_SOURCE_LOCALE)
102 else
103 UCLIBC_LOCALE_DATA=
104 endif
105
106 $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) $(UCLIBC_LOCALE_DATA)
107 mkdir -p $(TOOL_BUILD_DIR)
108 rm -rf $(UCLIBC_DIR)
109 $(UCLIBC_CAT) $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
110 ifneq ($(BR2_UCLIBC_VERSION_SNAPSHOT),y)
111 toolchain/patch-kernel.sh $(UCLIBC_DIR) $(UCLIBC_PATCH_DIR) uClibc-$(UCLIBC_OFFICIAL_VERSION)-\*.patch
112 else
113 toolchain/patch-kernel.sh $(UCLIBC_DIR) $(UCLIBC_PATCH_DIR) uClibc.\*.patch
114 endif
115 ifeq ($(BR2_ENABLE_LOCALE_PREGENERATED),y)
116 cp -dpf $(DL_DIR)/$(UCLIBC_SOURCE_LOCALE) $(UCLIBC_DIR)/extra/locale/
117 endif
118 touch $@
119
120 UCLIBC_CONFIGURED_PREREQ:=$(wildcard $(BR2_DEPENDS_DIR)/br2/arch.h*) \
121 $(wildcard $(BR2_DEPENDS_DIR)/br2/endian.h*) \
122 $(wildcard $(BR2_DEPENDS_DIR)/br2/$(UCLIBC_TARGET_ARCH).h*) \
123 $(wildcard $(BR2_DEPENDS_DIR)/br2/pthreads.h*) \
124 $(wildcard $(BR2_DEPENDS_DIR)/br2/$(UCLIBC_TARGET_ARCH)/*.h) \
125 $(wildcard $(BR2_DEPENDS_DIR)/br2/pthread*/*.h) \
126 $(wildcard $(BR2_DEPENDS_DIR)/br2/enable/*locale*.h) \
127 $(wildcard $(BR2_DEPENDS_DIR)/br2/enable/*locale*.h) \
128 $(wildcard $(BR2_DEPENDS_DIR)/br2/use/*wchar*.h) \
129 $(wildcard $(BR2_DEPENDS_DIR)/br2/use/*updates*.h) \
130 $(wildcard $(BR2_DEPENDS_DIR)/br2/uclibc/*.h) \
131 $(wildcard $(BR2_DEPENDS_DIR)/br2/uclibc/*/*.h)
132
133 # Some targets may wish to provide their own UCLIBC_CONFIG_FILE...
134 $(UCLIBC_DIR)/.oldconfig: $(UCLIBC_DIR)/.unpacked $(UCLIBC_CONFIG_FILE) $(UCLIBC_CONFIGURED_PREREQ)
135 ifeq ($(BR2_USE_UPDATES),y)
136 (cd $(@D) && $(SVN_UP))
137 endif
138 cp -f $(UCLIBC_CONFIG_FILE) $(UCLIBC_DIR)/.oldconfig
139 $(SED) 's,^CROSS_COMPILER_PREFIX=.*,CROSS_COMPILER_PREFIX="$(TARGET_CROSS)",g' \
140 -e 's,# TARGET_$(UCLIBC_TARGET_ARCH) is not set,TARGET_$(UCLIBC_TARGET_ARCH)=y,g' \
141 -e 's,^TARGET_ARCH=".*",TARGET_ARCH=\"$(UCLIBC_TARGET_ARCH)\",g' \
142 -e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
143 -e 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(LINUX_HEADERS_DIR)/include\",g' \
144 -e 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \
145 -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \
146 -e 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \
147 $(UCLIBC_DIR)/.oldconfig
148 ifeq ($(UCLIBC_TARGET_ARCH),arm)
149 $(SED) 's/^\(CONFIG_[^_]*[_]*ARM[^=]*\)=.*/# \1 is not set/g' \
150 $(UCLIBC_DIR)/.oldconfig
151 $(SED) 's/^.*$(UCLIBC_ARM_TYPE).*/$(UCLIBC_ARM_TYPE)=y/g' $(UCLIBC_DIR)/.oldconfig
152 $(SED) '/CONFIG_ARM_.ABI/d' $(UCLIBC_DIR)/.oldconfig
153 ifeq ($(BR2_ARM_EABI),y)
154 /bin/echo "# CONFIG_ARM_OABI is not set" >> $(UCLIBC_DIR)/.oldconfig
155 /bin/echo "CONFIG_ARM_EABI=y" >> $(UCLIBC_DIR)/.oldconfig
156 endif
157 ifeq ($(BR2_ARM_OABI),y)
158 /bin/echo "CONFIG_ARM_OABI=y" >> $(UCLIBC_DIR)/.oldconfig
159 /bin/echo "# CONFIG_ARM_EABI is not set" >> $(UCLIBC_DIR)/.oldconfig
160 endif
161 endif
162 ifeq ($(UCLIBC_TARGET_ARCH),mips)
163 $(SED) '/CONFIG_MIPS_[NO].._ABI/d' $(UCLIBC_DIR)/.oldconfig
164 $(SED) '/CONFIG_MIPS_ISA_.*/d' $(UCLIBC_DIR)/.oldconfig
165 (/bin/echo "# CONFIG_MIPS_O32_ABI is not set"; \
166 /bin/echo "# CONFIG_MIPS_N32_ABI is not set"; \
167 /bin/echo "# CONFIG_MIPS_N64_ABI is not set"; \
168 /bin/echo "# CONFIG_MIPS_ISA_1 is not set"; \
169 /bin/echo "# CONFIG_MIPS_ISA_2 is not set"; \
170 /bin/echo "# CONFIG_MIPS_ISA_3 is not set"; \
171 /bin/echo "# CONFIG_MIPS_ISA_4 is not set"; \
172 /bin/echo "# CONFIG_MIPS_ISA_MIPS32 is not set"; \
173 /bin/echo "# CONFIG_MIPS_ISA_MIPS32R2 is not set"; \
174 /bin/echo "# CONFIG_MIPS_ISA_MIPS64 is not set"; \
175 ) >> $(UCLIBC_DIR)/.oldconfig
176 ifeq ($(BR2_MIPS_OABI32),y)
177 $(SED) 's/.*\(CONFIG_MIPS_O32_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
178 endif
179 ifeq ($(findstring y,$(BR2_MIPS_EABI)$(BR2_MIPS_ABI32)),y)
180 $(SED) 's/.*\(CONFIG_MIPS_N32_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
181 endif
182 ifeq ($(findstring y,$(BR2_MIPS_ABI64)$(BR2_MIPS_OABI64)),y)
183 $(SED) 's/.*\(CONFIG_MIPS_N64_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
184 endif
185 ifeq ($(BR2_mips_1),y)
186 $(SED) 's/.*\(CONFIG_MIPS_ISA_1\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
187 endif
188 ifeq ($(BR2_mips_2),y)
189 $(SED) 's/.*\(CONFIG_MIPS_ISA_2\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
190 endif
191 ifeq ($(BR2_mips_3),y)
192 $(SED) 's/.*\(CONFIG_MIPS_ISA_3\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
193 endif
194 ifeq ($(BR2_mips_4),y)
195 $(SED) 's/.*\(CONFIG_MIPS_ISA_4\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
196 endif
197 ifeq ($(BR2_mips_32),y)
198 $(SED) 's/.*\(CONFIG_MIPS_ISA_MIPS32\)[^R].*/\1=y/' $(UCLIBC_DIR)/.oldconfig
199 endif
200 ifeq ($(BR2_mips_32r2),y)
201 $(SED) 's/.*\(CONFIG_MIPS_ISA_MIPS32R2\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
202 endif
203 ifeq ($(BR2_mips_64),y)
204 $(SED) 's/.*\(CONFIG_MIPS_ISA_MIPS64\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
205 endif
206 endif
207 ifeq ($(UCLIBC_TARGET_ARCH),nios2)
208 $(SED) '/UCLIBC_FORMAT_/d' $(UCLIBC_DIR)/.oldconfig
209 /bin/echo "# UCLIBC_FORMAT_FDPIC_ELF is not set" >> $(UCLIBC_DIR)/.oldconfig
210 /bin/echo "UCLIBC_FORMAT_FLAT=y" >> $(UCLIBC_DIR)/.oldconfig
211 /bin/echo "# UCLIBC_FORMAT_FLAT_SEP_DATA is not set" >> $(UCLIBC_DIR)/.oldconfig
212 /bin/echo "# UCLIBC_FORMAT_SHARED_FLAT is not set" >> $(UCLIBC_DIR)/.oldconfig
213 endif
214 ifeq ($(UCLIBC_TARGET_ARCH),sh)
215 /bin/echo "# CONFIG_SH2A is not set" >> $(UCLIBC_DIR)/.oldconfig
216 /bin/echo "# CONFIG_SH2 is not set" >> $(UCLIBC_DIR)/.oldconfig
217 /bin/echo "# CONFIG_SH3 is not set" >> $(UCLIBC_DIR)/.oldconfig
218 /bin/echo "# CONFIG_SH4 is not set" >> $(UCLIBC_DIR)/.oldconfig
219 ifeq ($(BR2_sh2a_nofpueb),y)
220 $(SED) '/UCLIBC_FORMAT_/d' $(UCLIBC_DIR)/.oldconfig
221 $(SED) 's,# CONFIG_SH2A is not set,CONFIG_SH2A=y,g' $(UCLIBC_DIR)/.oldconfig
222 /bin/echo "# UCLIBC_FORMAT_FDPIC_ELF is not set" >> $(UCLIBC_DIR)/.oldconfig
223 /bin/echo "# UCLIBC_FORMAT_FLAT is not set" >> $(UCLIBC_DIR)/.oldconfig
224 /bin/echo "# UCLIBC_FORMAT_FLAT_SEP_DATA is not set" >> $(UCLIBC_DIR)/.oldconfig
225 /bin/echo "# UCLIBC_FORMAT_SHARED_FLAT is not set" >> $(UCLIBC_DIR)/.oldconfig
226 endif
227 ifeq ($(BR2_sh2eb),y)
228 $(SED) '/UCLIBC_FORMAT_/d' $(UCLIBC_DIR)/.oldconfig
229 $(SED) 's,# CONFIG_SH2 is not set,CONFIG_SH2=y,g' $(UCLIBC_DIR)/.oldconfig
230 /bin/echo "# UCLIBC_FORMAT_FDPIC_ELF is not set" >> $(UCLIBC_DIR)/.oldconfig
231 /bin/echo "# UCLIBC_FORMAT_FLAT is not set" >> $(UCLIBC_DIR)/.oldconfig
232 /bin/echo "# UCLIBC_FORMAT_FLAT_SEP_DATA is not set" >> $(UCLIBC_DIR)/.oldconfig
233 /bin/echo "# UCLIBC_FORMAT_SHARED_FLAT is not set" >> $(UCLIBC_DIR)/.oldconfig
234 endif
235 ifeq ($(BR2_sh3eb),y)
236 $(SED) 's,# CONFIG_SH3 is not set,CONFIG_SH3=y,g' $(UCLIBC_DIR)/.oldconfig
237 endif
238 ifeq ($(BR2_sh3),y)
239 $(SED) 's,# CONFIG_SH3 is not set,CONFIG_SH3=y,g' $(UCLIBC_DIR)/.oldconfig
240 endif
241 ifeq ($(BR2_sh4eb),y)
242 $(SED) 's,# CONFIG_SH4 is not set,CONFIG_SH4=y,g' $(UCLIBC_DIR)/.oldconfig
243 endif
244 ifeq ($(BR2_sh4),y)
245 $(SED) 's,# CONFIG_SH4 is not set,CONFIG_SH4=y,g' $(UCLIBC_DIR)/.oldconfig
246 endif
247 endif
248 ifeq ($(UCLIBC_TARGET_ARCH),sparc)
249 $(SED) 's/^\(CONFIG_[^_]*[_]*SPARC[^=]*\)=.*/# \1 is not set/g' \
250 $(UCLIBC_DIR)/.oldconfig
251 for i in V7 V8 V9 V9B; do echo "# CONFIG_SPARC_$$i is not set"; done \
252 >> $(UCLIBC_DIR)/.oldconfig
253 $(SED) 's/^.*$(UCLIBC_SPARC_TYPE)[^B].*/$(UCLIBC_SPARC_TYPE)=y/g' $(UCLIBC_DIR)/.oldconfig
254 endif
255 ifeq ($(UCLIBC_TARGET_ARCH),bfin)
256 $(SED) 's/^\(UCLIBC_FORMAT_[^[:space:]]*\).*/# \1 is not set/g' $(UCLIBC_DIR)/.oldconfig
257 $(SED) '/UCLIBC_FORMAT_FDPIC_ELF/d' $(UCLIBC_DIR)/.oldconfig
258 echo 'UCLIBC_FORMAT_FDPIC_ELF=y' >> $(UCLIBC_DIR)/.oldconfig
259 endif
260 ifeq ($(BR2_cris),y)
261 $(SED) '/CONFIG_CRIS/d' $(UCLIBC_DIR)/.oldconfig
262 echo '# CONFIG_CRIS is not set' >> $(UCLIBC_DIR)/.oldconfig
263 echo '# CONFIG_CRISV32 is not set' >> $(UCLIBC_DIR)/.oldconfig
264 ifeq ($(BR2_cris_cris32),y)
265 $(SED) 's,^TARGET_ARCH=".*",TARGET_ARCH=\"crisv32\",g' \
266 -e 's,.*\(CONFIG_CRIS\) .*,\1=y,' $(UCLIBC_DIR)/.oldconfig
267 endif
268 ifeq ($(BR2_cris_cris),y)
269 $(SED) 's,^TARGET_ARCH=".*",TARGET_ARCH=\"cris\",g' \
270 -e 's,.*\(CONFIG_CRISV32\) .*,\1=y,' $(UCLIBC_DIR)/.oldconfig
271 endif
272 endif
273 ifneq ($(UCLIBC_TARGET_ENDIAN),)
274 $(SED) 's/.*ARCH_\(WANTS_\|\)\(LITTLE\|BIG\)_ENDIAN.*//' \
275 $(UCLIBC_DIR)/.oldconfig
276 echo '# ARCH_$(UCLIBC_NOT_TARGET_ENDIAN)_ENDIAN is not set' >> $(UCLIBC_DIR)/.oldconfig
277 echo '# ARCH_WANTS_$(UCLIBC_NOT_TARGET_ENDIAN)_ENDIAN is not set' >> $(UCLIBC_DIR)/.oldconfig
278 echo 'ARCH_WANTS_$(UCLIBC_TARGET_ENDIAN)_ENDIAN=y' >> $(UCLIBC_DIR)/.oldconfig
279 echo 'ARCH_$(UCLIBC_TARGET_ENDIAN)_ENDIAN=y' >> $(UCLIBC_DIR)/.oldconfig
280 endif
281 $(SED) '/ARCH_USE_MMU/d' $(UCLIBC_DIR)/.oldconfig
282 ifeq ($(BR2_USE_MMU),y)
283 echo 'ARCH_USE_MMU=y' >> $(UCLIBC_DIR)/.oldconfig
284 endif
285 ifeq ($(BR2_ENABLE_SHARED),y)
286 $(SED) 's/.*\(HAVE_SHARED\).*/\1=y/g' $(UCLIBC_DIR)/.oldconfig
287 else
288 $(SED) 's/.*\(HAVE_SHARED\).*/# \1 is not set/g' $(UCLIBC_DIR)/.oldconfig
289 endif
290 ifeq ($(BR2_LARGEFILE),y)
291 $(SED) 's,.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(UCLIBC_DIR)/.oldconfig
292 else
293 $(SED) 's,.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(UCLIBC_DIR)/.oldconfig
294 $(SED) '/.*UCLIBC_HAS_FOPEN_LARGEFILE_MODE.*/d' $(UCLIBC_DIR)/.oldconfig
295 echo "# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set" >> $(UCLIBC_DIR)/.oldconfig
296 endif
297 $(SED) '/UCLIBC_HAS_IPV6/d' $(UCLIBC_DIR)/.oldconfig
298 echo "# UCLIBC_HAS_IPV6 is not set" >> $(UCLIBC_DIR)/.oldconfig
299 ifeq ($(BR2_INET_IPV6),y)
300 $(SED) 's,^.*UCLIBC_HAS_IPV6.*,UCLIBC_HAS_IPV6=y,g' $(UCLIBC_DIR)/.oldconfig
301 else
302 $(SED) 's,^.*UCLIBC_HAS_IPV6.*,UCLIBC_HAS_IPV6=n,g' $(UCLIBC_DIR)/.oldconfig
303 endif
304 $(SED) '/UCLIBC_HAS_RPC/d' $(UCLIBC_DIR)/.oldconfig
305 echo "# UCLIBC_HAS_RPC is not set" >> $(UCLIBC_DIR)/.oldconfig
306 ifeq ($(BR2_INET_RPC),y)
307 $(SED) 's,^.*UCLIBC_HAS_RPC.*,UCLIBC_HAS_RPC=y,g' \
308 -e 's,^.*UCLIBC_HAS_FULL_RPC.*,UCLIBC_HAS_FULL_RPC=y,g' \
309 -e 's,^.*UCLIBC_HAS_REENTRANT_RPC.*,UCLIBC_HAS_REENTRANT_RPC=y,g' \
310 $(UCLIBC_DIR)/.oldconfig
311 else
312 $(SED) 's,^.*UCLIBC_HAS_RPC.*,UCLIBC_HAS_RPC=n,g' \
313 -e 's,^.*UCLIBC_HAS_FULL_RPC.*,UCLIBC_HAS_FULL_RPC=n,g' \
314 -e 's,^.*UCLIBC_HAS_REENTRANT_RPC.*,UCLIBC_HAS_REENTRANT_RPC=n,g' \
315 $(UCLIBC_DIR)/.oldconfig
316 endif
317 ifeq ($(BR2_SOFT_FLOAT),y)
318 $(SED) 's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=n,g' \
319 -e 's,^[^_]*HAS_FPU.*,HAS_FPU=n,g' \
320 -e 's,.*UCLIBC_HAS_FLOATS.*,UCLIBC_HAS_FLOATS=y,g' \
321 -e 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' \
322 $(UCLIBC_DIR)/.oldconfig
323 #$(SED) 's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=n\nHAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(UCLIBC_DIR)/.oldconfig
324 else
325 $(SED) '/UCLIBC_HAS_FLOATS/d' \
326 -e 's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=y\nHAS_FPU=y\nUCLIBC_HAS_FLOATS=y\n,g' \
327 $(UCLIBC_DIR)/.oldconfig
328 endif
329 $(SED) '/UCLIBC_HAS_THREADS/d' \
330 -e '/HAS_NO_THREADS/d' \
331 -e '/LINUXTHREADS/d' \
332 -e '/LINUXTHREADS_OLD/d' \
333 -e '/LINUXTHREADS_NEW/d' \
334 -e '/PTHREADS_DEBUG_SUPPORT/d' \
335 -e '/UCLIBC_HAS_THREADS_NATIVE/d' $(UCLIBC_DIR)/.oldconfig
336 ifeq ($(BR2_PTHREADS_NONE),y)
337 echo "# UCLIBC_HAS_THREADS is not set" >> $(UCLIBC_DIR)/.oldconfig
338 echo "HAS_NO_THREADS=y" >> $(UCLIBC_DIR)/.oldconfig
339 else
340 echo "UCLIBC_HAS_THREADS=y" >> $(UCLIBC_DIR)/.oldconfig
341 echo "# HAS_NO_THREADS is not set" >> $(UCLIBC_DIR)/.oldconfig
342 endif
343 ifeq ($(BR2_PTHREADS),y)
344 echo "LINUXTHREADS=y" >> $(UCLIBC_DIR)/.oldconfig
345 else
346 echo "# LINUXTHREADS is not set" >> $(UCLIBC_DIR)/.oldconfig
347 endif
348 ifeq ($(BR2_PTHREADS_OLD),y)
349 echo "LINUXTHREADS_OLD=y" >> $(UCLIBC_DIR)/.oldconfig
350 else
351 echo "# LINUXTHREADS_OLD is not set" >> $(UCLIBC_DIR)/.oldconfig
352 endif
353 ifeq ($(BR2_PTHREADS_NATIVE),y)
354 echo "UCLIBC_HAS_THREADS_NATIVE=y" >> $(UCLIBC_DIR)/.oldconfig
355 else
356 echo "# UCLIBC_HAS_THREADS_NATIVE is not set" >> $(UCLIBC_DIR)/.oldconfig
357 endif
358 ifeq ($(BR2_PTHREAD_DEBUG),y)
359 echo "PTHREADS_DEBUG_SUPPORT=y" >> $(UCLIBC_DIR)/.oldconfig
360 else
361 echo "# PTHREADS_DEBUG_SUPPORT is not set" >> $(UCLIBC_DIR)/.oldconfig
362 endif
363 ifeq ($(BR2_ENABLE_LOCALE),y)
364 ifeq ($(BR2_ENABLE_LOCALE_PREGENERATED),y)
365 $(SED) 's,^.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y\nUCLIBC_PREGENERATED_LOCALE_DATA=y\nUCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA=y\nUCLIBC_HAS_XLOCALE=y\nUCLIBC_HAS_GLIBC_DIGIT_GROUPING=n\n,g' $(UCLIBC_DIR)/.oldconfig
366 else
367 $(SED) 's,^.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y\nUCLIBC_PREGENERATED_LOCALE_DATA=n\nUCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA=n\nUCLIBC_HAS_XLOCALE=y\nUCLIBC_HAS_GLIBC_DIGIT_GROUPING=n\n,g' $(UCLIBC_DIR)/.oldconfig
368 endif
369 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.oldconfig
370 else
371 $(SED) 's,^.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=n,g' $(UCLIBC_DIR)/.oldconfig
372 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=n,g' $(UCLIBC_DIR)/.oldconfig
373 endif
374 ifeq ($(BR2_USE_WCHAR),y)
375 $(SED) 's,^.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.oldconfig
376 else
377 $(SED) 's,^.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=n,g' $(UCLIBC_DIR)/.oldconfig
378 endif
379 ifeq ($(BR2_UCLIBC_PROGRAM_INVOCATION),y)
380 $(SED) 's,^.*UCLIBC_HAS_PROGRAM_INVOCATION_NAME.*,UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y,g' $(UCLIBC_DIR)/.oldconfig
381 else
382 $(SED) 's,^.*UCLIBC_HAS_PROGRAM_INVOCATION_NAME.*,UCLIBC_HAS_PROGRAM_INVOCATION_NAME=n,g' $(UCLIBC_DIR)/.oldconfig
383 endif
384 ifeq ("$(KERNEL_ARCH)","i386")
385 $(SED) '/CONFIG_GENERIC_386/d' \
386 -e '/CONFIG_[0-9]86/d' \
387 -e '/CONFIG_[0-9]86MMX/d' \
388 -e '/CONFIG_PENTIUM.*/d' \
389 -e '/CONFIG_K[0-9]/d' \
390 -e '/CONFIG_ELAN/d' \
391 -e '/CONFIG_CRUSOE/d' \
392 -e '/CONFIG_WINCHIP*/d' \
393 -e '/CONFIG_CYRIX*/d' \
394 -e '/CONFIG_NEHEMIAH/d' $(UCLIBC_DIR)/.oldconfig
395 /bin/echo "# CONFIG_GENERIC_386 is not set" >> $(UCLIBC_DIR)/.oldconfig
396 /bin/echo "# CONFIG_386 is not set" >> $(UCLIBC_DIR)/.oldconfig
397 /bin/echo "# CONFIG_486 is not set" >> $(UCLIBC_DIR)/.oldconfig
398 /bin/echo "# CONFIG_586 is not set" >> $(UCLIBC_DIR)/.oldconfig
399 /bin/echo "# CONFIG_586MMX is not set" >> $(UCLIBC_DIR)/.oldconfig
400 /bin/echo "# CONFIG_686 is not set" >> $(UCLIBC_DIR)/.oldconfig
401 /bin/echo "# CONFIG_PENTIUMII is not set" >> $(UCLIBC_DIR)/.oldconfig
402 /bin/echo "# CONFIG_PENTIUMIII is not set" >> $(UCLIBC_DIR)/.oldconfig
403 /bin/echo "# CONFIG_PENTIUM4 is not set" >> $(UCLIBC_DIR)/.oldconfig
404 /bin/echo "# CONFIG_K6 is not set" >> $(UCLIBC_DIR)/.oldconfig
405 /bin/echo "# CONFIG_K7 is not set" >> $(UCLIBC_DIR)/.oldconfig
406 /bin/echo "# CONFIG_ELAN is not set" >> $(UCLIBC_DIR)/.oldconfig
407 /bin/echo "# CONFIG_CRUSOE is not set" >> $(UCLIBC_DIR)/.oldconfig
408 /bin/echo "# CONFIG_WINCHIPC6 is not set" >> $(UCLIBC_DIR)/.oldconfig
409 /bin/echo "# CONFIG_WINCHIP2 is not set" >> $(UCLIBC_DIR)/.oldconfig
410 /bin/echo "# CONFIG_CYRIXIII is not set" >> $(UCLIBC_DIR)/.oldconfig
411 /bin/echo "# CONFIG_NEHEMIAH is not set" >> $(UCLIBC_DIR)/.oldconfig
412 ifeq ($(BR2_x86_i386),y)
413 $(SED) 's,# CONFIG_386 is not set,CONFIG_386=y,g' $(UCLIBC_DIR)/.oldconfig
414 endif
415 ifeq ($(BR2_x86_i486),y)
416 $(SED) 's,# CONFIG_486 is not set,CONFIG_486=y,g' $(UCLIBC_DIR)/.oldconfig
417 endif
418 ifeq ($(BR2_x86_i586),y)
419 $(SED) 's,# CONFIG_586 is not set,CONFIG_586=y,g' $(UCLIBC_DIR)/.oldconfig
420 endif
421 ifeq ($(BR2_x86_i686),y)
422 $(SED) 's,# CONFIG_686 is not set,CONFIG_686=y,g' $(UCLIBC_DIR)/.oldconfig
423 endif
424 endif
425 $(SED) '/CONFIG_DOSTRIP/d' -e '/DOSTRIP/d' $(UCLIBC_DIR)/.oldconfig
426 /bin/echo "# DOSTRIP is not set" >> $(UCLIBC_DIR)/.oldconfig
427 ifneq ($(BR2_STRIP_none),y)
428 $(SED) 's/.*DOSTRIP.*/DOSTRIP=y/' $(UCLIBC_DIR)/.oldconfig
429 endif
430 ifeq ($(findstring y,$(BR2_GCC_CROSS_CXX)$(BR2_GCC_SHARED_LIBGCC)),y)
431 $(SED) 's/.*CONFIG_UCLIBC_CTOR_DTOR.*/CONFIG_UCLIBC_CTOR_DTOR=y/' $(UCLIBC_DIR)/.oldconfig
432 endif
433 $(SED) '/HAVE_NO_SSP/d' -e '/UCLIBC_HAS_SSP/d' \
434 -e '/UCLIBC_HAS_SSP_COMPAT/d' -e '/SSP_QUICK_CANARY/d' \
435 -e '/PROPOLICE_BLOCK_/d' -e '/UCLIBC_BUILD_SSP/d' $(UCLIBC_DIR)/.oldconfig
436 ifeq ($(BR2_ENABLE_SSP),y)
437 /bin/echo "# HAVE_NO_SSP is not set" >> $(UCLIBC_DIR)/.oldconfig
438 /bin/echo "UCLIBC_HAS_SSP=y" >> $(UCLIBC_DIR)/.oldconfig
439 /bin/echo "# UCLIBC_HAS_SSP_COMPAT is not set" >> $(UCLIBC_DIR)/.oldconfig
440 /bin/echo "# SSP_QUICK_CANARY is not set" >> $(UCLIBC_DIR)/.oldconfig
441 /bin/echo "PROPOLICE_BLOCK_ABRT=y" >> $(UCLIBC_DIR)/.oldconfig
442 /bin/echo "UCLIBC_BUILD_SSP=y" >> $(UCLIBC_DIR)/.oldconfig
443 else
444 /bin/echo "HAVE_NO_SSP=y" >> $(UCLIBC_DIR)/.oldconfig
445 /bin/echo "# UCLIBC_HAS_SSP is not set" >> $(UCLIBC_DIR)/.oldconfig
446 endif
447
448
449 $(UCLIBC_DIR)/.config: $(UCLIBC_DIR)/.oldconfig
450 cp -dpf $(UCLIBC_DIR)/.oldconfig $(UCLIBC_DIR)/.config
451 $(INSTALL) -d $(TOOL_BUILD_DIR)/uClibc_dev/usr/include \
452 $(TOOL_BUILD_DIR)/uClibc_dev/usr/lib \
453 $(TOOL_BUILD_DIR)/uClibc_dev/lib
454 $(MAKE1) -C $(UCLIBC_DIR) \
455 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
456 DEVEL_PREFIX=/usr/ \
457 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
458 HOSTCC="$(HOSTCC)" \
459 BUILD_CFLAGS="$(HOST_CFLAGS)" \
460 BUILD_LDFLAGS="$(HOST_LDFLAGS)" \
461 oldconfig
462 touch -c $@
463
464 $(UCLIBC_DIR)/.configured: $(LINUX_HEADERS_DIR)/.configured $(UCLIBC_DIR)/.config
465 ifeq ($(findstring y,$(BR2_UCLIBC_VERSION_0_9_27)$(BR2_UCLIBC_VERSION_0_9_28_3)$(BR2_UCLIBC_VERSION_0_9_29)),y)
466 # older uClibc without the signum.h generation fix
467 set -x && $(MAKE1) -C $(UCLIBC_DIR) \
468 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
469 DEVEL_PREFIX=/usr/ \
470 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
471 HOSTCC="$(HOSTCC)" \
472 BUILD_CFLAGS="$(HOST_CFLAGS)" \
473 BUILD_LDFLAGS="$(HOST_LDFLAGS)" \
474 UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
475 UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS) $(__UCLIBC_EXTRA_TARGET_CFLAGS)" \
476 pregen install_dev
477 else
478 set -x && $(MAKE) -C $(UCLIBC_DIR) \
479 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
480 DEVEL_PREFIX=/usr/ \
481 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
482 HOSTCC="$(HOSTCC)" \
483 BUILD_CFLAGS="$(HOST_CFLAGS)" \
484 BUILD_LDFLAGS="$(HOST_LDFLAGS)" \
485 UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
486 UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS) $(__UCLIBC_EXTRA_TARGET_CFLAGS)" \
487 install_headers
488 endif
489 # Install the kernel headers to the first stage gcc include dir
490 ifeq ($(LINUX_HEADERS_IS_KERNEL),y)
491 if [ ! -f $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/linux/version.h ]; then \
492 cp -pLR $(LINUX_HEADERS_DIR)/include/* \
493 $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/; \
494 fi
495 else
496 if [ ! -f $(STAGING_DIR)/usr/include/linux/version.h ]; then \
497 cp -pLR $(LINUX_HEADERS_DIR)/include/asm \
498 $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/; \
499 cp -pLR $(LINUX_HEADERS_DIR)/include/linux \
500 $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/; \
501 if [ -d $(LINUX_HEADERS_DIR)/include/asm-generic ]; then \
502 cp -pLR $(LINUX_HEADERS_DIR)/include/asm-generic \
503 $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/; \
504 fi; \
505 fi
506 endif
507 touch $@
508
509 $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(gcc_initial) $(LIBFLOAT_TARGET)
510 $(MAKE) -C $(UCLIBC_DIR) \
511 PREFIX= \
512 DEVEL_PREFIX=/ \
513 RUNTIME_PREFIX=/ \
514 HOSTCC="$(HOSTCC)" \
515 BUILD_CFLAGS="$(HOST_CFLAGS)" \
516 BUILD_LDFLAGS="$(HOST_LDFLAGS)" \
517 UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS) $(TARGET_LD_FLAGS)" \
518 UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CC_FLAGS) $(__UCLIBC_EXTRA_TARGET_CFLAGS)" \
519 all
520
521 uclibc-menuconfig libc-menuconfig: host-sed $(UCLIBC_DIR)/.config
522 $(MAKE1) -C $(UCLIBC_DIR) \
523 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
524 DEVEL_PREFIX=/usr/ \
525 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
526 HOSTCC="$(HOSTCC)" \
527 BUILD_CFLAGS="$(HOST_CFLAGS)" \
528 BUILD_LDFLAGS="$(HOST_LDFLAGS)" \
529 menuconfig && \
530 touch -c $(UCLIBC_DIR)/.config
531
532 BR2_UCLIBC_CONFIG_FOR_BUILDROOT=$(BASE_DIR)/.buildroot.uclibc_config
533 $(BR2_UCLIBC_CONFIG_FOR_BUILDROOT): $(dependencies) host-sed $(UCLIBC_DIR)/.config
534 # Create BR2__UCLIBC_SYM=val
535 cat $(UCLIBC_DIR)/.config > $(BR2_UCLIBC_CONFIG_FOR_BUILDROOT)
536 $(SED) '/#/d' -e '/^$$/d' -e 's,\([^=]*\)=\(.*\),BR2__UCLIBC_\1=\2,g' \
537 $(BR2_UCLIBC_CONFIG_FOR_BUILDROOT)
538 touch -c $@
539
540 ifeq ($(BR2__UCLIBC_HAVE_DOT_CONFIG),)
541 ifeq ($(filter uclibc-menuconfig libc-menuconfig,$(MAKECMDGOALS)),)
542 ifneq ($(wildcard $(UCLIBC_CONFIG_FILE)),)
543 ifeq ($(findstring host-,$(MAKECMDGOALS)),)
544 include $(BR2_UCLIBC_CONFIG_FOR_BUILDROOT)
545 endif
546 endif
547 endif
548 endif
549
550 $(STAGING_DIR)/usr/lib/libc.a: | $(UCLIBC_DIR)/lib/libc.a
551 ifneq ($(BR2_TOOLCHAIN_SYSROOT),y)
552 $(MAKE) -C $(UCLIBC_DIR) \
553 PREFIX= \
554 DEVEL_PREFIX=$(STAGING_DIR)/ \
555 RUNTIME_PREFIX=$(STAGING_DIR)/ \
556 install_runtime install_dev
557 else
558 $(MAKE) -C $(UCLIBC_DIR) \
559 PREFIX=$(STAGING_DIR) \
560 DEVEL_PREFIX=/usr/ \
561 RUNTIME_PREFIX=/ \
562 HOSTCC="$(HOSTCC)" \
563 BUILD_CFLAGS="$(HOST_CFLAGS)" \
564 BUILD_LDFLAGS="$(HOST_LDFLAGS)" \
565 UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS) $(TARGET_LD_FLAGS)" \
566 UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CC_FLAGS) $(__UCLIBC_EXTRA_TARGET_CFLAGS)" \
567 install_runtime install_dev
568 endif
569 # Install the kernel headers to the staging dir if necessary
570 ifeq ($(LINUX_HEADERS_IS_KERNEL),y)
571 if [ ! -f $(STAGING_DIR)/usr/include/linux/version.h ]; then \
572 cp -pLR $(LINUX_HEADERS_DIR)/include/* \
573 $(STAGING_DIR)/usr/include/; \
574 fi
575 else
576 if [ ! -f $(STAGING_DIR)/usr/include/linux/version.h ]; then \
577 cp -pLR $(LINUX_HEADERS_DIR)/include/asm \
578 $(STAGING_DIR)/usr/include/; \
579 cp -pLR $(LINUX_HEADERS_DIR)/include/linux \
580 $(STAGING_DIR)/usr/include/; \
581 if [ -d $(LINUX_HEADERS_DIR)/include/asm-generic ]; then \
582 cp -pLR $(LINUX_HEADERS_DIR)/include/asm-generic \
583 $(STAGING_DIR)/usr/include/; \
584 fi; \
585 fi
586 endif
587 # Build the host utils. Need to add an install target...
588 ifeq ($(BR2_UCLIBC_VERSION_SNAPSHOT),y)
589 $(MAKE) -C $(UCLIBC_DIR)/ \
590 PREFIX=$(STAGING_DIR) \
591 DEVEL_PREFIX=/usr/ \
592 RUNTIME_PREFIX=/ \
593 HOSTCC="$(HOSTCC)" \
594 install_hostutils
595 touch -c $@
596 else
597 $(MAKE1) -C $(UCLIBC_DIR)/utils \
598 PREFIX=$(STAGING_DIR) \
599 HOSTCC="$(HOSTCC)" \
600 hostutils
601 # install readelf and eventually other host-utils
602 $(INSTALL) -m0755 -D $(UCLIBC_DIR)/utils/readelf.host $(STAGING_DIR)/usr/bin/readelf
603 ln -sf readelf $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-readelf
604 ln -sf readelf $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-readelf
605 ifeq ($(BR2__UCLIBC_HAVE_SHARED),y)
606 $(INSTALL) -m0755 -D $(UCLIBC_DIR)/utils/ldd.host $(STAGING_DIR)/usr/bin/ldd
607 ln -sf ldd $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ldd
608 ln -sf ldd $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-ldd
609 $(INSTALL) -m0755 -D $(UCLIBC_DIR)/utils/ldconfig.host $(STAGING_DIR)/usr/sbin/ldconfig
610 ln -sf ldconfig $(STAGING_DIR)/usr/sbin/$(REAL_GNU_TARGET_NAME)-ldconfig
611 ln -sf ldconfig $(STAGING_DIR)/usr/sbin/$(GNU_TARGET_NAME)-ldconfig
612 endif
613 ifeq ($(BR2__UCLIBC_UCLIBC_HAS_LOCALE),y)
614 if [ -r $(UCLIBC_DIR)/utils/iconv.host ]; then \
615 $(INSTALL) -m0755 -D $(UCLIBC_DIR)/utils/iconv.host $(STAGING_DIR)/usr/bin/iconv; \
616 ln -sf iconv $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-iconv; \
617 ln -sf iconv $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-iconv; \
618 fi
619 if [ -r $(UCLIBC_DIR)/utils/locale.host ]; then \
620 $(INSTALL) -m0755 -D $(UCLIBC_DIR)/utils/locale.host $(STAGING_DIR)/usr/bin/locale; \
621 ln -sf locale $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-locale; \
622 ln -sf locale $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-locale; \
623 fi
624 endif
625 touch -c $@
626 endif
627
628 # extra paranoia
629 ifneq ($(TARGET_DIR),)
630 $(TARGET_DIR)/lib/libc.so.0: | $(STAGING_DIR)/usr/lib/libc.a
631 $(MAKE) -C $(UCLIBC_DIR) \
632 PREFIX=$(TARGET_DIR) \
633 DEVEL_PREFIX=/usr/ \
634 RUNTIME_PREFIX=/ \
635 UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
636 UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS) $(__UCLIBC_EXTRA_TARGET_CFLAGS)" \
637 install_runtime
638 touch -c $@
639
640 $(TARGET_DIR)/usr/bin/ldd: $(cross_compiler) $(TARGET_DIR)/lib/libc.so.0
641 $(MAKE) -C $(UCLIBC_DIR) \
642 PREFIX=$(TARGET_DIR) \
643 DEVEL_PREFIX=/usr/ \
644 RUNTIME_PREFIX=/ \
645 UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS) $(TARGET_LD_FLAGS)" \
646 UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CC_FLAGS) $(__UCLIBC_EXTRA_TARGET_CFLAGS)" \
647 install_utils
648 ifeq ($(BR2_CROSS_TOOLCHAIN_TARGET_UTILS),y)
649 $(INSTALL) -m0755 -D $(TARGET_DIR)/usr/bin/ldd \
650 $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/target_utils/ldd
651 endif
652 touch -c $@
653
654 endif
655
656 uclibc libc: $(cross_compiler) $(STAGING_DIR)/usr/lib/libc.a
657
658 uclibc-source libc-source: $(DL_DIR)/$(UCLIBC_SOURCE)
659
660 uclibc-unpacked libc-unpacked: $(UCLIBC_DIR)/.unpacked
661
662 uclibc-config libc-config: $(UCLIBC_DIR)/.config
663
664 uclibc-oldconfig libc-oldconfig: $(UCLIBC_DIR)/.oldconfig
665
666 uclibc-update libc-update: uclibc-config
667 cp -f $(UCLIBC_DIR)/.config $(UCLIBC_CONFIG_FILE)
668
669 libc-configured: kernel-headers $(UCLIBC_DIR)/.configured
670
671 libc-configured-source: libc-source
672
673 uclibc-clean libc-clean:
674 -$(MAKE1) -C $(UCLIBC_DIR) clean
675 $(patsubst %,rm -f %, $(wildcard $(STAGING_DIR)/usr/bin/*readelf \
676 $(STAGING_DIR)/usr/bin/*ldd \
677 $(STAGING_DIR)/usr/bin/*ldconfig \
678 $(STAGING_DIR)/usr/bin/*iconv \
679 $(STAGING_DIR)/usr/bin/*locale \
680 $(STAGING_DIR)/usr/sbin/*readelf \
681 $(STAGING_DIR)/usr/sbin/*ldd \
682 $(STAGING_DIR)/usr/sbin/*ldconfig \
683 $(STAGING_DIR)/usr/sbin/*iconv \
684 $(STAGING_DIR)/usr/sbin/*locale \
685 $(TARGET_DIR)/usr/bin/*readelf \
686 $(TARGET_DIR)/usr/bin/*ldd \
687 $(TARGET_DIR)/usr/bin/*ldconfig \
688 $(TARGET_DIR)/usr/bin/*iconv \
689 $(TARGET_DIR)/usr/bin/*locale \
690 $(TARGET_DIR)/usr/sbin/*readelf \
691 $(TARGET_DIR)/usr/sbin/*ldd \
692 $(TARGET_DIR)/usr/sbin/*ldconfig \
693 $(TARGET_DIR)/usr/sbin/*iconv \
694 $(TARGET_DIR)/usr/sbin/*locale))
695 rm -f $(UCLIBC_DIR)/.config $(UCLIBC_DIR)/.configured
696
697 uclibc-dirclean libc-dirclean:
698 rm -rf $(UCLIBC_DIR)
699
700 uclibc-target-utils libc-target-utils: $(TARGET_DIR)/usr/bin/ldd
701
702 uclibc-target-utils-source libc-target-utils-source: $(DL_DIR)/$(UCLIBC_SOURCE)
703
704 #############################################################
705 #
706 # uClibc for the target
707 #
708 #############################################################
709
710 $(TARGET_DIR)/usr/lib/libc.a: | $(STAGING_DIR)/usr/lib/libc.a
711 $(MAKE) -C $(UCLIBC_DIR) \
712 PREFIX=$(TARGET_DIR) \
713 DEVEL_PREFIX=/usr/ \
714 RUNTIME_PREFIX=/ \
715 UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
716 UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS) $(__UCLIBC_EXTRA_TARGET_CFLAGS)" \
717 install_dev
718 # Install the kernel headers to the target dir if necessary
719 ifeq ($(LINUX_HEADERS_IS_KERNEL),y)
720 if [ ! -f $(TARGET_DIR)/usr/include/linux/version.h ]; then \
721 cp -pLR $(LINUX_HEADERS_DIR)/include/* \
722 $(TARGET_DIR)/usr/include/; \
723 fi
724 else
725 if [ ! -f $(TARGET_DIR)/usr/include/linux/version.h ]; then \
726 cp -pLR $(LINUX_HEADERS_DIR)/include/asm \
727 $(TARGET_DIR)/usr/include/; \
728 cp -pLR $(LINUX_HEADERS_DIR)/include/linux \
729 $(TARGET_DIR)/usr/include/; \
730 if [ -d $(LINUX_HEADERS_DIR)/include/asm-generic ]; then \
731 cp -pLR $(LINUX_HEADERS_DIR)/include/asm-generic \
732 $(TARGET_DIR)/usr/include/; \
733 fi; \
734 fi
735 endif
736 touch -c $@
737
738 ifeq ($(BR2__UCLIBC_HAVE_SHARED),y)
739 UCLIBC_TARGETS+=$(TARGET_DIR)/lib/libc.so.0
740 ifeq ($(BR2_CROSS_TOOLCHAIN_TARGET_UTILS),y)
741 UCLIBC_TARGETS+=$(TARGET_DIR)/usr/bin/ldd
742 endif
743 endif
744
745 ifeq ($(BR2_HAVE_INCLUDES),y)
746 UCLIBC_TARGETS+=$(TARGET_DIR)/usr/lib/libc.a
747 endif
748
749 libc_target: cross_compiler libc $(UCLIBC_TARGETS)
750 libc_target-clean:
751 rm -rf $(TARGET_DIR)/usr/include $(UCLIBC_TARGETS) \
752 $(TARGET_DIR)/usr/lib/libc.a $(TARGET_DIR)/usr/bin/ldd
753
754 libc_target-dirclean:
755 rm -rf $(TARGET_DIR)/usr/include
756
757 endif