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 $(PKG_BUILD_DIR
)/.config
50 mkdir
-p
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include
51 mkdir
-p
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/lib
52 mkdir
-p
$(BUILD_DIR_HOST
)/uClibc_dev
/lib
53 # if [ ! -f $(BUILD_DIR_HOST)/uClibc_dev/usr/include/linux/version.h ] ; then \
54 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
55 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(TOOLCHAIN_DIR)/include/ ; \
56 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(PKG_BUILD_DIR)/include/ ; \
58 if
[ ! -f
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include/linux
/version.h
] ; then \
59 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include/; \
60 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-
$(UCLIBC_TARGET_ARCH
) $(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include/; \
61 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-generic
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include/; \
62 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/linux
$(BUILD_DIR_HOST
)/uClibc_dev
/usr
/include/; \
63 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm
$(TOOLCHAIN_DIR
)/include/ ; \
64 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-
$(UCLIBC_TARGET_ARCH
) $(TOOLCHAIN_DIR
)/include/ ; \
65 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-generic
$(TOOLCHAIN_DIR
)/include/ ; \
66 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/linux
$(TOOLCHAIN_DIR
)/include/ ; \
67 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm
$(PKG_BUILD_DIR
)/include/ ; \
68 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-
$(UCLIBC_TARGET_ARCH
) $(PKG_BUILD_DIR
)/include/ ; \
69 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/asm-generic
$(PKG_BUILD_DIR
)/include/ ; \
70 cp
-pLR
$(BUILD_DIR_TOOLCHAIN
)/linux
/include/linux
$(PKG_BUILD_DIR
)/include/ ; \
72 PATH
=$(TARGET_PATH
) $(MAKE
) -C
$(PKG_BUILD_DIR
) \
73 PREFIX
=$(BUILD_DIR_HOST
)/uClibc_dev
/ \
75 RUNTIME_PREFIX
=$(BUILD_DIR_HOST
)/uClibc_dev
/ \
77 CPU_CFLAGS
="$(TARGET_CFLAGS)" \
81 define Build
/Configure
84 UCLIBC_MAKE
:= PATH
=$(TARGET_PATH
) $(MAKE
) -C
$(PKG_BUILD_DIR
) \
85 $(TARGET_CONFIGURE_OPTS
) \
89 CPU_CFLAGS
="$(TARGET_CFLAGS)"
92 $(SED
) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR
)/Rules.mak
93 $(UCLIBC_MAKE
) PREFIX
= all
94 $(UCLIBC_MAKE
) PREFIX
=$(STAGING_DIR_HOST
)/ install_runtime install_dev
95 $(SED
) 's,UCLIBC_VERSION=.*,UCLIBC_VERSION=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
96 $(SED
) 's,UCLIBC_PATCHVER=.*,UCLIBC_PATCHVER=$(PKG_EXTRAVERSION),' $(TOOLCHAIN_DIR
)/info.mk
97 rm -rf
$(TOOLCHAIN_DIR
)/lib
/libc.so
98 ln
-s
$(TOOLCHAIN_DIR
)/lib
/libc.so
.0 $(TOOLCHAIN_DIR
)/lib
/libc.so
102 $(UCLIBC_MAKE
) PREFIX
= utils
103 $(INSTALL_DIR
) $(TOOLCHAIN_DIR
)/target-utils
105 $(PKG_BUILD_DIR
)/utils
/ldd \
106 $(PKG_BUILD_DIR
)/utils
/ldconfig \
107 $(TOOLCHAIN_DIR
)/target-utils
/
111 rm -rf
$(PKG_BUILD_DIR
) $(BUILD_DIR_HOST
)/uClibc_dev
114 $(eval
$(call HostBuild
))