Fix the imagebuilder generation (does not mean it works with the recent changes)
[openwrt.git] / toolchain / uClibc / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/target.mk
9
10 PKG_NAME:=uClibc
11 PKG_VERSION:=0.9.28
12 PKG_EXTRAVERSION:=.2
13
14 PKG_SOURCE:=uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.uclibc.org/downloads
16 PKG_MD5SUM:=959f25286e317f0d9e2103445c5a14c2
17 PKG_CAT:=bzcat
18
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)
22
23 include $(INCLUDE_DIR)/host-build.mk
24
25 STAMP_BUILT:=$(STAGING_DIR)/stamp/.uclibc_installed
26 STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.uclibc-utils_installed
27
28 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
29 -e 's/i.86/i386/' \
30 -e 's/sparc.*/sparc/' \
31 -e 's/arm.*/arm/g' \
32 -e 's/avr32.*/avr32/g' \
33 -e 's/m68k.*/m68k/' \
34 -e 's/ppc/powerpc/g' \
35 -e 's/v850.*/v850/g' \
36 -e 's/sh64/sh/' \
37 -e 's/sh[234].*/sh/' \
38 -e 's/mips.*/mips/' \
39 -e 's/mipsel.*/mips/' \
40 -e 's/cris.*/cris/' \
41 )
42
43 define Build/Prepare
44 $(call Build/Prepare/Default)
45 $(CP) config/$(ARCH)$(if $(wildcard config/$(ARCH).$(BOARD)),$(BOARD)) $(PKG_BUILD_DIR)/.config
46 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
47 -e 's,.*HAS_FPU.*,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 PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
55 PREFIX=$(BUILD_DIR_HOST)/uClibc_dev/ \
56 DEVEL_PREFIX=/usr/ \
57 RUNTIME_PREFIX=$(BUILD_DIR_HOST)/uClibc_dev/ \
58 HOSTCC="$(HOSTCC)" \
59 CPU_CFLAGS="$(TARGET_CFLAGS)" \
60 pregen install_dev;
61 endef
62
63 define Build/Configure
64 endef
65
66 UCLIBC_MAKE := PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
67 DEVEL_PREFIX=/ \
68 RUNTIME_PREFIX=/ \
69 HOSTCC="$(HOSTCC)" \
70 CPU_CFLAGS="$(TARGET_CFLAGS)"
71
72 define Build/Compile
73 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR)/Rules.mak
74 $(UCLIBC_MAKE) PREFIX= all
75 $(UCLIBC_MAKE) PREFIX=$(STAGING_DIR_HOST)/ install_runtime install_dev
76 $(SED) 's,UCLIBC_VERSION=.*,UCLIBC_VERSION=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
77 $(SED) 's,UCLIBC_PATCHVER=.*,UCLIBC_PATCHVER=$(PKG_EXTRAVERSION),' $(TOOLCHAIN_DIR)/info.mk
78 endef
79
80 define Build/Install
81 $(UCLIBC_MAKE) PREFIX= utils
82 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/target-utils
83 $(INSTALL_BIN) \
84 $(PKG_BUILD_DIR)/utils/ldd \
85 $(PKG_BUILD_DIR)/utils/ldconfig \
86 $(TOOLCHAIN_DIR)/target-utils/
87 endef
88
89 define Build/Clean
90 rm -rf $(PKG_BUILD_DIR) $(BUILD_DIR_HOST)/uClibc_dev
91 endef
92
93 $(eval $(call HostBuild))
This page took 0.039534 seconds and 5 git commands to generate.