91d982c002318fb47f143410f48a2c697703bb69
[openwrt/svn-archive/archive.git] / toolchain / binutils / Makefile
1 #
2 # Copyright (C) 2006-2009 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 BIN_VERSION:=$(PKG_VERSION)
12
13 PKG_SOURCE_URL:=@GNU/binutils/
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15
16 ifeq ($(PKG_VERSION),2.18)
17 PKG_MD5SUM:=9d22ee4dafa3a194457caf4706f9cf01
18 endif
19 ifeq ($(PKG_VERSION),2.19.1)
20 PKG_MD5SUM:=09a8c5821a2dfdbb20665bc0bd680791
21 endif
22 ifeq ($(PKG_VERSION),2.19.1+cs)
23 BIN_VERSION:=20090205
24 PKG_SOURCE:=$(PKG_NAME)-$(BIN_VERSION).tar.bz2
25 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
26 PKG_MD5SUM:=040740e8c864dd1a15886753f9c0bc0b
27 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/binutils-$(BIN_VERSION)
28 endif
29 ifeq ($(PKG_VERSION),2.20)
30 PKG_MD5SUM:=ee2d3e996e9a2d669808713360fa96f8
31 endif
32
33 PATCH_DIR:=./patches/$(PKG_VERSION)
34
35 REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST)
36
37 include $(INCLUDE_DIR)/toolchain-build.mk
38
39 BINUTILS_CONFIGURE:= \
40 ./configure \
41 --prefix=$(TOOLCHAIN_DIR)/usr \
42 --build=$(GNU_HOST_NAME) \
43 --host=$(GNU_HOST_NAME) \
44 --target=$(REAL_GNU_TARGET_NAME) \
45 --with-sysroot=$(TOOLCHAIN_DIR) \
46 --disable-multilib \
47 --disable-werror \
48 --disable-nls \
49 $(if $(CONFIG_GCC_VERSION_4_4), \
50 --with-ppl=$(REAL_STAGING_DIR_HOST) \
51 --with-cloog=$(REAL_STAGING_DIR_HOST) \
52 ) \
53 $(SOFT_FLOAT_CONFIG_OPTION) \
54 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS)) \
55
56 ifneq ($(CONFIG_SSP_SUPPORT),)
57 BINUTILS_CONFIGURE+= \
58 --enable-libssp
59 else
60 BINUTILS_CONFIGURE+= \
61 --disable-libssp
62 endif
63
64 ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
65 BINUTILS_CONFIGURE+= \
66 --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
67 endif
68
69 define Host/Prepare
70 $(call Host/Prepare/Default)
71 ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
72 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
73 endef
74
75 define Host/Configure
76 (cd $(HOST_BUILD_DIR); \
77 $(BINUTILS_CONFIGURE) \
78 );
79 endef
80
81 define Host/Compile
82 $(MAKE) -C $(HOST_BUILD_DIR) all
83 endef
84
85 define Host/Install
86 $(MAKE) -C $(HOST_BUILD_DIR) install
87 $(CP) $(TOOLCHAIN_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
88 endef
89
90 define Host/Clean
91 rm -rf \
92 $(HOST_BUILD_DIR) \
93 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
94 endef
95
96 $(eval $(call HostBuild))