glibc: update to version 2.25
[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:=@GNU/binutils/
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15
16 ifeq ($(PKG_VERSION),2.27)
17 PKG_HASH:=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88
18 endif
19
20 ifneq ($(CONFIG_BINUTILS_VERSION_2_26_ARC),)
21 PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/arc-2016.03/
22 PKG_REV:=2016.03
23 PKG_SOURCE:=$(PKG_NAME)-arc-$(PKG_REV).tar.gz
24 PKG_HASH:=6583a0cd5c7251dc895a47c797a9b011e466c23377d2ca7548a707fdb918fba1
25 BINUTILS_DIR:=$(PKG_NAME)-gdb-arc-$(PKG_REV)
26 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
27 endif
28
29 HOST_BUILD_PARALLEL:=1
30
31 PATCH_DIR:=./patches/$(PKG_VERSION)
32
33 REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST)
34
35 include $(INCLUDE_DIR)/toolchain-build.mk
36
37 BINUTILS_CONFIGURE:= \
38 ./configure \
39 --prefix=$(TOOLCHAIN_DIR) \
40 --build=$(GNU_HOST_NAME) \
41 --host=$(GNU_HOST_NAME) \
42 --target=$(REAL_GNU_TARGET_NAME) \
43 --with-sysroot=$(TOOLCHAIN_DIR) \
44 --enable-deterministic-archives \
45 --enable-plugins \
46 --disable-multilib \
47 --disable-werror \
48 --disable-nls \
49 --disable-sim \
50 --disable-gdb \
51 $(GRAPHITE_CONFIGURE) \
52 $(SOFT_FLOAT_CONFIG_OPTION) \
53 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
54
55 ifneq ($(CONFIG_SSP_SUPPORT),)
56 BINUTILS_CONFIGURE+= \
57 --enable-libssp
58 else
59 BINUTILS_CONFIGURE+= \
60 --disable-libssp
61 endif
62
63 ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
64 BINUTILS_CONFIGURE+= \
65 --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
66 endif
67
68 define Host/Prepare
69 $(call Host/Prepare/Default)
70 ln -snf $(notdir $(HOST_BUILD_DIR)) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
71 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
72 $(SED) 's, " Linaro.*,,' $(HOST_BUILD_DIR)/bfd/version.h
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) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
83 endef
84
85 define Host/Install
86 mkdir -p $(TOOLCHAIN_DIR)/initial
87 $(MAKE) -C $(HOST_BUILD_DIR) \
88 prefix=$(TOOLCHAIN_DIR)/initial \
89 install
90 $(MAKE) -C $(HOST_BUILD_DIR) \
91 prefix=$(TOOLCHAIN_DIR) \
92 install
93 $(call FixupLibdir,$(TOOLCHAIN_DIR)/initial)
94 $(RM) $(TOOLCHAIN_DIR)/initial/lib/libiberty.a
95 $(CP) $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
96 # ARC gcc requires extlib.
97 # If extlib is not available in "initial" folder
98 # initial gcc will fail to build libc.
99 if [ -d $(TOOLCHAIN_DIR)/extlib ]; then \
100 $(CP) -r $(TOOLCHAIN_DIR)/extlib $(TOOLCHAIN_DIR)/initial/; \
101 fi
102 endef
103
104 define Host/Clean
105 rm -rf \
106 $(HOST_BUILD_DIR) \
107 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
108 endef
109
110 $(eval $(call HostBuild))