2 # Copyright (C) 2006-2011 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 ifeq ($(PKG_VERSION
),0.9.32)
13 PKG_SOURCE_URL
:=git
://git.busybox.net
/uClibc
15 PKG_SOURCE_VERSION
:=9112a2398ec58b32cd1a1c6feae195bd8f9a46a2
16 PKG_SOURCE_SUBDIR
:=$(PKG_NAME
)-$(PKG_VERSION
)
17 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
)-$(PKG_SOURCE_VERSION
).
tar.gz
18 LIBC_SO_VERSION
:=$(PKG_VERSION
)-rc2-git
20 PKG_SOURCE_URL
:=http
://www.uclibc.org
/downloads
21 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
22 LIBC_SO_VERSION
:=$(PKG_VERSION
)
24 PATCH_DIR
:=.
/patches-
$(PKG_VERSION
)
25 CONFIG_DIR
:=.
/config-
$(PKG_VERSION
)
27 PKG_MD5SUM
=$(PKG_MD5SUM_
$(PKG_VERSION
))
29 HOST_BUILD_DIR
:=$(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)-$(PKG_VERSION
)
31 include $(INCLUDE_DIR
)/toolchain-build.mk
33 HOST_STAMP_BUILT
:=$(TOOLCHAIN_DIR
)/stamp
/.uclibc_installed
34 HOST_STAMP_INSTALLED
:=$(TOOLCHAIN_DIR
)/stamp
/.uclibc-utils_installed
36 UCLIBC_TARGET_ARCH
:=$(shell echo
$(ARCH
) | sed
-e s
'/-.*//' \
38 -e
's/sparc.*/sparc/' \
40 -e
's/avr32.*/avr32/g' \
42 -e
's/ppc/powerpc/g' \
43 -e
's/v850.*/v850/g' \
45 -e
's/sh[234].*/sh/' \
47 -e
's/mipsel.*/mips/' \
52 define Host
/SetToolchainInfo
53 $(SED
) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR
)/info.mk
54 $(SED
) 's,^\(LIBC_URL\)=.*,\1=http://www.uclibc.org/,' $(TOOLCHAIN_DIR
)/info.mk
55 $(SED
) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
56 $(SED
) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(LIBC_SO_VERSION),' $(TOOLCHAIN_DIR
)/info.mk
59 GEN_CONFIG
=$(SCRIPT_DIR
)/kconfig.pl
-n \
60 $(if
$(wildcard $(CONFIG_DIR
)/common
),'+' $(CONFIG_DIR
)/common
) \
61 $(if
$(CONFIG_UCLIBC_ENABLE_DEBUG
),$(if
$(wildcard $(CONFIG_DIR
)/debug
),'+' $(CONFIG_DIR
)/debug
)) \
62 $(CONFIG_DIR
)/$(ARCH
)$(if
$(wildcard $(CONFIG_DIR
)/$(ARCH
).
$(BOARD
)),.
$(BOARD
))
65 $(call Host
/Prepare
/Default
)
66 $(if
$(strip $(QUILT
)), \
67 cd
$(HOST_BUILD_DIR
); \
68 if
$(QUILT_CMD
) next
>/dev
/null
2>&1; then \
69 $(QUILT_CMD
) push
-a
; \
72 ln
-snf
$(PKG_NAME
)-$(PKG_VERSION
) $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
)
73 $(GEN_CONFIG
) > $(HOST_BUILD_DIR
)/.config
74 $(SED
) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(BUILD_DIR_TOOLCHAIN)/linux-dev/include\",g' \
75 -e
's,^.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n,y),g' \
76 -e
's,^.*UCLIBC_HAS_SOFT_FLOAT.*,UCLIBC_HAS_SOFT_FLOAT=$(if $(CONFIG_SOFT_FLOAT),y,n),g' \
77 -e
's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=$(if $(CONFIG_SHADOW_PASSWORDS),y,n),g' \
78 $(HOST_BUILD_DIR
)/.config
79 $(MAKE
) -C
$(HOST_BUILD_DIR
) oldconfig KBUILD_HAVE_NLS
= HOSTCFLAGS
="-DKBUILD_NO_NLS"
80 $(MAKE
) -C
$(HOST_BUILD_DIR
)/extra
/config conf KBUILD_HAVE_NLS
= HOSTCFLAGS
="-DKBUILD_NO_NLS"
81 PATH
='$(TARGET_PATH)' $(MAKE
) -C
$(HOST_BUILD_DIR
) \
82 PREFIX
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
84 RUNTIME_PREFIX
="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
87 CPU_CFLAGS
="$(TARGET_CFLAGS)" \
88 ARCH
="$(CONFIG_ARCH)" \
97 -funsigned-char
-fno-builtin
-fno-asm \
98 --std
=gnu99
-ffunction-sections
-fdata-sections \
101 UCLIBC_MAKE
= PATH
='$(TARGET_PATH)' $(MAKE
) -C
$(HOST_BUILD_DIR
) \
102 $(TARGET_CONFIGURE_OPTS
) \
106 CPU_CFLAGS
="$(CPU_CFLAGS)" \
107 ARCH
="$(CONFIG_ARCH)" \
108 LIBGCC
="$(subst libgcc.a,libgcc_initial.a,$(shell $(TARGET_CC) -print-libgcc-file-name))" \
112 $(SED
) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(HOST_BUILD_DIR
)/Rules.mak
113 $(UCLIBC_MAKE
) $(TOOLCHAIN_JOBS
) PREFIX
= all
114 $(UCLIBC_MAKE
) PREFIX
="$(TOOLCHAIN_DIR)/" install_runtime install_dev
115 $(CP
) $(HOST_BUILD_DIR
)/libc
/libc_so.a
$(TOOLCHAIN_DIR
)/lib
/
116 $(CP
) $(HOST_BUILD_DIR
)/libpthread
/*/libpthread_so.a
$(TOOLCHAIN_DIR
)/lib
/
117 ( cd
$(TOOLCHAIN_DIR
) ; \
118 for d in lib usr
/lib
; do \
119 for f in libc.so libpthread.so libgcc_s.so
; do \
120 if
[ -f
$$$$d/$$$$f -a
! -L
$$$$d/$$$$f ] ; then \
121 $(SED
) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
127 $(TOOLCHAIN_DIR
)/lib
/libresolv
*.so
* \
128 $(TOOLCHAIN_DIR
)/lib
/libnsl
*.so
*
132 $(call Host
/SetToolchainInfo
)
133 $(UCLIBC_MAKE
) PREFIX
= utils
134 $(INSTALL_DIR
) $(TOOLCHAIN_DIR
)/bin
136 $(HOST_BUILD_DIR
)/utils
/ldd \
137 $(TOOLCHAIN_DIR
)/bin
/
138 $(INSTALL_DIR
) $(TOOLCHAIN_DIR
)/sbin
140 $(HOST_BUILD_DIR
)/utils
/ldconfig \
141 $(TOOLCHAIN_DIR
)/sbin
/
147 $(BUILD_DIR_TOOLCHAIN
)/$(PKG_NAME
) \
148 $(BUILD_DIR_TOOLCHAIN
)/$(LIBC
)-dev
151 $(eval
$(call HostBuild
))