2 # Copyright (C) 2006 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
14 PKG_SOURCE
:=uClibc-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
).
tar.bz2
15 PKG_SOURCE_URL
:=http
://www.uclibc.org
/downloads
16 PKG_MD5SUM
:=61dc55f43b17a38a074f347e74095b20
19 STAGING_DIR_HOST
:=$(TOOLCHAIN_DIR
)
20 BUILD_DIR_HOST
:=$(BUILD_DIR_TOOLCHAIN
)
21 PKG_BUILD_DIR
:=$(BUILD_DIR_HOST
)/uClibc-
$(PKG_VERSION
)$(PKG_EXTRAVERSION
)
23 include $(INCLUDE_DIR
)/host-build.mk
25 STAMP_BUILT
:=$(TOOLCHAIN_DIR
)/stamp
/.uclibc_installed
26 STAMP_INSTALLED
:=$(TOOLCHAIN_DIR
)/stamp
/.uclibc-utils_installed
28 UCLIBC_TARGET_ARCH
:=$(shell echo
$(ARCH
) | sed
-e s
'/-.*//' \
30 -e
's/sparc.*/sparc/' \
32 -e
's/avr32.*/avr32/g' \
34 -e
's/ppc/powerpc/g' \
35 -e
's/v850.*/v850/g' \
37 -e
's/sh[234].*/sh/' \
39 -e
's/mipsel.*/mips/' \
44 $(call Build
/Prepare
/Default
)
45 $(CP
) config
/$(ARCH
)$(if
$(wildcard config
/$(ARCH
).
$(BOARD
)),$(BOARD
)) $(PKG_BUILD_DIR
)/.config
46 $(SED
) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(LINUX_HEADERS_DIR)/include\",g' \
47 -e
's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,y),g' \
48 -e
's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=$(if $(CONFIG_LARGEFILE),y,n),g' \
49 -e
's,.*DO_C99_MATH.*,DO_C99_MATH=$(if $(CONFIG_C99_MATH),y,n),g' \
50 $(PKG_BUILD_DIR
)/.config
51 mkdir
-p
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include
52 mkdir
-p
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/lib
53 mkdir
-p
$(BUILD_DIR_HOST
)/uClibc_dev
/lib
54 # if [ ! -f $(BUILD_DIR_HOST)/uClibc_dev/usr/include/linux/version.h ] ; then \
55 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
56 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(TOOLCHAIN_DIR)/include/ ; \
57 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(PKG_BUILD_DIR)/include/ ; \
59 if
[ ! -f
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include/linux
/version.h
] ; then \
60 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include/; \
61 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-
$(UCLIBC_TARGET_ARCH
) $(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include/; \
62 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-generic
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include/; \
63 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/linux
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include/; \
64 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm
$(TOOLCHAIN_DIR
)/include/ ; \
65 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-
$(UCLIBC_TARGET_ARCH
) $(TOOLCHAIN_DIR
)/include/ ; \
66 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-generic
$(TOOLCHAIN_DIR
)/include/ ; \
67 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/linux
$(TOOLCHAIN_DIR
)/include/ ; \
68 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm
$(PKG_BUILD_DIR
)/include/ ; \
69 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-
$(UCLIBC_TARGET_ARCH
) $(PKG_BUILD_DIR
)/include/ ; \
70 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-generic
$(PKG_BUILD_DIR
)/include/ ; \
71 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/linux
$(PKG_BUILD_DIR
)/include/ ; \
73 PATH
=$(TARGET_PATH
) $(MAKE
) -C
$(PKG_BUILD_DIR
) \
74 PREFIX
=$(BUILD_DIR_HOST
)/uClibc_dev
/ \
76 RUNTIME_PREFIX
=$(BUILD_DIR_HOST
)/uClibc_dev
/ \
78 CPU_CFLAGS
="$(TARGET_CFLAGS)" \
82 define Build
/Configure
85 UCLIBC_MAKE
:= PATH
=$(TARGET_PATH
) $(MAKE
) -C
$(PKG_BUILD_DIR
) \
86 $(TARGET_CONFIGURE_OPTS
) \
90 CPU_CFLAGS
="$(TARGET_CFLAGS)"
93 $(SED
) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR
)/Rules.mak
94 $(UCLIBC_MAKE
) PREFIX
= all
95 $(UCLIBC_MAKE
) PREFIX
=$(STAGING_DIR_HOST
)/ install_runtime install_dev
96 $(SED
) 's,UCLIBC_VERSION=.*,UCLIBC_VERSION=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
97 $(SED
) 's,UCLIBC_PATCHVER=.*,UCLIBC_PATCHVER=$(PKG_EXTRAVERSION),' $(TOOLCHAIN_DIR
)/info.mk
98 rm -rf
$(TOOLCHAIN_DIR
)/lib
/libc.so
99 ln
-s
$(TOOLCHAIN_DIR
)/lib
/libc.so
.0 $(TOOLCHAIN_DIR
)/lib
/libc.so
103 $(UCLIBC_MAKE
) PREFIX
= utils
104 $(INSTALL_DIR
) $(TOOLCHAIN_DIR
)/target-utils
106 $(PKG_BUILD_DIR
)/utils
/ldd \
107 $(PKG_BUILD_DIR
)/utils
/ldconfig \
108 $(TOOLCHAIN_DIR
)/target-utils
/
112 rm -rf
$(PKG_BUILD_DIR
) $(BUILD_DIR_HOST
)/uClibc_dev
115 $(eval
$(call HostBuild
))