2 # Copyright (C) 2006-2013 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
10 PKG_VERSION:=$(call qstrip,$(CONFIG_BINUTILS_VERSION))
11 BIN_VERSION:=$(PKG_VERSION)
13 PKG_SOURCE_URL:=@GNU/binutils/
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 ifeq ($(PKG_VERSION),2.27)
17 PKG_HASH:=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88
20 ifeq ($(PKG_VERSION),2.28)
21 PKG_HASH:=6297433ee120b11b4b0a1c8f3512d7d73501753142ab9e2daa13c5a3edd32a72
24 ifneq ($(CONFIG_BINUTILS_VERSION_2_26_ARC),)
25 PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/arc-2016.03/
27 PKG_SOURCE:=$(PKG_NAME)-arc-$(PKG_REV).tar.gz
28 PKG_HASH:=6583a0cd5c7251dc895a47c797a9b011e466c23377d2ca7548a707fdb918fba1
29 BINUTILS_DIR:=$(PKG_NAME)-gdb-arc-$(PKG_REV)
30 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
33 HOST_BUILD_PARALLEL:=1
35 PATCH_DIR:=./patches/$(PKG_VERSION)
37 REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST)
39 include $(INCLUDE_DIR)/toolchain-build.mk
41 BINUTILS_CONFIGURE:= \
43 --prefix=$(TOOLCHAIN_DIR) \
44 --build=$(GNU_HOST_NAME) \
45 --host=$(GNU_HOST_NAME) \
46 --target=$(REAL_GNU_TARGET_NAME) \
47 --with-sysroot=$(TOOLCHAIN_DIR) \
48 --enable-deterministic-archives \
55 $(GRAPHITE_CONFIGURE) \
56 $(SOFT_FLOAT_CONFIG_OPTION) \
57 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
59 ifneq ($(CONFIG_SSP_SUPPORT),)
60 BINUTILS_CONFIGURE+= \
63 BINUTILS_CONFIGURE+= \
67 ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
68 BINUTILS_CONFIGURE+= \
69 --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
73 $(call Host/Prepare/Default)
74 ln -snf $(notdir $(HOST_BUILD_DIR)) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
75 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
76 $(SED) 's, " Linaro.*,,' $(HOST_BUILD_DIR)/bfd/version.h
80 (cd $(HOST_BUILD_DIR); \
81 $(BINUTILS_CONFIGURE) \
86 +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
90 mkdir -p $(TOOLCHAIN_DIR)/initial
91 $(MAKE) -C $(HOST_BUILD_DIR) \
92 prefix=$(TOOLCHAIN_DIR)/initial \
94 $(MAKE) -C $(HOST_BUILD_DIR) \
95 prefix=$(TOOLCHAIN_DIR) \
97 $(call FixupLibdir,$(TOOLCHAIN_DIR)/initial)
98 $(RM) $(TOOLCHAIN_DIR)/initial/lib/libiberty.a
99 $(CP) $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
100 # ARC gcc requires extlib.
101 # If extlib is not available in "initial" folder
102 # initial gcc will fail to build libc.
103 if [ -d $(TOOLCHAIN_DIR)/extlib ]; then \
104 $(CP) -r $(TOOLCHAIN_DIR)/extlib $(TOOLCHAIN_DIR)/initial/; \
111 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
114 $(eval $(call HostBuild))