lzop: new package
[avatt.git] / toolchain / uClibc / uclibc.mk
blob164c474f5be0efd9d566642637c782de30e68582
1 #############################################################
3 # uClibc (the C library)
5 #############################################################
7 ifeq ($(BR2_TOOLCHAIN_SOURCE),y)
9 # specifying UCLIBC_CONFIG_FILE on the command-line overrides the .config
10 # setting.
11 ifndef UCLIBC_CONFIG_FILE
12 UCLIBC_CONFIG_FILE=$(subst ",, $(strip $(BR2_UCLIBC_CONFIG)))
13 #")
14 endif
16 UCLIBC_VER:=$(subst ",,$(BR2_UCLIBC_VERSION_STRING))
17 #")
19 UCLIBC_OFFICIAL_VERSION:=$(UCLIBC_VER)$(VENDOR_SUFFIX)$(VENDOR_UCLIBC_RELEASE)
21 ifeq ($(BR2_UCLIBC_VERSION_SNAPSHOT),y)
22 UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots
23 UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc
24 else
25 UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc-$(UCLIBC_OFFICIAL_VERSION)
26 UCLIBC_SITE:=http://www.uclibc.org/downloads
27 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_SOURCE),y)
28 UCLIBC_SITE:=$(VENDOR_SITE)
29 endif
30 endif
32 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
33 UCLIBC_PATCH_DIR:=toolchain/uClibc/
34 else
35 UCLIBC_PATCH_DIR:=toolchain/uClibc/ext_source/$(VENDOR_PATCH_DIR)/$(UCLIBC_OFFICIAL_VERSION)
36 endif
38 UCLIBC_SOURCE:=uClibc-$(UCLIBC_OFFICIAL_VERSION).tar.bz2
40 UCLIBC_CAT:=$(BZCAT)
42 UCLIBC_TARGET_ARCH:=$(shell $(SHELL) -c "echo $(ARCH) | sed \
43 -e 's/-.*//' \
44 -e 's/i.86/i386/' \
45 -e 's/sparc.*/sparc/' \
46 -e 's/arm.*/arm/g' \
47 -e 's/m68k.*/m68k/' \
48 -e 's/ppc/powerpc/g' \
49 -e 's/v850.*/v850/g' \
50 -e 's/sh[234].*/sh/' \
51 -e 's/mips.*/mips/' \
52 -e 's/mipsel.*/mips/' \
53 -e 's/cris.*/cris/' \
54 -e 's/nios2.*/nios2/' \
56 # just handle the ones that can be big or little
57 UCLIBC_TARGET_ENDIAN:=$(shell $(SHELL) -c "echo $(ARCH) | sed \
58 -e 's/armeb/BIG/' \
59 -e 's/arm/LITTLE/' \
60 -e 's/mipsel/LITTLE/' \
61 -e 's/mips/BIG/' \
62 -e 's/sh.*eb/BIG/' \
63 -e 's/sh.*/LITTLE/' \
64 -e 's/sparc.*/BIG/' \
67 ifneq ($(UCLIBC_TARGET_ENDIAN),LITTLE)
68 ifneq ($(UCLIBC_TARGET_ENDIAN),BIG)
69 UCLIBC_TARGET_ENDIAN:=
70 endif
71 endif
72 ifeq ($(UCLIBC_TARGET_ENDIAN),LITTLE)
73 UCLIBC_NOT_TARGET_ENDIAN:=BIG
74 else
75 UCLIBC_NOT_TARGET_ENDIAN:=LITTLE
76 endif
78 UCLIBC_ARM_TYPE:=CONFIG_$(strip $(subst ",, $(BR2_ARM_TYPE)))
79 #"))
80 UCLIBC_SPARC_TYPE:=CONFIG_SPARC_$(strip $(subst ",, $(BR2_SPARC_TYPE)))
81 #"))
83 $(DL_DIR)/$(UCLIBC_SOURCE):
84 $(call DOWNLOAD,$(UCLIBC_SITE),$(UCLIBC_SOURCE))
86 ifneq ($(BR2_ENABLE_LOCALE_PREGENERATED),)
87 UCLIBC_SITE_LOCALE:=http://www.uclibc.org/downloads
88 UCLIBC_SOURCE_LOCALE:=uClibc-locale-030818.tgz
90 $(DL_DIR)/$(UCLIBC_SOURCE_LOCALE):
91 $(call DOWNLOAD,$(UCLIBC_SITE_LOCALE),$(UCLIBC_SOURCE_LOCALE))
93 UCLIBC_LOCALE_DATA:=$(DL_DIR)/$(UCLIBC_SOURCE_LOCALE)
94 else
95 UCLIBC_LOCALE_DATA=
96 endif
98 uclibc-unpacked: $(UCLIBC_DIR)/.unpacked
99 $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) $(UCLIBC_LOCALE_DATA)
100 mkdir -p $(TOOL_BUILD_DIR)
101 rm -rf $(UCLIBC_DIR)
102 $(UCLIBC_CAT) $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
103 touch $@
105 uclibc-patched: $(UCLIBC_DIR)/.patched
106 $(UCLIBC_DIR)/.patched: $(UCLIBC_DIR)/.unpacked
107 ifneq ($(BR2_UCLIBC_VERSION_SNAPSHOT),y)
108 toolchain/patch-kernel.sh $(UCLIBC_DIR) $(UCLIBC_PATCH_DIR) \
109 uClibc-$(UCLIBC_OFFICIAL_VERSION)-\*.patch \
110 uClibc-$(UCLIBC_OFFICIAL_VERSION)-\*.patch.$(ARCH)
111 else
112 toolchain/patch-kernel.sh $(UCLIBC_DIR) $(UCLIBC_PATCH_DIR) \
113 uClibc.\*.patch uClibc.\*.patch.$(ARCH)
114 endif
115 ifneq ($(BR2_ENABLE_LOCALE_PREGENERATED),)
116 cp -dpf $(DL_DIR)/$(UCLIBC_SOURCE_LOCALE) $(UCLIBC_DIR)/extra/locale/
117 endif
118 touch $@
121 # Some targets may wish to provide their own UCLIBC_CONFIG_FILE...
122 $(UCLIBC_DIR)/.oldconfig: $(UCLIBC_DIR)/.patched $(UCLIBC_CONFIG_FILE)
123 cp -f $(UCLIBC_CONFIG_FILE) $(UCLIBC_DIR)/.oldconfig
124 $(SED) 's,^CROSS_COMPILER_PREFIX=.*,CROSS_COMPILER_PREFIX="$(TARGET_CROSS)",g' \
125 -e 's,# TARGET_$(UCLIBC_TARGET_ARCH) is not set,TARGET_$(UCLIBC_TARGET_ARCH)=y,g' \
126 -e 's,^TARGET_ARCH=".*",TARGET_ARCH=\"$(UCLIBC_TARGET_ARCH)\",g' \
127 -e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
128 -e 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(LINUX_HEADERS_DIR)/include\",g' \
129 -e 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \
130 -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \
131 -e 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \
132 $(UCLIBC_DIR)/.oldconfig
133 ifeq ($(UCLIBC_TARGET_ARCH),arm)
134 (/bin/echo "# CONFIG_GENERIC_ARM is not set"; \
135 /bin/echo "# CONFIG_ARM610 is not set"; \
136 /bin/echo "# CONFIG_ARM710 is not set"; \
137 /bin/echo "# CONFIG_ARM7TDMI is not set"; \
138 /bin/echo "# CONFIG_ARM720T is not set"; \
139 /bin/echo "# CONFIG_ARM920T is not set"; \
140 /bin/echo "# CONFIG_ARM922T is not set"; \
141 /bin/echo "# CONFIG_ARM926T is not set"; \
142 /bin/echo "# CONFIG_ARM10T is not set"; \
143 /bin/echo "# CONFIG_ARM1136JF_S is not set"; \
144 /bin/echo "# CONFIG_ARM1176JZ_S is not set"; \
145 /bin/echo "# CONFIG_ARM1176JZF_S is not set"; \
146 /bin/echo "# CONFIG_ARM_SA110 is not set"; \
147 /bin/echo "# CONFIG_ARM_SA1100 is not set"; \
148 /bin/echo "# CONFIG_ARM_XSCALE is not set"; \
149 /bin/echo "# CONFIG_ARM_IWMMXT is not set"; \
150 ) >> $(UCLIBC_DIR)/.oldconfig
151 $(SED) 's/^\(CONFIG_[^_]*[_]*ARM[^=]*\)=.*/# \1 is not set/g' \
152 $(UCLIBC_DIR)/.oldconfig
153 $(SED) 's/^.*$(UCLIBC_ARM_TYPE).*/$(UCLIBC_ARM_TYPE)=y/g' $(UCLIBC_DIR)/.oldconfig
154 $(SED) '/CONFIG_ARM_.ABI/d' $(UCLIBC_DIR)/.oldconfig
155 ifeq ($(BR2_ARM_EABI),y)
156 /bin/echo "# CONFIG_ARM_OABI is not set" >> $(UCLIBC_DIR)/.oldconfig
157 /bin/echo "CONFIG_ARM_EABI=y" >> $(UCLIBC_DIR)/.oldconfig
158 endif
159 ifeq ($(BR2_ARM_OABI),y)
160 /bin/echo "CONFIG_ARM_OABI=y" >> $(UCLIBC_DIR)/.oldconfig
161 /bin/echo "# CONFIG_ARM_EABI is not set" >> $(UCLIBC_DIR)/.oldconfig
162 endif
163 endif
164 ifeq ($(UCLIBC_TARGET_ARCH),mips)
165 $(SED) '/CONFIG_MIPS_[NO].._ABI/d' $(UCLIBC_DIR)/.oldconfig
166 $(SED) '/CONFIG_MIPS_ISA_.*/d' $(UCLIBC_DIR)/.oldconfig
167 (/bin/echo "# CONFIG_MIPS_O32_ABI is not set"; \
168 /bin/echo "# CONFIG_MIPS_N32_ABI is not set"; \
169 /bin/echo "# CONFIG_MIPS_N64_ABI is not set"; \
170 /bin/echo "# CONFIG_MIPS_ISA_1 is not set"; \
171 /bin/echo "# CONFIG_MIPS_ISA_2 is not set"; \
172 /bin/echo "# CONFIG_MIPS_ISA_3 is not set"; \
173 /bin/echo "# CONFIG_MIPS_ISA_4 is not set"; \
174 /bin/echo "# CONFIG_MIPS_ISA_MIPS32 is not set"; \
175 /bin/echo "# CONFIG_MIPS_ISA_MIPS32R2 is not set"; \
176 /bin/echo "# CONFIG_MIPS_ISA_MIPS64 is not set"; \
177 ) >> $(UCLIBC_DIR)/.oldconfig
178 ifeq ($(BR2_MIPS_OABI),y)
179 $(SED) 's/.*\(CONFIG_MIPS_O32_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
180 endif
181 ifeq ($(BR2_MIPS_EABI),y)
182 $(SED) 's/.*\(CONFIG_MIPS_N32_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
183 endif
184 ifeq ($(BR2_MIPS_ABI64),y)
185 $(SED) 's/.*\(CONFIG_MIPS_N64_ABI\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
186 endif
187 ifeq ($(BR2_mips_1),y)
188 $(SED) 's/.*\(CONFIG_MIPS_ISA_1\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
189 endif
190 ifeq ($(BR2_mips_2),y)
191 $(SED) 's/.*\(CONFIG_MIPS_ISA_2\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
192 endif
193 ifeq ($(BR2_mips_3),y)
194 $(SED) 's/.*\(CONFIG_MIPS_ISA_3\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
195 endif
196 ifeq ($(BR2_mips_4),y)
197 $(SED) 's/.*\(CONFIG_MIPS_ISA_4\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
198 endif
199 ifeq ($(BR2_mips_32),y)
200 $(SED) 's/.*\(CONFIG_MIPS_ISA_MIPS32\)[^R].*/\1=y/' $(UCLIBC_DIR)/.oldconfig
201 endif
202 ifeq ($(BR2_mips_32r2),y)
203 $(SED) 's/.*\(CONFIG_MIPS_ISA_MIPS32R2\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
204 endif
205 ifeq ($(BR2_mips_64),y)
206 $(SED) 's/.*\(CONFIG_MIPS_ISA_MIPS64\).*/\1=y/' $(UCLIBC_DIR)/.oldconfig
207 endif
208 endif
209 ifeq ($(UCLIBC_TARGET_ARCH),nios2)
210 /bin/echo "# UCLIBC_FORMAT_FDPIC_ELF is not set" >> $(UCLIBC_DIR)/.oldconfig
211 /bin/echo "UCLIBC_FORMAT_FLAT=y" >> $(UCLIBC_DIR)/.oldconfig
212 /bin/echo "# UCLIBC_FORMAT_FLAT_SEP_DATA is not set" >> $(UCLIBC_DIR)/.oldconfig
213 /bin/echo "# UCLIBC_FORMAT_SHARED_FLAT is not set" >> $(UCLIBC_DIR)/.oldconfig
214 endif
215 ifeq ($(UCLIBC_TARGET_ARCH),sh)
216 /bin/echo "# CONFIG_SH2A is not set" >> $(UCLIBC_DIR)/.oldconfig
217 /bin/echo "# CONFIG_SH2 is not set" >> $(UCLIBC_DIR)/.oldconfig
218 /bin/echo "# CONFIG_SH3 is not set" >> $(UCLIBC_DIR)/.oldconfig
219 /bin/echo "# CONFIG_SH4 is not set" >> $(UCLIBC_DIR)/.oldconfig
220 ifeq ($(BR2_sh2a_nofpueb),y)
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) 's,# CONFIG_SH2 is not set,CONFIG_SH2=y,g' $(UCLIBC_DIR)/.oldconfig
229 /bin/echo "# UCLIBC_FORMAT_FDPIC_ELF is not set" >> $(UCLIBC_DIR)/.oldconfig
230 /bin/echo "# UCLIBC_FORMAT_FLAT is not set" >> $(UCLIBC_DIR)/.oldconfig
231 /bin/echo "# UCLIBC_FORMAT_FLAT_SEP_DATA is not set" >> $(UCLIBC_DIR)/.oldconfig
232 /bin/echo "# UCLIBC_FORMAT_SHARED_FLAT is not set" >> $(UCLIBC_DIR)/.oldconfig
233 endif
234 ifeq ($(BR2_sh3eb),y)
235 $(SED) 's,# CONFIG_SH3 is not set,CONFIG_SH3=y,g' $(UCLIBC_DIR)/.oldconfig
236 endif
237 ifeq ($(BR2_sh3),y)
238 $(SED) 's,# CONFIG_SH3 is not set,CONFIG_SH3=y,g' $(UCLIBC_DIR)/.oldconfig
239 endif
240 ifeq ($(BR2_sh4eb),y)
241 $(SED) 's,# CONFIG_SH4 is not set,CONFIG_SH4=y,g' $(UCLIBC_DIR)/.oldconfig
242 endif
243 ifeq ($(BR2_sh4),y)
244 $(SED) 's,# CONFIG_SH4 is not set,CONFIG_SH4=y,g' $(UCLIBC_DIR)/.oldconfig
245 endif
246 endif
247 ifeq ($(UCLIBC_TARGET_ARCH),sparc)
248 $(SED) 's/^\(CONFIG_[^_]*[_]*SPARC[^=]*\)=.*/# \1 is not set/g' \
249 $(UCLIBC_DIR)/.oldconfig
250 for i in V7 V8 V9 V9B; do echo "# CONFIG_SPARC_$$i is not set"; done \
251 >> $(UCLIBC_DIR)/.oldconfig
252 $(SED) 's/^.*$(UCLIBC_SPARC_TYPE)[^B].*/$(UCLIBC_SPARC_TYPE)=y/g' $(UCLIBC_DIR)/.oldconfig
253 endif
254 ifeq ($(UCLIBC_TARGET_ARCH),powerpc)
255 ifeq ($(BR2_powerpc_8540),y)
256 /bin/echo "# CONFIG_CLASSIC is not set" >> $(UCLIBC_DIR)/.oldconfig
257 /bin/echo "CONFIG_E500=y" >> $(UCLIBC_DIR)/.oldconfig
258 else
259 /bin/echo "CONFIG_CLASSIC=y" >> $(UCLIBC_DIR)/.oldconfig
260 /bin/echo "# CONFIG_E500 is not set" >> $(UCLIBC_DIR)/.oldconfig
261 endif
262 endif
263 ifneq ($(UCLIBC_TARGET_ENDIAN),)
264 # The above doesn't work for me, so redo
265 $(SED) 's/.*\(ARCH_$(UCLIBC_NOT_TARGET_ENDIAN)_ENDIAN\).*/# \1 is not set/g' \
266 -e 's/.*\(ARCH_WANTS_$(UCLIBC_NOT_TARGET_ENDIAN)_ENDIAN\).*/# \1 is not set/g' \
267 -e 's/.*\(ARCH_$(UCLIBC_TARGET_ENDIAN)_ENDIAN\).*/\1=y/g' \
268 -e 's/.*\(ARCH_WANTS_$(UCLIBC_TARGET_ENDIAN)_ENDIAN\).*/\1=y/g' \
269 $(UCLIBC_DIR)/.oldconfig
270 endif
271 ifeq ($(BR2_LARGEFILE),y)
272 $(SED) 's,.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(UCLIBC_DIR)/.oldconfig
273 else
274 $(SED) 's,.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(UCLIBC_DIR)/.oldconfig
275 $(SED) '/.*UCLIBC_HAS_FOPEN_LARGEFILE_MODE.*/d' $(UCLIBC_DIR)/.oldconfig
276 echo "# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set" >> $(UCLIBC_DIR)/.oldconfig
277 endif
278 ifeq ($(BR2_INET_IPV6),y)
279 $(SED) 's,^.*UCLIBC_HAS_IPV6.*,UCLIBC_HAS_IPV6=y,g' $(UCLIBC_DIR)/.oldconfig
280 else
281 $(SED) 's,^.*UCLIBC_HAS_IPV6.*,UCLIBC_HAS_IPV6=n,g' $(UCLIBC_DIR)/.oldconfig
282 endif
283 ifeq ($(BR2_INET_RPC),y)
284 $(SED) 's,^.*UCLIBC_HAS_RPC.*,UCLIBC_HAS_RPC=y,g' \
285 -e 's,^.*UCLIBC_HAS_FULL_RPC.*,UCLIBC_HAS_FULL_RPC=y,g' \
286 -e 's,^.*UCLIBC_HAS_REENTRANT_RPC.*,UCLIBC_HAS_REENTRANT_RPC=y,g' \
287 $(UCLIBC_DIR)/.oldconfig
288 else
289 $(SED) 's,^.*UCLIBC_HAS_RPC.*,UCLIBC_HAS_RPC=n,g' \
290 -e 's,^.*UCLIBC_HAS_FULL_RPC.*,UCLIBC_HAS_FULL_RPC=n,g' \
291 -e 's,^.*UCLIBC_HAS_REENTRANT_RPC.*,UCLIBC_HAS_REENTRANT_RPC=n,g' \
292 $(UCLIBC_DIR)/.oldconfig
293 endif
294 ifeq ($(BR2_SOFT_FLOAT),y)
295 $(SED) 's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=n,g' \
296 -e 's,^[^_]*HAS_FPU.*,HAS_FPU=n,g' \
297 -e 's,.*UCLIBC_HAS_FLOATS.*,UCLIBC_HAS_FLOATS=y,g' \
298 -e 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' \
299 $(UCLIBC_DIR)/.oldconfig
300 #$(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
301 else
302 $(SED) '/UCLIBC_HAS_FLOATS/d' \
303 -e 's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=y\nHAS_FPU=y\nUCLIBC_HAS_FLOATS=y\n,g' \
304 $(UCLIBC_DIR)/.oldconfig
305 endif
306 $(SED) '/UCLIBC_HAS_THREADS/d' $(UCLIBC_DIR)/.oldconfig
307 $(SED) '/LINUXTHREADS/d' $(UCLIBC_DIR)/.oldconfig
308 $(SED) '/LINUXTHREADS_OLD/d' $(UCLIBC_DIR)/.oldconfig
309 $(SED) '/PTHREADS_DEBUG_SUPPORT/d' $(UCLIBC_DIR)/.oldconfig
310 $(SED) '/UCLIBC_HAS_THREADS_NATIVE/d' $(UCLIBC_DIR)/.oldconfig
311 ifeq ($(BR2_PTHREADS_NONE),y)
312 echo "# UCLIBC_HAS_THREADS is not set" >> $(UCLIBC_DIR)/.oldconfig
313 else
314 echo "UCLIBC_HAS_THREADS=y" >> $(UCLIBC_DIR)/.oldconfig
315 endif
316 ifeq ($(BR2_PTHREADS),y)
317 echo "LINUXTHREADS=y" >> $(UCLIBC_DIR)/.oldconfig
318 else
319 echo "# LINUXTHREADS is not set" >> $(UCLIBC_DIR)/.oldconfig
320 endif
321 ifeq ($(BR2_PTHREADS_OLD),y)
322 echo "LINUXTHREADS_OLD=y" >> $(UCLIBC_DIR)/.oldconfig
323 else
324 echo "# LINUXTHREADS_OLD is not set" >> $(UCLIBC_DIR)/.oldconfig
325 endif
326 ifeq ($(BR2_PTHREADS_NATIVE),y)
327 echo "UCLIBC_HAS_THREADS_NATIVE=y" >> $(UCLIBC_DIR)/.oldconfig
328 else
329 echo "# UCLIBC_HAS_THREADS_NATIVE is not set" >> $(UCLIBC_DIR)/.oldconfig
330 endif
331 ifeq ($(BR2_PTHREAD_DEBUG),y)
332 echo "PTHREADS_DEBUG_SUPPORT=y" >> $(UCLIBC_DIR)/.oldconfig
333 else
334 echo "# PTHREADS_DEBUG_SUPPORT is not set" >> $(UCLIBC_DIR)/.oldconfig
335 endif
336 ifeq ($(BR2_ENABLE_LOCALE),y)
337 ifeq ($(BR2_ENABLE_LOCALE_PREGENERATED),y)
338 $(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
339 else
340 $(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
341 endif
342 else
343 $(SED) 's,^.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=n,g' $(UCLIBC_DIR)/.oldconfig
344 endif
345 ifeq ($(BR2_USE_WCHAR),y)
346 $(SED) 's,^.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.oldconfig
347 else
348 $(SED) 's,^.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=n,g' $(UCLIBC_DIR)/.oldconfig
349 endif
350 ifeq ($(BR2_UCLIBC_PROGRAM_INVOCATION),y)
351 $(SED) 's,^.*UCLIBC_HAS_PROGRAM_INVOCATION_NAME.*,UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y,g' $(UCLIBC_DIR)/.oldconfig
352 else
353 $(SED) 's,^.*UCLIBC_HAS_PROGRAM_INVOCATION_NAME.*,UCLIBC_HAS_PROGRAM_INVOCATION_NAME=n,g' $(UCLIBC_DIR)/.oldconfig
354 endif
355 ifeq ("$(KERNEL_ARCH)","i386")
356 /bin/echo "# CONFIG_GENERIC_386 is not set" >> $(UCLIBC_DIR)/.oldconfig
357 /bin/echo "# CONFIG_386 is not set" >> $(UCLIBC_DIR)/.oldconfig
358 /bin/echo "# CONFIG_486 is not set" >> $(UCLIBC_DIR)/.oldconfig
359 /bin/echo "# CONFIG_586 is not set" >> $(UCLIBC_DIR)/.oldconfig
360 /bin/echo "# CONFIG_586MMX is not set" >> $(UCLIBC_DIR)/.oldconfig
361 /bin/echo "# CONFIG_686 is not set" >> $(UCLIBC_DIR)/.oldconfig
362 /bin/echo "# CONFIG_PENTIUMII is not set" >> $(UCLIBC_DIR)/.oldconfig
363 /bin/echo "# CONFIG_PENTIUMIII is not set" >> $(UCLIBC_DIR)/.oldconfig
364 /bin/echo "# CONFIG_PENTIUM4 is not set" >> $(UCLIBC_DIR)/.oldconfig
365 /bin/echo "# CONFIG_K6 is not set" >> $(UCLIBC_DIR)/.oldconfig
366 /bin/echo "# CONFIG_K7 is not set" >> $(UCLIBC_DIR)/.oldconfig
367 /bin/echo "# CONFIG_ELAN is not set" >> $(UCLIBC_DIR)/.oldconfig
368 /bin/echo "# CONFIG_CRUSOE is not set" >> $(UCLIBC_DIR)/.oldconfig
369 /bin/echo "# CONFIG_WINCHIPC6 is not set" >> $(UCLIBC_DIR)/.oldconfig
370 /bin/echo "# CONFIG_WINCHIP2 is not set" >> $(UCLIBC_DIR)/.oldconfig
371 /bin/echo "# CONFIG_CYRIXIII is not set" >> $(UCLIBC_DIR)/.oldconfig
372 /bin/echo "# CONFIG_NEHEMIAH is not set" >> $(UCLIBC_DIR)/.oldconfig
373 ifeq ($(BR2_x86_i386),y)
374 $(SED) 's,# CONFIG_386 is not set,CONFIG_386=y,g' $(UCLIBC_DIR)/.oldconfig
375 endif
376 ifeq ($(BR2_x86_i486),y)
377 $(SED) 's,# CONFIG_486 is not set,CONFIG_486=y,g' $(UCLIBC_DIR)/.oldconfig
378 endif
379 ifeq ($(BR2_x86_i586),y)
380 $(SED) 's,# CONFIG_586 is not set,CONFIG_586=y,g' $(UCLIBC_DIR)/.oldconfig
381 endif
382 ifeq ($(BR2_x86_pentium_mmx),y)
383 $(SED) 's,# CONFIG_586MMX is not set,CONFIG_586MMX=y,g' $(UCLIBC_DIR)/.oldconfig
384 endif
385 ifeq ($(BR2_x86_i686),y)
386 $(SED) 's,# CONFIG_686 is not set,CONFIG_686=y,g' $(UCLIBC_DIR)/.oldconfig
387 endif
388 ifeq ($(BR2_x86_pentiumpro),y)
389 $(SED) 's,# CONFIG_686 is not set,CONFIG_686=y,g' $(UCLIBC_DIR)/.oldconfig
390 endif
391 ifeq ($(BR2_x86_pentium2),y)
392 $(SED) 's,# CONFIG_PENTIUMII is not set,CONFIG_PENTIUMII=y,g' $(UCLIBC_DIR)/.oldconfig
393 endif
394 ifeq ($(BR2_x86_pentium3),y)
395 $(SED) 's,# CONFIG_PENTIUMIII is not set,CONFIG_PENTIUMIII=y,g' $(UCLIBC_DIR)/.oldconfig
396 endif
397 ifeq ($(BR2_x86_pentium4),y)
398 $(SED) 's,# CONFIG_PENTIUM4 is not set,CONFIG_PENTIUM4=y,g' $(UCLIBC_DIR)/.oldconfig
399 endif
400 ifeq ($(BR2_x86_pentium_m),y)
401 $(SED) 's,# CONFIG_PENTIUM4 is not set,CONFIG_PENTIUM4=y,g' $(UCLIBC_DIR)/.oldconfig
402 endif
403 ifeq ($(BR2_x86_nocona),y)
404 $(SED) 's,# CONFIG_PENTIUM4 is not set,CONFIG_PENTIUM4=y,g' $(UCLIBC_DIR)/.oldconfig
405 endif
406 ifeq ($(BR2_x86_core2),y)
407 $(SED) 's,# CONFIG_PENTIUM4 is not set,CONFIG_PENTIUM4=y,g' $(UCLIBC_DIR)/.oldconfig
408 endif
409 endif
411 $(UCLIBC_DIR)/.config: $(UCLIBC_DIR)/.oldconfig
412 cp -f $(UCLIBC_DIR)/.oldconfig $(UCLIBC_DIR)/.config
413 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/include
414 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/lib
415 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/lib
416 $(MAKE1) -C $(UCLIBC_DIR) \
417 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
418 DEVEL_PREFIX=/usr/ \
419 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
420 HOSTCC="$(HOSTCC)" \
421 oldconfig
422 touch $@
424 $(UCLIBC_DIR)/.configured: $(LINUX_HEADERS_DIR)/.configured $(UCLIBC_DIR)/.config
425 set -x && $(MAKE1) -C $(UCLIBC_DIR) \
426 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
427 DEVEL_PREFIX=/usr/ \
428 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
429 HOSTCC="$(HOSTCC)" headers \
430 $(if $(BR2_UCLIBC_VERSION_0_9_28_3),install_dev,install_headers)
431 # Install the kernel headers to the first stage gcc include dir
432 # if necessary
433 ifeq ($(LINUX_HEADERS_IS_KERNEL),y)
434 if [ ! -f $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/linux/version.h ]; then \
435 cp -pLR $(LINUX_HEADERS_DIR)/include/* \
436 $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/; \
438 else
439 if [ ! -f $(STAGING_DIR)/usr/include/linux/version.h ]; then \
440 cp -pLR $(LINUX_HEADERS_DIR)/include/asm \
441 $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/; \
442 cp -pLR $(LINUX_HEADERS_DIR)/include/linux \
443 $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/; \
444 if [ -d $(LINUX_HEADERS_DIR)/include/asm-generic ]; then \
445 cp -pLR $(LINUX_HEADERS_DIR)/include/asm-generic \
446 $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/; \
447 fi; \
449 endif
450 touch $@
452 $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(gcc_initial) $(LIBFLOAT_TARGET)
453 $(MAKE1) -C $(UCLIBC_DIR) \
454 PREFIX= \
455 DEVEL_PREFIX=/ \
456 RUNTIME_PREFIX=/ \
457 HOSTCC="$(HOSTCC)" \
459 touch -c $@
461 uclibc-menuconfig: host-sed $(UCLIBC_DIR)/.config
462 $(MAKE1) -C $(UCLIBC_DIR) \
463 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
464 DEVEL_PREFIX=/usr/ \
465 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
466 HOSTCC="$(HOSTCC)" \
467 menuconfig && \
468 touch -c $(UCLIBC_DIR)/.config
471 $(STAGING_DIR)/usr/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
472 ifneq ($(BR2_TOOLCHAIN_SYSROOT),y)
473 $(MAKE1) -C $(UCLIBC_DIR) \
474 PREFIX= \
475 DEVEL_PREFIX=$(STAGING_DIR)/ \
476 RUNTIME_PREFIX=$(STAGING_DIR)/ \
477 install_runtime install_dev
478 else
479 $(MAKE1) -C $(UCLIBC_DIR) \
480 PREFIX=$(STAGING_DIR) \
481 DEVEL_PREFIX=/usr/ \
482 RUNTIME_PREFIX=/ \
483 install_runtime install_dev
484 endif
485 # Install the kernel headers to the staging dir if necessary
486 ifeq ($(LINUX_HEADERS_IS_KERNEL),y)
487 if [ ! -f $(STAGING_DIR)/usr/include/linux/version.h ]; then \
488 cp -pLR $(LINUX_HEADERS_DIR)/include/* \
489 $(STAGING_DIR)/usr/include/; \
491 else
492 if [ ! -f $(STAGING_DIR)/usr/include/linux/version.h ]; then \
493 cp -pLR $(LINUX_HEADERS_DIR)/include/asm \
494 $(STAGING_DIR)/usr/include/; \
495 cp -pLR $(LINUX_HEADERS_DIR)/include/linux \
496 $(STAGING_DIR)/usr/include/; \
497 if [ -d $(LINUX_HEADERS_DIR)/include/asm-generic ]; then \
498 cp -pLR $(LINUX_HEADERS_DIR)/include/asm-generic \
499 $(STAGING_DIR)/usr/include/; \
500 fi; \
502 endif
503 # Build the host utils. Need to add an install target...
504 $(MAKE1) -C $(UCLIBC_DIR)/utils \
505 PREFIX=$(STAGING_DIR) \
506 HOSTCC="$(HOSTCC)" \
507 hostutils
508 if [ -f $(UCLIBC_DIR)/utils/ldd.host ]; then \
509 install -c $(UCLIBC_DIR)/utils/ldd.host $(STAGING_DIR)/usr/bin/ldd; \
510 ln -sf ldd $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ldd; \
512 if [ -f $(UCLIBC_DIR)/utils/ldconfig.host ]; then \
513 install -c $(UCLIBC_DIR)/utils/ldconfig.host $(STAGING_DIR)/usr/bin/ldconfig; \
514 ln -sf ldconfig $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ldconfig; \
515 ln -sf ldconfig $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-ldconfig; \
517 touch -c $@
519 ifneq ($(TARGET_DIR),)
520 $(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/usr/lib/libc.a
521 $(MAKE1) -C $(UCLIBC_DIR) \
522 PREFIX=$(TARGET_DIR) \
523 DEVEL_PREFIX=/usr/ \
524 RUNTIME_PREFIX=/ \
525 install_runtime
526 ifeq ($(BR2_UCLIBC_VERSION_0_9_28_3),y)
527 ifneq ($(BR2_PTHREAD_DEBUG),y)
528 -$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(@D)/libpthread*.so*
529 endif
530 endif
531 touch -c $@
533 $(TARGET_DIR)/usr/bin/ldd: $(cross_compiler)
534 $(MAKE1) -C $(UCLIBC_DIR) CC=$(TARGET_CROSS)gcc \
535 CPP=$(TARGET_CROSS)cpp LD=$(TARGET_CROSS)ld \
536 PREFIX=$(TARGET_DIR) utils install_utils
537 ifeq ($(BR2_CROSS_TOOLCHAIN_TARGET_UTILS),y)
538 mkdir -p $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/target_utils
539 install -c $(TARGET_DIR)/usr/bin/ldd \
540 $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/target_utils/ldd
541 endif
542 touch -c $@
544 UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0
545 ifeq ($(BR2_UCLIBC_INSTALL_TEST_SUITE),y)
546 UCLIBC_TARGETS+=uclibc-test
547 endif
548 endif
550 uclibc: $(cross_compiler) $(STAGING_DIR)/usr/lib/libc.a $(UCLIBC_TARGETS)
552 uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE)
554 uclibc-unpacked: $(UCLIBC_DIR)/.unpacked
556 uclibc-config: $(UCLIBC_DIR)/.config
558 uclibc-oldconfig: $(UCLIBC_DIR)/.oldconfig
560 uclibc-update: uclibc-config
561 cp -f $(UCLIBC_DIR)/.config $(UCLIBC_CONFIG_FILE)
563 uclibc-configured: kernel-headers $(UCLIBC_DIR)/.configured
565 uclibc-configured-source: uclibc-source
567 uclibc-clean: uclibc-test-clean
568 -$(MAKE1) -C $(UCLIBC_DIR) clean
569 rm -f $(UCLIBC_DIR)/.config
571 uclibc-dirclean: uclibc-test-dirclean
572 rm -rf $(UCLIBC_DIR)
574 uclibc-target-utils:
575 #$(TARGET_DIR)/usr/bin/ldd
577 uclibc-target-utils-source: $(DL_DIR)/$(UCLIBC_SOURCE)
579 $(UCLIBC_DIR)/test/unistd/errno:
580 $(MAKE) -C $(UCLIBC_DIR)/test \
581 ARCH_CFLAGS=-I$(STAGING_DIR)/usr/include \
582 UCLIBC_ONLY=1 TEST_INSTALLED_UCLIBC=1 compile
584 $(TARGET_DIR)/root/uClibc/test/unistd/errno: $(UCLIBC_DIR)/test/unistd/errno
585 mkdir -p $(TARGET_DIR)/root/uClibc
586 cp -rdpf $(UCLIBC_DIR)/test $(TARGET_DIR)/root/uClibc
587 $(INSTALL) $(UCLIBC_DIR)/Rules.mak $(TARGET_DIR)/root/uClibc
588 $(INSTALL) $(UCLIBC_DIR)/.config $(TARGET_DIR)/root/uClibc
590 uclibc-test: uclibc $(TARGET_DIR)/root/uClibc/test/unistd/errno
592 uclibc-test-source: uclibc-source
594 uclibc-test-clean:
595 -$(MAKE) -C $(UCLIBC_DIR)/test clean
596 rm -rf $(TARGET_DIR)/root/uClibc
598 uclibc-test-dirclean:
599 rm -rf $(TARGET_DIR)/root/uClibc
601 #############################################################
603 # uClibc for the target just needs its header files
604 # and whatnot installed.
606 #############################################################
608 $(TARGET_DIR)/usr/lib/libc.a: $(STAGING_DIR)/usr/lib/libc.a
609 $(MAKE1) -C $(UCLIBC_DIR) \
610 PREFIX=$(TARGET_DIR) \
611 DEVEL_PREFIX=/usr/ \
612 RUNTIME_PREFIX=/ \
613 install_dev
614 # Install the kernel headers to the target dir if necessary
615 ifeq ($(LINUX_HEADERS_IS_KERNEL),y)
616 if [ ! -f $(TARGET_DIR)/usr/include/linux/version.h ]; then \
617 cp -pLR $(LINUX_HEADERS_DIR)/include/* \
618 $(TARGET_DIR)/usr/include/; \
620 else
621 if [ ! -f $(TARGET_DIR)/usr/include/linux/version.h ]; then \
622 cp -pLR $(LINUX_HEADERS_DIR)/include/asm \
623 $(TARGET_DIR)/usr/include/; \
624 cp -pLR $(LINUX_HEADERS_DIR)/include/linux \
625 $(TARGET_DIR)/usr/include/; \
626 if [ -d $(LINUX_HEADERS_DIR)/include/asm-generic ]; then \
627 cp -pLR $(LINUX_HEADERS_DIR)/include/asm-generic \
628 $(TARGET_DIR)/usr/include/; \
629 fi; \
631 endif
632 touch -c $@
634 uclibc_target: cross_compiler uclibc $(TARGET_DIR)/usr/lib/libc.a $(TARGET_DIR)/usr/bin/ldd
636 uclibc_target-clean: uclibc-test-clean
637 rm -rf $(TARGET_DIR)/usr/include \
638 $(TARGET_DIR)/usr/lib/libc.a $(TARGET_DIR)/usr/bin/ldd
640 uclibc_target-dirclean: uclibc-test-dirclean
641 rm -rf $(TARGET_DIR)/usr/include
643 endif