musl: fix GDB debugging on mips (local, remote)
[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.25.1)
17 PKG_MD5SUM:=ac493a78de4fee895961d025b7905be4
18 endif
19
20 ifeq ($(findstring linaro, $(CONFIG_BINUTILS_VERSION)),linaro)
21 PKG_SOURCE_URL:=https://releases.linaro.org/14.09/components/toolchain/binutils-linaro/
22 PKG_REV:=2.24.0-2014.09
23 PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.xz
24 PKG_MD5SUM:=8f9b2b2e049d59b1b86ce9657802a353
25 BINUTILS_DIR:=$(PKG_NAME)-linaro-$(PKG_REV)
26 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
27 endif
28
29 ifneq ($(CONFIG_BINUTILS_VERSION_2_23_ARC),)
30 PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/arc-2015.06/
31 PKG_REV:=2015.06
32 PKG_SOURCE:=$(PKG_NAME)-arc-$(PKG_REV).tar.gz
33 PKG_MD5SUM:=961a3564de857238c255c381f8e4360b
34 BINUTILS_DIR:=$(PKG_NAME)-gdb-arc-$(PKG_REV)
35 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
36 endif
37
38 HOST_BUILD_PARALLEL:=1
39
40 PATCH_DIR:=./patches/$(PKG_VERSION)
41
42 REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST)
43
44 include $(INCLUDE_DIR)/toolchain-build.mk
45
46 BINUTILS_CONFIGURE:= \
47 ./configure \
48 --prefix=$(TOOLCHAIN_DIR) \
49 --build=$(GNU_HOST_NAME) \
50 --host=$(GNU_HOST_NAME) \
51 --target=$(REAL_GNU_TARGET_NAME) \
52 --with-sysroot=$(TOOLCHAIN_DIR) \
53 --enable-deterministic-archives \
54 --enable-plugins \
55 --disable-multilib \
56 --disable-werror \
57 --disable-nls \
58 --disable-sim \
59 --disable-gdb \
60 $(GRAPHITE_CONFIGURE) \
61 $(SOFT_FLOAT_CONFIG_OPTION) \
62 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
63
64 ifneq ($(CONFIG_SSP_SUPPORT),)
65 BINUTILS_CONFIGURE+= \
66 --enable-libssp
67 else
68 BINUTILS_CONFIGURE+= \
69 --disable-libssp
70 endif
71
72 ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
73 BINUTILS_CONFIGURE+= \
74 --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
75 endif
76
77 define Host/Prepare
78 $(call Host/Prepare/Default)
79 ln -snf $(notdir $(HOST_BUILD_DIR)) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
80 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
81 $(SED) 's, " Linaro.*,,' $(HOST_BUILD_DIR)/bfd/version.h
82 endef
83
84 define Host/Configure
85 (cd $(HOST_BUILD_DIR); \
86 $(BINUTILS_CONFIGURE) \
87 );
88 endef
89
90 define Host/Compile
91 +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
92 endef
93
94 define Host/Install
95 mkdir -p $(TOOLCHAIN_DIR)/initial
96 $(MAKE) -C $(HOST_BUILD_DIR) \
97 prefix=$(TOOLCHAIN_DIR)/initial \
98 install
99 $(MAKE) -C $(HOST_BUILD_DIR) \
100 prefix=$(TOOLCHAIN_DIR) \
101 install
102 $(call FixupLibdir,$(TOOLCHAIN_DIR)/initial)
103 $(RM) $(TOOLCHAIN_DIR)/initial/lib/libiberty.a
104 $(CP) $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
105 # ARC gcc requires extlib.
106 # If extlib is not available in "initial" folder
107 # initial gcc will fail to build libc.
108 if [ -d $(TOOLCHAIN_DIR)/extlib ]; then \
109 $(CP) -r $(TOOLCHAIN_DIR)/extlib $(TOOLCHAIN_DIR)/initial/; \
110 fi
111 endef
112
113 define Host/Clean
114 rm -rf \
115 $(HOST_BUILD_DIR) \
116 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
117 endef
118
119 $(eval $(call HostBuild))