2 # Copyright (C) 2006-2009 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR
)/rules.mk
8 include $(INCLUDE_DIR
)/target.mk
11 PKG_VERSION
:=$(call qstrip
,$(CONFIG_UCLIBC_VERSION
))
12 PKG_EXTRAVERSION
:=$(call qstrip
,$(CONFIG_UCLIBC_EXTRA_VERSION
))
13 PKG_VERSION_SNAPSHOT
:=$(call qstrip
,$(CONFIG_UCLIBC_VERSION_SNAPSHOT
))
14 ifeq ($(PKG_VERSION_SNAPSHOT
),y
)
15 PKG_SOURCE_URL
:=http
://www.uclibc.org
/downloads
/snapshots
16 PKG_SOURCE
:=uClibc-snapshot.
tar.bz2
18 PKG_SOURCE_URL
:=http
://www.uclibc.org
/downloads
19 PKG_SOURCE
:=uClibc-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
).
tar.bz2
21 PATCH_DIR
:=$(firstword $(wildcard .
/patches-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
) .
/patches-
$(PKG_VERSION
)))
22 CONFIG_DIR
:=$(firstword $(wildcard .
/config-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
) .
/config-
$(PKG_VERSION
)))
24 PKG_MD5SUM_0.9
.28.2 = 959f25286e317f0d9e2103445c5a14c2
25 PKG_MD5SUM_0.9
.28.3 = 428405a36b4662980d9343b32089b5a6
26 PKG_MD5SUM_0.9
.29 = 61dc55f43b17a38a074f347e74095b20
27 PKG_MD5SUM_0.9
.30 = e5766e2566e0297adebebbcc0aba1f2d
28 PKG_MD5SUM
=$(PKG_MD5SUM_
$(PKG_VERSION
)$(PKG_EXTRAVERSION
))
30 ifeq ($(PKG_VERSION_SNAPSHOT
),y
)
32 CONFIG_DIR
:=.
/config-0.9
.30
36 ifeq ($(PKG_VERSION_SNAPSHOT
),y
)
37 HOST_BUILD_DIR
:=$(BUILD_DIR_TOOLCHAIN
)/uClibc-
$(PKG_EXTRAVERSION
)
39 HOST_BUILD_DIR
:=$(BUILD_DIR_TOOLCHAIN
)/uClibc-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
)
42 include $(INCLUDE_DIR
)/toolchain-build.mk
44 HOST_STAMP_BUILT
:=$(TOOLCHAIN_DIR
)/stamp
/.uclibc_installed
45 HOST_STAMP_INSTALLED
:=$(TOOLCHAIN_DIR
)/stamp
/.uclibc-utils_installed
47 UCLIBC_TARGET_ARCH
:=$(shell echo
$(ARCH
) | sed
-e s
'/-.*//' \
49 -e
's/sparc.*/sparc/' \
51 -e
's/avr32.*/avr32/g' \
53 -e
's/ppc/powerpc/g' \
54 -e
's/v850.*/v850/g' \
56 -e
's/sh[234].*/sh/' \
58 -e
's/mipsel.*/mips/' \
63 define Host
/SetToolchainInfo
64 $(SED
) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR
)/info.mk
65 $(SED
) 's,^\(LIBC_URL\)=.*,\1=http://www.uclibc.org/,' $(TOOLCHAIN_DIR
)/info.mk
66 $(SED
) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
67 $(SED
) 's,^\(LIBC_PATCHVER\)=.*,\1=$(PKG_EXTRAVERSION),' $(TOOLCHAIN_DIR
)/info.mk
70 define Host
/Prepare
/Snapshot
72 rm -Rf
$(HOST_BUILD_DIR
)
73 ln
-snf
$(BUILD_DIR_TOOLCHAIN
)/uClibc
$(HOST_BUILD_DIR
)
75 $(if
$(QUILT
),touch
$(HOST_BUILD_DIR
)/.quilt_used
)
78 define Host
/Prepare
/V_0_9_28
79 $(SED
) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(BUILD_DIR_TOOLCHAIN)/linux\",g' \
80 $(HOST_BUILD_DIR
)/.config
81 ifeq ($(CONFIG_SOFT_FLOAT
),y
)
82 $(SED
) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(HOST_BUILD_DIR
)/.config
84 ifeq ($(CONFIG_C99_MATH
),y
)
85 $(SED
) 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' $(HOST_BUILD_DIR
)/.config
90 $(call Host
/SetToolchainInfo
)
91 @echo prepare uClibc version
$(PKG_VERSION
)$(PKG_EXTRAVERSION
)
92 ifeq ($(PKG_VERSION_SNAPSHOT
),y
)
93 $(call Host
/Prepare
/Snapshot
)
95 $(call Host
/Prepare
/Default
)
96 ln
-snf
$(PKG_NAME
)-$(PKG_VERSION
) $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
98 $(CP
) .
/$(CONFIG_DIR
)/$(ARCH
)$(if
$(wildcard $(CONFIG_DIR
)/$(ARCH
).
$(BOARD
)),.
$(BOARD
)) $(HOST_BUILD_DIR
)/.config
99 ifeq ($(PKG_VERSION
),0.9.28)
100 $(call Host
/Prepare
/V_0_9_28
)
102 $(SED
) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include\",g' \
103 -e
's,^.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n,y),g' \
104 -e
's,^.*UCLIBC_HAS_SOFT_FLOAT.*,UCLIBC_HAS_SOFT_FLOAT=$(if $(CONFIG_SOFT_FLOAT),y,n),g' \
105 -e
's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=$(if $(CONFIG_LARGEFILE),y,n),g' \
106 -e
's,^.*CONFIG_ARM_EABI.*,CONFIG_ARM_EABI=$(if $(CONFIG_EABI_SUPPORT),y,n),g' \
107 -e
's,^.*CONFIG_ARM_OABI.*,CONFIG_ARM_OABI=$(if $(CONFIG_EABI_SUPPORT),n,y),g' \
108 -e
's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=$(if $(CONFIG_SHADOW_PASSWORDS),y,n),g' \
109 $(HOST_BUILD_DIR
)/.config
110 $(MAKE
) -C
$(HOST_BUILD_DIR
)/extra
/config conf KBUILD_HAVE_NLS
= HOSTCFLAGS
="-DKBUILD_NO_NLS"
111 PATH
=$(TARGET_PATH
) $(MAKE
) -C
$(HOST_BUILD_DIR
) \
112 PREFIX
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
114 RUNTIME_PREFIX
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
117 CPU_CFLAGS
="$(TARGET_CFLAGS)" \
119 $(if
$(CONFIG_UCLIBC_VERSION_0_9_28
),install_dev
,install_headers
)
122 define Host
/Configure
125 UCLIBC_MAKE
:= PATH
=$(TARGET_PATH
) $(MAKE
) -C
$(HOST_BUILD_DIR
) \
126 $(TARGET_CONFIGURE_OPTS
) \
130 CPU_CFLAGS
="$(TARGET_CFLAGS)" \
134 $(SED
) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(HOST_BUILD_DIR
)/Rules.mak
135 $(UCLIBC_MAKE
) PREFIX
= all
136 $(UCLIBC_MAKE
) PREFIX
="$(TOOLCHAIN_DIR)/" install_runtime install_dev
137 ln
-sf ..
/..
/lib
/libc.so
.0 $(TOOLCHAIN_DIR
)/usr
/lib
/libc.so
138 # ( cd $(TOOLCHAIN_DIR) ; \
139 # for d in lib usr/lib ; do \
140 # for f in libc.so libpthread.so libgcc_s.so ; do \
141 # if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
142 # $(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
150 $(UCLIBC_MAKE
) PREFIX
= utils
151 $(INSTALL_DIR
) $(TOOLCHAIN_DIR
)/usr
/bin
153 $(HOST_BUILD_DIR
)/utils
/ldd \
154 $(TOOLCHAIN_DIR
)/usr
/bin
/
155 $(INSTALL_DIR
) $(TOOLCHAIN_DIR
)/sbin
157 $(HOST_BUILD_DIR
)/utils
/ldconfig \
158 $(TOOLCHAIN_DIR
)/sbin
/
164 $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
) \
165 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
168 $(eval
$(call HostBuild
))