02765126e92d056c5637a0edf602d2d63e93ad3b
[openwrt/openwrt.git] / toolchain / binutils / Makefile
1 #
2 # Copyright (C) 2006-2013 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:=https://releases.linaro.org/14.09/components/toolchain/binutils-linaro/
14 PKG_REV:=2.24.0-2014.09
15 PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.xz
16 PKG_MD5SUM:=8f9b2b2e049d59b1b86ce9657802a353
17 BINUTILS_DIR:=$(PKG_NAME)-linaro-$(PKG_REV)
18 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
19
20 HOST_BUILD_PARALLEL:=1
21
22 PATCH_DIR:=./patches/$(PKG_VERSION)
23
24 REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST)
25
26 include $(INCLUDE_DIR)/toolchain-build.mk
27
28 BINUTILS_CONFIGURE:= \
29 ./configure \
30 --prefix=$(TOOLCHAIN_DIR) \
31 --build=$(GNU_HOST_NAME) \
32 --host=$(GNU_HOST_NAME) \
33 --target=$(REAL_GNU_TARGET_NAME) \
34 --with-sysroot=$(TOOLCHAIN_DIR) \
35 --enable-deterministic-archives \
36 --enable-plugins \
37 --disable-multilib \
38 --disable-werror \
39 --disable-nls \
40 $(GRAPHITE_CONFIGURE) \
41 $(SOFT_FLOAT_CONFIG_OPTION) \
42 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
43
44 ifneq ($(CONFIG_SSP_SUPPORT),)
45 BINUTILS_CONFIGURE+= \
46 --enable-libssp
47 else
48 BINUTILS_CONFIGURE+= \
49 --disable-libssp
50 endif
51
52 ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
53 BINUTILS_CONFIGURE+= \
54 --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
55 endif
56
57 define Host/Prepare
58 $(call Host/Prepare/Default)
59 ln -snf $(notdir $(HOST_BUILD_DIR)) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
60 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
61 $(SED) 's, " Linaro.*,,' $(HOST_BUILD_DIR)/bfd/version.h
62 endef
63
64 define Host/Configure
65 (cd $(HOST_BUILD_DIR); \
66 $(BINUTILS_CONFIGURE) \
67 );
68 endef
69
70 define Host/Compile
71 +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
72 endef
73
74 define Host/Install
75 mkdir -p $(TOOLCHAIN_DIR)/initial
76 $(MAKE) -C $(HOST_BUILD_DIR) \
77 prefix=$(TOOLCHAIN_DIR)/initial \
78 install
79 $(MAKE) -C $(HOST_BUILD_DIR) \
80 prefix=$(TOOLCHAIN_DIR) \
81 install
82 $(call FixupLibdir,$(TOOLCHAIN_DIR)/initial)
83 $(RM) $(TOOLCHAIN_DIR)/initial/lib/libiberty.a
84 $(CP) $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
85 endef
86
87 define Host/Clean
88 rm -rf \
89 $(HOST_BUILD_DIR) \
90 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
91 endef
92
93 $(eval $(call HostBuild))