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) ./$(BINUTILS_VERSION) \*.patch
55 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./all \*.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) \
68 $(SOFT_FLOAT_CONFIG_OPTION) );
69 touch $(BINUTILS_DIR1)/.configured
71 $(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured
72 $(MAKE) -C $(BINUTILS_DIR1) all
74 # Make install will put gettext data in staging_dir/share/locale.
75 # Unfortunatey, it isn't configureable.
76 $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld: $(BINUTILS_DIR1)/binutils/objdump
77 $(MAKE) -C $(BINUTILS_DIR1) install
79 binutils-dependencies:
80 @if ! which bison > /dev/null ; then \
81 echo -e "\n\nYou must
install 'bison' on your build machine
\n"; \
84 @if ! which flex > /dev/null ; then \
85 echo -e "\n\nYou must
install 'flex' on your build machine
\n"; \
88 @if ! which msgfmt > /dev/null ; then \
89 echo -e "\n\nYou must
install 'gettext' on your build machine
\n"; \
93 binutils: binutils-dependencies $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld
95 binutils-source: $(DL_DIR)/$(BINUTILS_SOURCE)
98 rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
99 -$(MAKE) -C $(BINUTILS_DIR1) clean
102 rm -rf $(BINUTILS_DIR1)
105 rm -rf $(BINUTILS_DIR)
108 #############################################################
110 # build binutils for use on the target system
112 #############################################################
113 BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target
114 $(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched
115 mkdir -p $(BINUTILS_DIR2)
116 (cd $(BINUTILS_DIR2); \
117 PATH=$(TARGET_PATH) \
118 CFLAGS="$(TARGET_CFLAGS
)" \
119 CFLAGS_FOR_BUILD="-O2
-g
" \
120 $(BINUTILS_DIR)/configure \
123 --build=$(GNU_HOST_NAME) \
124 --host=$(REAL_GNU_TARGET_NAME) \
125 --target=$(REAL_GNU_TARGET_NAME) \
128 $(SOFT_FLOAT_CONFIG_OPTION) );
129 touch $(BINUTILS_DIR2)/.configured
131 $(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured
132 PATH=$(TARGET_PATH) \
133 $(MAKE) -C $(BINUTILS_DIR2) all
135 $(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump
136 PATH=$(TARGET_PATH) \
137 $(MAKE) DESTDIR=$(TARGET_DIR) \
138 tooldir=/usr build_tooldir=/usr \
139 -C $(BINUTILS_DIR2) install
140 #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
141 # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
142 -$(STRIP) $(TARGET_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/* > /dev/null 2>&1
143 -$(STRIP) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1
145 binutils_target: $(GCC_DEPENDANCY) $(TARGET_DIR)/usr/bin/ld
147 binutils_target-clean:
148 (cd $(TARGET_DIR)/usr/bin; \
149 rm -f addr2line ar as gprof ld nm objcopy \
150 objdump ranlib readelf size strings strip)
151 rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
152 -$(MAKE) -C $(BINUTILS_DIR2) clean
154 binutils_target-toolclean:
155 rm -rf $(BINUTILS_DIR2)
This page took 0.045978 seconds and 5 git commands to generate.