c0d504d6dc90f0d239fc76f1f3b628cd002628e9
1 #############################################################
3 # build binutils for use on the host system
5 #############################################################
6 BINUTILS_VERSION
:=$(strip $(subst ",, $(BR2_BINUTILS_VERSION)))
8 BINUTILS_SITE:=http://ftp.kernel.org/pub/linux/devel/binutils
9 ifeq ($(BINUTILS_VERSION),2.15)
10 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/
12 ifeq ($(BINUTILS_VERSION),2.14)
13 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/
15 ifeq ($(BINUTILS_VERSION),2.13)
16 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/
19 BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2
20 BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)
23 BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)-build
25 $(DL_DIR)/$(BINUTILS_SOURCE):
27 $(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE)
29 $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
30 mkdir -p $(TOOL_BUILD_DIR)
31 $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
32 touch $(BINUTILS_DIR)/.unpacked
34 $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
35 # Apply appropriate binutils patches.
36 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./$(BINUTILS_VERSION) \*.patch
37 touch $(BINUTILS_DIR)/.patched
39 $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched
40 mkdir -p $(BINUTILS_DIR1)
41 (cd $(BINUTILS_DIR1); \
42 $(BINUTILS_DIR)/configure \
43 --prefix=$(STAGING_DIR) \
44 --build=$(GNU_HOST_NAME) \
45 --host=$(GNU_HOST_NAME) \
46 --target=$(REAL_GNU_TARGET_NAME) \
49 $(SOFT_FLOAT_CONFIG_OPTION) );
50 touch $(BINUTILS_DIR1)/.configured
52 $(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured
53 $(MAKE) -C $(BINUTILS_DIR1) all
55 # Make install will put gettext data in staging_dir/share/locale.
56 # Unfortunatey, it isn't configureable.
57 $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld: $(BINUTILS_DIR1)/binutils/objdump
58 $(MAKE) -C $(BINUTILS_DIR1) install
60 binutils-dependencies:
61 @if ! which bison > /dev/null ; then \
62 echo -e "\n\nYou must
install 'bison' on your build machine
\n"; \
65 @if ! which flex > /dev/null ; then \
66 echo -e "\n\nYou must
install 'flex' on your build machine
\n"; \
69 @if ! which msgfmt > /dev/null ; then \
70 echo -e "\n\nYou must
install 'gettext' on your build machine
\n"; \
74 binutils: binutils-dependencies $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld
76 binutils-source: $(DL_DIR)/$(BINUTILS_SOURCE)
79 rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
80 -$(MAKE) -C $(BINUTILS_DIR1) clean
83 rm -rf $(BINUTILS_DIR1)
86 rm -rf $(BINUTILS_DIR)
89 #############################################################
91 # build binutils for use on the target system
93 #############################################################
94 BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target
95 $(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched
96 mkdir -p $(BINUTILS_DIR2)
97 (cd $(BINUTILS_DIR2); \
99 CFLAGS="$(TARGET_CFLAGS
)" \
100 CFLAGS_FOR_BUILD="-O2
-g
" \
101 $(BINUTILS_DIR)/configure \
104 --build=$(GNU_HOST_NAME) \
105 --host=$(REAL_GNU_TARGET_NAME) \
106 --target=$(REAL_GNU_TARGET_NAME) \
109 $(SOFT_FLOAT_CONFIG_OPTION) );
110 touch $(BINUTILS_DIR2)/.configured
112 $(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured
113 PATH=$(TARGET_PATH) \
114 $(MAKE) -C $(BINUTILS_DIR2) all
116 $(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump
117 PATH=$(TARGET_PATH) \
118 $(MAKE) DESTDIR=$(TARGET_DIR) \
119 tooldir=/usr build_tooldir=/usr \
120 -C $(BINUTILS_DIR2) install
121 #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
122 # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
123 -$(STRIP) $(TARGET_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/* > /dev/null 2>&1
124 -$(STRIP) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1
126 binutils_target: $(GCC_DEPENDANCY) $(TARGET_DIR)/usr/bin/ld
128 binutils_target-clean:
129 (cd $(TARGET_DIR)/usr/bin; \
130 rm -f addr2line ar as gprof ld nm objcopy \
131 objdump ranlib readelf size strings strip)
132 rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
133 -$(MAKE) -C $(BINUTILS_DIR2) clean
135 binutils_target-toolclean:
136 rm -rf $(BINUTILS_DIR2)
This page took 0.04373 seconds and 3 git commands to generate.