netifd: update to latest git HEAD
[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.xz
15
16 TAR_OPTIONS += --exclude='*.rej'
17
18 ifeq ($(PKG_VERSION),2.29.1)
19 PKG_HASH:=e7010a46969f9d3e53b650a518663f98a5dde3c3ae21b7d71e5e6803bc36b577
20 endif
21
22 ifeq ($(PKG_VERSION),2.30)
23 PKG_HASH:=6e46b8aeae2f727a36f0bd9505e405768a72218f1796f0d09757d45209871ae6
24 endif
25
26 ifeq ($(PKG_VERSION),2.31.1)
27 PKG_HASH:=5d20086ecf5752cc7d9134246e9588fa201740d540f7eb84d795b1f7a93bca86
28 endif
29
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)
37 endif
38
39 HOST_BUILD_PARALLEL:=1
40
41 PATCH_DIR:=./patches/$(PKG_VERSION)
42
43 include $(INCLUDE_DIR)/toolchain-build.mk
44
45 BINUTILS_CONFIGURE:= \
46 ./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 \
53 --enable-plugins \
54 --disable-multilib \
55 --disable-werror \
56 --disable-nls \
57 --disable-sim \
58 --disable-gdb \
59 $(GRAPHITE_CONFIGURE) \
60 $(SOFT_FLOAT_CONFIG_OPTION) \
61 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
62
63 ifneq ($(CONFIG_SSP_SUPPORT),)
64 BINUTILS_CONFIGURE+= \
65 --enable-libssp
66 else
67 BINUTILS_CONFIGURE+= \
68 --disable-libssp
69 endif
70
71 ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
72 BINUTILS_CONFIGURE+= \
73 --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
74 endif
75
76 define Host/Prepare
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
81 endef
82
83 define Host/Configure
84 (cd $(HOST_BUILD_DIR); \
85 $(BINUTILS_CONFIGURE) \
86 );
87 endef
88
89 define Host/Compile
90 +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
91 endef
92
93 define Host/Install
94 mkdir -p $(TOOLCHAIN_DIR)/initial
95 $(MAKE) -C $(HOST_BUILD_DIR) \
96 prefix=$(TOOLCHAIN_DIR)/initial \
97 install
98 $(MAKE) -C $(HOST_BUILD_DIR) \
99 prefix=$(TOOLCHAIN_DIR) \
100 install
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/; \
109 fi
110 endef
111
112 define Host/Clean
113 rm -rf \
114 $(HOST_BUILD_DIR) \
115 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
116 endef
117
118 $(eval $(call HostBuild))