1 #############################################################
3 # build binutils for use on the host system
5 #############################################################
6 BINUTILS_VERSION
:=$(strip $(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 toolchain
/patch-kernel.sh
$(BINUTILS_DIR
) toolchain
/binutils
/$(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
)/$(REAL_GNU_TARGET_NAME
)/bin
/ld: $(BINUTILS_DIR1
)/binutils
/objdump
58 $(MAKE
) -C
$(BINUTILS_DIR1
) install
60 binutils-dependancies
:
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-dependancies
$(STAGING_DIR
)/$(REAL_GNU_TARGET_NAME
)/bin
/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
)
87 #############################################################
89 # build binutils for use on the target system
91 #############################################################
92 BINUTILS_DIR2
:=$(BUILD_DIR
)/binutils-
$(BINUTILS_VERSION
)-target
93 $(BINUTILS_DIR2
)/.configured
: $(BINUTILS_DIR
)/.patched
94 mkdir
-p
$(BINUTILS_DIR2
)
95 (cd
$(BINUTILS_DIR2
); \
97 CFLAGS
="$(TARGET_CFLAGS)" \
98 CFLAGS_FOR_BUILD
="-O2 -g" \
99 $(BINUTILS_DIR
)/configure \
102 --build
=$(GNU_HOST_NAME
) \
103 --host
=$(REAL_GNU_TARGET_NAME
) \
104 --target
=$(REAL_GNU_TARGET_NAME
) \
107 $(SOFT_FLOAT_CONFIG_OPTION
) );
108 touch
$(BINUTILS_DIR2
)/.configured
110 $(BINUTILS_DIR2
)/binutils
/objdump
: $(BINUTILS_DIR2
)/.configured
111 PATH
=$(TARGET_PATH
) \
112 $(MAKE
) -C
$(BINUTILS_DIR2
) all
114 $(TARGET_DIR
)/usr
/bin
/ld: $(BINUTILS_DIR2
)/binutils
/objdump
115 PATH
=$(TARGET_PATH
) \
116 $(MAKE
) DESTDIR
=$(TARGET_DIR
) \
117 tooldir
=/usr build_tooldir
=/usr \
118 -C
$(BINUTILS_DIR2
) install
119 #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
120 # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
121 -$(STRIP
) $(TARGET_DIR
)/usr
/$(REAL_GNU_TARGET_NAME
)/bin
/* > /dev
/null
2>&1
122 -$(STRIP
) $(TARGET_DIR
)/usr
/bin
/* > /dev
/null
2>&1
124 binutils_target
: $(GCC_DEPENDANCY
) $(TARGET_DIR
)/usr
/bin
/ld
126 binutils_target-clean
:
127 (cd
$(TARGET_DIR
)/usr
/bin
; \
128 rm -f addr2line
ar as gprof
ld nm objcopy \
129 objdump ranlib readelf size strings
strip)
130 rm -f
$(TARGET_DIR
)/bin
/$(REAL_GNU_TARGET_NAME
)*
131 -$(MAKE
) -C
$(BINUTILS_DIR2
) clean
133 binutils_target-dirclean
:
134 rm -rf
$(BINUTILS_DIR2
)