install readelf to STAGING_DIR_HOST (eglibc requires it, not all systems have it)
[openwrt/openwrt.git] / toolchain / binutils / Makefile
1 #
2 # Copyright (C) 2006-2008 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
9 PKG_NAME:=binutils
10 PKG_VERSION:=$(call qstrip,$(CONFIG_BINUTILS_VERSION))
11
12 PKG_SOURCE_URL:=@GNU/binutils/
13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
14
15 ifeq ($(PKG_VERSION),2.17)
16 PKG_MD5SUM:=e26e2e06b6e4bf3acf1dc8688a94c0d1
17 endif
18 ifeq ($(PKG_VERSION),2.18)
19 PKG_MD5SUM:=9d22ee4dafa3a194457caf4706f9cf01
20 endif
21 ifeq ($(PKG_VERSION),2.19)
22 PKG_MD5SUM:=17a52219dee5a76c1a9d9b0bfd337d66
23 endif
24
25 PATCH_DIR:=./patches/$(PKG_VERSION)
26
27 REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST)
28 STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
29 BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
30
31 override CONFIG_AUTOREBUILD=
32
33 include $(INCLUDE_DIR)/host-build.mk
34
35 EXTRA_TARGET=$(if $(CONFIG_EXTRA_TARGET_ARCH),--enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX))
36
37 define Build/Prepare
38 $(call Build/Prepare/Default)
39 ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
40 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/
41 endef
42
43 define Build/Configure
44 (cd $(PKG_BUILD_DIR); \
45 ./configure \
46 --prefix=$(TOOLCHAIN_DIR)/usr \
47 --build=$(GNU_HOST_NAME) \
48 --host=$(GNU_HOST_NAME) \
49 --target=$(REAL_GNU_TARGET_NAME) \
50 --with-sysroot=$(TOOLCHAIN_DIR) \
51 --disable-multilib \
52 --disable-werror \
53 --disable-nls \
54 $(EXTRA_TARGET) \
55 $(SOFT_FLOAT_CONFIG_OPTION) \
56 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS)) \
57 );
58 endef
59
60 define Build/Compile
61 $(MAKE) -C $(PKG_BUILD_DIR) all
62 endef
63
64 define Build/Install
65 $(MAKE) -C $(PKG_BUILD_DIR) install
66 $(CP) $(TOOLCHAIN_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
67 endef
68
69 define Build/Clean
70 rm -rf \
71 $(PKG_BUILD_DIR) \
72 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
73 endef
74
75 $(eval $(call HostBuild))