bump version
[buildroot.git] / toolchain / binutils / binutils.mk
blobf669a1edf0b2ebdf51860dcd68d126751a861396
1 #############################################################
3 # build binutils for use on the host system
5 #############################################################
6 BINUTILS_VERSION:=$(subst ",,$(BR2_BINUTILS_VERSION))
7 #")
9 EXTRA_BINUTILS_CONFIG_OPTIONS=$(strip $(subst ",, $(BR2_EXTRA_BINUTILS_CONFIG_OPTIONS)))
10 #"))
11 BINUTILS_SITE:=$(BR2_KERNEL_MIRROR)/linux/devel/binutils
12 ifeq ($(BINUTILS_VERSION),2.19)
13 BINUTILS_SITE:=$(BR2_GNU_MIRROR)/binutils/
14 endif
15 ifeq ($(BINUTILS_VERSION),2.18)
16 BINUTILS_SITE:=$(BR2_GNU_MIRROR)/binutils/
17 endif
18 ifeq ($(BINUTILS_VERSION),2.17)
19 BINUTILS_SITE:=$(BR2_GNU_MIRROR)/binutils/
20 endif
21 ifeq ($(BINUTILS_VERSION),2.16)
22 BINUTILS_SITE:=$(BR2_GNU_MIRROR)/binutils/
23 BINUTILS_NO_MPFR:=y
24 endif
25 ifeq ($(BINUTILS_VERSION),2.16.1)
26 BINUTILS_SITE:=$(BR2_GNU_MIRROR)/binutils/
27 BINUTILS_NO_MPFR:=y
28 endif
29 ifeq ($(BINUTILS_VERSION),2.15)
30 BINUTILS_SITE:=$(BR2_GNU_MIRROR)/binutils/
31 BINUTILS_NO_MPFR:=y
32 endif
33 ifeq ($(BINUTILS_VERSION),2.14)
34 BINUTILS_SITE:=$(BR2_GNU_MIRROR)/binutils/
35 BINUTILS_NO_MPFR:=y
36 endif
37 ifeq ($(BINUTILS_VERSION),2.13)
38 BINUTILS_SITE:=$(BR2_GNU_MIRROR)/binutils/
39 BINUTILS_NO_MPFR:=y
40 endif
41 ifeq ($(BINUTILS_VERSION),2.15.97)
42 BINUTILS_SITE:=ftp://sources.redhat.com/pub/binutils/snapshots/
43 BINUTILS_NO_MPFR:=y
44 endif
46 # We do not rely on the host's gmp/mpfr but use a known working one
47 BINUTILS_HOST_PREREQ:=
48 BINUTILS_TARGET_PREREQ:=
50 ifeq ($(findstring x3.,x$(GCC_VERSION)),x3.)
51 BINUTILS_NO_MPFR:=y
52 endif
53 ifeq ($(findstring x4.0,x$(GCC_VERSION)),x4.0)
54 BINUTILS_NO_MPFR:=y
55 endif
57 ifndef BINUTILS_NO_MPFR
58 BINUTILS_HOST_PREREQ:=$(TOOL_BUILD_DIR)/gmp/lib/libgmp$(HOST_SHREXT) \
59 $(TOOL_BUILD_DIR)/mpfr/lib/libmpfr$(HOST_SHREXT)
61 BINUTILS_TARGET_PREREQ:=$(TARGET_DIR)/usr/lib/libgmp$(LIBTGTEXT) \
62 $(TARGET_DIR)/usr/lib/libmpfr$(LIBTGTEXT)
64 EXTRA_BINUTILS_CONFIG_OPTIONS+=--with-gmp="$(GMP_HOST_DIR)"
65 EXTRA_BINUTILS_CONFIG_OPTIONS+=--with-mpfr="$(MPFR_HOST_DIR)"
67 BINUTILS_TARGET_CONFIG_OPTIONS=--with-gmp="$(GMP_TARGET_DIR)"
68 BINUTILS_TARGET_CONFIG_OPTIONS+=--with-mpfr="$(MPFR_TARGET_DIR)"
69 endif
71 EXTRA_BINUTILS_CONFIG_OPTIONS+=$(BR2_MAYBE_USE_INTERWORKING)
72 BINUTILS_TARGET_CONFIG_OPTIONS+=$(BR2_MAYBE_USE_INTERWORKING)
74 BINUTILS_OFFICIAL_VERSION:=$(BINUTILS_VERSION)$(VENDOR_SUFFIX)$(VENDOR_BINUTILS_RELEASE)
75 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
76 BINUTILS_PATCH_DIR:=toolchain/binutils/$(BINUTILS_VERSION)
77 else # ifeq ($(BR2_TOOLCHAIN_EXTERNAL_SOURCE),)
78 BINUTILS_SITE:=$(VENDOR_SITE)
79 BINUTILS_PATCH_DIR:=$(VENDOR_PATCH_DIR)/binutils-$(BINUTILS_OFFICIAL_VERSION)
80 endif
82 BINUTILS_SOURCE:=binutils-$(BINUTILS_OFFICIAL_VERSION).tar.bz2
83 BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_OFFICIAL_VERSION)
84 BINUTILS_CAT:=$(BZCAT)
86 BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)-build
88 $(DL_DIR)/$(BINUTILS_SOURCE):
89 mkdir -p $(DL_DIR)
90 $(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE)
92 binutils-unpacked: $(BINUTILS_DIR)/.patched
93 $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
94 mkdir -p $(TOOL_BUILD_DIR)
95 rm -rf $(BINUTILS_DIR)
96 $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
97 $(CONFIG_UPDATE) $(@D)
98 touch $@
100 $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
101 # Apply appropriate binutils patches.
102 toolchain/patch-kernel.sh $(BINUTILS_DIR) $(BINUTILS_PATCH_DIR) \*.patch
103 touch $@
105 $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched
106 mkdir -p $(BINUTILS_DIR1)
107 (cd $(BINUTILS_DIR1); rm -rf config.cache; \
108 $(HOST_CONFIGURE_OPTS) \
109 $(BINUTILS_DIR)/configure \
110 --prefix=$(BR2_SYSROOT_PREFIX)/usr \
111 --build=$(GNU_HOST_NAME) \
112 --host=$(GNU_HOST_NAME) \
113 --target=$(REAL_GNU_TARGET_NAME) \
114 --mandir=/usr/share/man \
115 --infodir=/usr/share/info \
116 $(BR2_CONFIGURE_DEVEL_SYSROOT) \
117 $(BR2_CONFIGURE_STAGING_SYSROOT) \
118 $(DISABLE_NLS) \
119 $(MULTILIB) \
120 --disable-werror \
121 $(SOFT_FLOAT_CONFIG_OPTION) \
122 $(EXTRA_BINUTILS_CONFIG_OPTIONS) \
124 touch $@
126 $(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured
127 $(MAKE) -C $(BINUTILS_DIR1) all
129 # Make install will put gettext data in staging_dir/share/locale.
130 # Unfortunatey, it isn't configureable.
131 $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ld: $(BINUTILS_DIR1)/binutils/objdump
132 $(MAKE) -C $(BINUTILS_DIR1) $(BR2_SYSROOT_STAGING_DESTDIR) install
133 # tooldir=/usr build_tooldir=/usr install
134 #rm -f $(STAGING_DIR)/usr/bin/{ar,as,ld,nm,objdump,ranlib,strip}
136 binutils: libc-configured $(BINUTILS_HOST_PREREQ) $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ld
138 binutils-source: $(DL_DIR)/$(BINUTILS_SOURCE)
140 binutils-clean:
141 -$(MAKE) -C $(BINUTILS_DIR1) DESTDIR=$(STAGING_DIR) \
142 tooldir=/usr build_tooldir=/usr uninstall
143 -$(MAKE) -C $(BINUTILS_DIR1) clean
144 rm -rf $(wildcard $(patsubst %,$(STAGING_DIR)/usr/bin/*%,ar as ld nm objdump ranlib strip c++filt)) \
145 $(wildcard $(patsubst %,$(STAGING_DIR)/usr/lib/%*,libiberty ldscripts))
147 binutils-dirclean:
148 rm -rf $(BINUTILS_DIR1)
150 binutils-src-dirclean:
151 rm -rf $(BINUTILS_DIR)
153 #############################################################
155 # build binutils for use on the target system
157 #############################################################
158 BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target
159 $(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched
160 mkdir -p $(BINUTILS_DIR2)
161 (cd $(BINUTILS_DIR2); rm -rf config.cache; \
162 $(TARGET_CONFIGURE_OPTS) \
163 $(BINUTILS_DIR)/configure \
164 --prefix=/usr \
165 --exec-prefix=/usr \
166 --build=$(GNU_HOST_NAME) \
167 --host=$(REAL_GNU_TARGET_NAME) \
168 --target=$(REAL_GNU_TARGET_NAME) \
169 --mandir=/usr/share/man \
170 --infodir=/usr/share/info \
171 $(DISABLE_NLS) \
172 $(MULTILIB) \
173 $(BINUTILS_TARGET_CONFIG_OPTIONS) \
174 --disable-werror \
175 $(SOFT_FLOAT_CONFIG_OPTION) \
177 touch $@
179 $(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured
180 PATH=$(TARGET_PATH) $(MAKE) -C $(BINUTILS_DIR2) all
182 $(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump
183 PATH=$(TARGET_PATH) \
184 $(MAKE) DESTDIR=$(TARGET_DIR) \
185 tooldir=/usr build_tooldir=/usr \
186 -C $(BINUTILS_DIR2) install
187 ifneq ($(BR2_HAVE_MANPAGES),y)
188 rm -rf $(TARGET_DIR)/usr/man
189 endif
190 ifneq ($(BR2_HAVE_INFOPAGES),y)
191 rm -rf $(TARGET_DIR)/usr/info
192 endif
193 rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/share/doc
194 -$(STRIPCMD) $(TARGET_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/* > /dev/null 2>&1
195 -$(STRIPCMD) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1
197 binutils_target: $(BINUTILS_TARGET_PREREQ) $(TARGET_DIR)/usr/bin/ld
199 binutils_target-clean:
200 -$(MAKE) -C $(BINUTILS_DIR2) clean
201 rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)* \
202 $(addprefix $(TARGET_DIR)/usr/bin/, addr2line ar as gprof ld nm objcopy objdump ranlib readelf size strings strip c++filt)
204 binutils_target-dirclean:
205 rm -rf $(BINUTILS_DIR2)