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.xz
16 TAR_OPTIONS += --exclude='*.rej'
18 ifeq ($(PKG_VERSION),2.29.1)
19 PKG_HASH:=e7010a46969f9d3e53b650a518663f98a5dde3c3ae21b7d71e5e6803bc36b577
22 ifeq ($(PKG_VERSION),2.30)
23 PKG_HASH:=6e46b8aeae2f727a36f0bd9505e405768a72218f1796f0d09757d45209871ae6
26 ifeq ($(PKG_VERSION),2.31.1)
27 PKG_HASH:=5d20086ecf5752cc7d9134246e9588fa201740d540f7eb84d795b1f7a93bca86
30 ifneq ($(CONFIG_BINUTILS_VERSION_2_29_ARC),)
31 PKG_REV:=arc-2017.09-release
32 PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/$(PKG_REV)/
33 PKG_SOURCE:=$(PKG_NAME)-$(PKG_REV).tar.gz
34 PKG_HASH:=2ea086fd5521e942926dd6ff6922ce31c29ee7ffc754fca3d06385e0f27600f8
35 BINUTILS_DIR:=$(PKG_NAME)-gdb-$(PKG_REV)
36 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
39 HOST_BUILD_PARALLEL:=1
41 PATCH_DIR:=./patches/$(PKG_VERSION)
43 include $(INCLUDE_DIR)/toolchain-build.mk
45 BINUTILS_CONFIGURE:= \
47 --prefix=$(TOOLCHAIN_DIR) \
48 --build=$(GNU_HOST_NAME) \
49 --host=$(GNU_HOST_NAME) \
50 --target=$(REAL_GNU_TARGET_NAME) \
51 --with-sysroot=$(TOOLCHAIN_DIR) \
52 --enable-deterministic-archives \
59 $(GRAPHITE_CONFIGURE) \
60 $(SOFT_FLOAT_CONFIG_OPTION) \
61 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
63 ifneq ($(CONFIG_SSP_SUPPORT),)
64 BINUTILS_CONFIGURE+= \
67 BINUTILS_CONFIGURE+= \
71 ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
72 BINUTILS_CONFIGURE+= \
73 --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
77 $(call Host/Prepare/Default)
78 ln -snf $(notdir $(HOST_BUILD_DIR)) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
79 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
80 $(SED) 's, " Linaro.*,,' $(HOST_BUILD_DIR)/bfd/version.h
84 (cd $(HOST_BUILD_DIR); \
85 $(BINUTILS_CONFIGURE) \
90 +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
94 mkdir -p $(TOOLCHAIN_DIR)/initial
95 $(MAKE) -C $(HOST_BUILD_DIR) \
96 prefix=$(TOOLCHAIN_DIR)/initial \
98 $(MAKE) -C $(HOST_BUILD_DIR) \
99 prefix=$(TOOLCHAIN_DIR) \
101 $(call FixupLibdir,$(TOOLCHAIN_DIR)/initial)
102 $(RM) $(TOOLCHAIN_DIR)/initial/lib/libiberty.a
103 $(CP) $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-readelf $(HOST_BUILD_PREFIX)/bin/readelf
104 # ARC gcc requires extlib.
105 # If extlib is not available in "initial" folder
106 # initial gcc will fail to build libc.
107 if [ -d $(TOOLCHAIN_DIR)/extlib ]; then \
108 $(CP) -r $(TOOLCHAIN_DIR)/extlib $(TOOLCHAIN_DIR)/initial/; \
115 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
118 $(eval $(call HostBuild))