1 include $(TOPDIR)/rules.mk
3 #############################################################
5 # build binutils for use on the host system
7 #############################################################
8 BINUTILS_VERSION:=$(strip $(subst ",, $(BR2_BINUTILS_VERSION)))
11 BINUTILS_SITE:=http://www.fr.kernel.org/pub/linux/devel/binutils \
12 http://www.fi.kernel.org/pub/linux/devel/binutils \
13 http://ftp.kernel.org/pub/linux/devel/binutils \
14 http://www.de.kernel.org/pub/linux/devel/binutils
16 ifeq ($(BINUTILS_VERSION),2.15)
17 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/ \
18 ftp://gatekeeper.dec.com/pub/GNU/ \
19 ftp://ftp.uu.net/archive/systems/gnu/ \
20 ftp://ftp.eu.uu.net/pub/gnu/ \
21 ftp://ftp.funet.fi/pub/gnu/prep/ \
22 ftp://ftp.leo.org/pub/comp/os/unix/gnu/
24 ifeq ($(BINUTILS_VERSION),2.14)
25 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/ \
26 ftp://gatekeeper.dec.com/pub/GNU/ \
27 ftp://ftp.uu.net/archive/systems/gnu/ \
28 ftp://ftp.eu.uu.net/pub/gnu/ \
29 ftp://ftp.funet.fi/pub/gnu/prep/ \
30 ftp://ftp.leo.org/pub/comp/os/unix/gnu/
32 ifeq ($(BINUTILS_VERSION),2.13)
33 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/ \
34 ftp://gatekeeper.dec.com/pub/GNU/ \
35 ftp://ftp.uu.net/archive/systems/gnu/ \
36 ftp://ftp.eu.uu.net/pub/gnu/ \
37 ftp://ftp.funet.fi/pub/gnu/prep/ \
38 ftp://ftp.leo.org/pub/comp/os/unix/gnu/
41 BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2
42 BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)
45 BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)-build
47 $(DL_DIR)/$(BINUTILS_SOURCE):
49 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(BINUTILS_SOURCE) x $(BINUTILS_SITE)
51 $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
52 mkdir -p $(TOOL_BUILD_DIR)
53 $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
54 touch $(BINUTILS_DIR)/.unpacked
56 $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
57 # Apply appropriate binutils patches.
58 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./all \*.patch
59 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./$(BINUTILS_VERSION) \*.patch
60 touch $(BINUTILS_DIR)/.patched
62 $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched
63 mkdir -p $(BINUTILS_DIR1)
64 (cd $(BINUTILS_DIR1); \
65 $(BINUTILS_DIR)/configure \
66 --prefix=$(STAGING_DIR) \
67 --build=$(GNU_HOST_NAME) \
68 --host=$(GNU_HOST_NAME) \
69 --target=$(REAL_GNU_TARGET_NAME) \
73 $(SOFT_FLOAT_CONFIG_OPTION) );
74 touch $(BINUTILS_DIR1)/.configured
76 $(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured
77 $(MAKE) -C $(BINUTILS_DIR1) all
79 # Make install will put gettext data in staging_dir/share/locale.
80 # Unfortunatey, it isn't configureable.
81 $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld: $(BINUTILS_DIR1)/binutils/objdump
82 $(MAKE) -C $(BINUTILS_DIR1) install
85 #############################################################
87 # build binutils for use on the target system
89 #############################################################
90 BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target
91 $(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched
92 mkdir -p $(BINUTILS_DIR2)
93 (cd $(BINUTILS_DIR2); \
95 CFLAGS="$(TARGET_CFLAGS)" \
96 CFLAGS_FOR_BUILD="-O2 -g" \
97 $(BINUTILS_DIR)/configure \
100 --build=$(GNU_HOST_NAME) \
101 --host=$(REAL_GNU_TARGET_NAME) \
102 --target=$(REAL_GNU_TARGET_NAME) \
105 $(SOFT_FLOAT_CONFIG_OPTION) );
106 touch $(BINUTILS_DIR2)/.configured
108 $(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured
109 PATH=$(TARGET_PATH) \
110 $(MAKE) -C $(BINUTILS_DIR2) all
112 source: $(DL_DIR)/$(BINUTILS_SOURCE)
113 prepare: $(BINUTILS_DIR)/.patched
114 compile: $(BINUTILS_DIR1)/binutils/objdump
115 install: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld
117 rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
118 rm -rf $(BINUTILS_DIR) $(BINUTILS_DIR1)