1 #############################################################
3 # build binutils for use on the host system
5 #############################################################
6 BINUTILS_VERSION
:=$(strip $(subst ",, $(BR2_BINUTILS_VERSION)))
8 BINUTILS_SITE:=http://www.fr.kernel.org/pub/linux/devel/binutils \
9 http://www.fi.kernel.org/pub/linux/devel/binutils \
10 http://ftp.kernel.org/pub/linux/devel/binutils \
11 http://www.de.kernel.org/pub/linux/devel/binutils
12 ifeq ($(BINUTILS_VERSION),2.15)
13 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/ \
14 ftp://gatekeeper.dec.com/pub/GNU/ \
15 ftp://ftp.uu.net/archive/systems/gnu/ \
16 ftp://ftp.eu.uu.net/pub/gnu/ \
17 ftp://ftp.funet.fi/pub/gnu/prep/ \
18 ftp://ftp.leo.org/pub/comp/os/unix/gnu/
20 ifeq ($(BINUTILS_VERSION),2.14)
21 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/ \
22 ftp://gatekeeper.dec.com/pub/GNU/ \
23 ftp://ftp.uu.net/archive/systems/gnu/ \
24 ftp://ftp.eu.uu.net/pub/gnu/ \
25 ftp://ftp.funet.fi/pub/gnu/prep/ \
26 ftp://ftp.leo.org/pub/comp/os/unix/gnu/
28 ifeq ($(BINUTILS_VERSION),2.13)
29 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/ \
30 ftp://gatekeeper.dec.com/pub/GNU/ \
31 ftp://ftp.uu.net/archive/systems/gnu/ \
32 ftp://ftp.eu.uu.net/pub/gnu/ \
33 ftp://ftp.funet.fi/pub/gnu/prep/ \
34 ftp://ftp.leo.org/pub/comp/os/unix/gnu/
37 BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2
38 BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)
41 BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)-build
43 $(DL_DIR)/$(BINUTILS_SOURCE):
45 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(BINUTILS_SOURCE) x $(BINUTILS_SITE)
47 $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
48 mkdir -p $(TOOL_BUILD_DIR)
49 $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
50 touch $(BINUTILS_DIR)/.unpacked
52 $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
53 # Apply appropriate binutils patches.
54 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./all \*.patch
55 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./$(BINUTILS_VERSION) \*.patch
56 touch $(BINUTILS_DIR)/.patched
58 $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched
59 mkdir -p $(BINUTILS_DIR1)
60 (cd $(BINUTILS_DIR1); \
61 $(BINUTILS_DIR)/configure \
62 --prefix=$(STAGING_DIR) \
63 --build=$(GNU_HOST_NAME) \
64 --host=$(GNU_HOST_NAME) \
65 --target=$(REAL_GNU_TARGET_NAME) \
69 $(SOFT_FLOAT_CONFIG_OPTION) );
70 touch $(BINUTILS_DIR1)/.configured
72 $(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured
73 $(MAKE) -C $(BINUTILS_DIR1) all
75 # Make install will put gettext data in staging_dir/share/locale.
76 # Unfortunatey, it isn't configureable.
77 $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld: $(BINUTILS_DIR1)/binutils/objdump
78 $(MAKE) -C $(BINUTILS_DIR1) install
80 binutils-dependencies:
81 @if ! which bison > /dev/null ; then \
82 echo -e "\n\nYou must
install 'bison' on your build machine
\n"; \
85 @if ! which flex > /dev/null ; then \
86 echo -e "\n\nYou must
install 'flex' on your build machine
\n"; \
89 @if ! which msgfmt > /dev/null ; then \
90 echo -e "\n\nYou must
install 'gettext' on your build machine
\n"; \
94 binutils: binutils-dependencies $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld
96 binutils-source: $(DL_DIR)/$(BINUTILS_SOURCE)
99 rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
100 -$(MAKE) -C $(BINUTILS_DIR1) clean
103 rm -rf $(BINUTILS_DIR1)
106 rm -rf $(BINUTILS_DIR)
109 #############################################################
111 # build binutils for use on the target system
113 #############################################################
114 BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target
115 $(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched
116 mkdir -p $(BINUTILS_DIR2)
117 (cd $(BINUTILS_DIR2); \
118 PATH=$(TARGET_PATH) \
119 CFLAGS="$(TARGET_CFLAGS
)" \
120 CFLAGS_FOR_BUILD="-O2
-g
" \
121 $(BINUTILS_DIR)/configure \
124 --build=$(GNU_HOST_NAME) \
125 --host=$(REAL_GNU_TARGET_NAME) \
126 --target=$(REAL_GNU_TARGET_NAME) \
129 $(SOFT_FLOAT_CONFIG_OPTION) );
130 touch $(BINUTILS_DIR2)/.configured
132 $(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured
133 PATH=$(TARGET_PATH) \
134 $(MAKE) -C $(BINUTILS_DIR2) all
136 $(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump
137 PATH=$(TARGET_PATH) \
138 $(MAKE) DESTDIR=$(TARGET_DIR) \
139 tooldir=/usr build_tooldir=/usr \
140 -C $(BINUTILS_DIR2) install
141 #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
142 # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
143 -$(STRIP) $(TARGET_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/* > /dev/null 2>&1
144 -$(STRIP) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1
146 binutils_target: $(GCC_DEPENDANCY) $(TARGET_DIR)/usr/bin/ld
148 binutils_target-clean:
149 (cd $(TARGET_DIR)/usr/bin; \
150 rm -f addr2line ar as gprof ld nm objcopy \
151 objdump ranlib readelf size strings strip)
152 rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
153 -$(MAKE) -C $(BINUTILS_DIR2) clean
155 binutils_target-toolclean:
156 rm -rf $(BINUTILS_DIR2)
This page took 0.046497 seconds and 5 git commands to generate.