]>
Commit | Line | Data |
---|---|---|
9168e838 MNI |
1 | ############################################################# |
2 | # | |
3 | # build binutils for use on the host system | |
4 | # | |
5 | ############################################################# | |
dab038a0 | 6 | BINUTILS_VERSION:=$(strip $(subst ",, $(BR2_BINUTILS_VERSION))) |
6e2823c1 | 7 | #")) |
3ad3d8a1 | 8 | |
f90e0e03 | 9 | EXTRA_BINUTILS_CONFIG_OPTIONS:=$(strip $(subst ",, $(BR2_EXTRA_BINUTILS_CONFIG_OPTIONS))) |
6e2823c1 | 10 | #")) |
573fe275 | 11 | BINUTILS_SITE:=ftp://ftp.kernel.org/pub/linux/devel/binutils |
4b538791 MF |
12 | ifeq ($(BINUTILS_VERSION),2.17) |
13 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ | |
14 | endif | |
42b8eb19 | 15 | ifeq ($(BINUTILS_VERSION),2.16) |
573fe275 | 16 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ |
42b8eb19 | 17 | endif |
42ca8b26 | 18 | ifeq ($(BINUTILS_VERSION),2.16.1) |
573fe275 | 19 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ |
42ca8b26 | 20 | endif |
3ad3d8a1 | 21 | ifeq ($(BINUTILS_VERSION),2.15) |
573fe275 | 22 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ |
3ad3d8a1 MNI |
23 | endif |
24 | ifeq ($(BINUTILS_VERSION),2.14) | |
573fe275 | 25 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ |
3ad3d8a1 MNI |
26 | endif |
27 | ifeq ($(BINUTILS_VERSION),2.13) | |
573fe275 | 28 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ |
3ad3d8a1 | 29 | endif |
5b72a75f MNI |
30 | ifeq ($(BINUTILS_VERSION),2.15.97) |
31 | BINUTILS_SITE:=ftp://sources.redhat.com/pub/binutils/snapshots/ | |
32 | endif | |
3ad3d8a1 MNI |
33 | |
34 | BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2 | |
35 | BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION) | |
6e2823c1 | 36 | BINUTILS_CAT:=$(BZCAT) |
9168e838 | 37 | |
3ad3d8a1 | 38 | BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)-build |
9168e838 MNI |
39 | |
40 | $(DL_DIR)/$(BINUTILS_SOURCE): | |
3ad3d8a1 | 41 | mkdir -p $(DL_DIR) |
9168e838 MNI |
42 | $(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE) |
43 | ||
9f7644ae | 44 | binutils-unpacked: $(BINUTILS_DIR)/.unpacked |
2d472b23 | 45 | $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE) |
9168e838 | 46 | mkdir -p $(TOOL_BUILD_DIR) |
3263c5a6 | 47 | $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) - |
30c484fd | 48 | $(CONFIG_UPDATE) $(BINUTILS_DIR) |
9168e838 MNI |
49 | touch $(BINUTILS_DIR)/.unpacked |
50 | ||
51 | $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked | |
3ad3d8a1 | 52 | # Apply appropriate binutils patches. |
44eedc5c | 53 | toolchain/patch-kernel.sh $(BINUTILS_DIR) toolchain/binutils/$(BINUTILS_VERSION) \*.patch |
9168e838 MNI |
54 | touch $(BINUTILS_DIR)/.patched |
55 | ||
56 | $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched | |
57 | mkdir -p $(BINUTILS_DIR1) | |
58 | (cd $(BINUTILS_DIR1); \ | |
f90e0e03 | 59 | CC="$(HOSTCC)" \ |
9168e838 MNI |
60 | $(BINUTILS_DIR)/configure \ |
61 | --prefix=$(STAGING_DIR) \ | |
62 | --build=$(GNU_HOST_NAME) \ | |
63 | --host=$(GNU_HOST_NAME) \ | |
64 | --target=$(REAL_GNU_TARGET_NAME) \ | |
23e3dd40 | 65 | $(DISABLE_NLS) \ |
9168e838 | 66 | $(MULTILIB) \ |
42b8eb19 | 67 | --disable-werror \ |
f90e0e03 BRF |
68 | $(SOFT_FLOAT_CONFIG_OPTION) \ |
69 | $(EXTRA_BINUTILS_CONFIG_OPTIONS)); | |
9168e838 MNI |
70 | touch $(BINUTILS_DIR1)/.configured |
71 | ||
72 | $(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured | |
c7bf26e6 | 73 | $(MAKE) -C $(BINUTILS_DIR1) all |
9168e838 MNI |
74 | |
75 | # Make install will put gettext data in staging_dir/share/locale. | |
76 | # Unfortunatey, it isn't configureable. | |
2d523c23 | 77 | $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/ld: $(BINUTILS_DIR1)/binutils/objdump |
c7bf26e6 | 78 | $(MAKE) -C $(BINUTILS_DIR1) install |
9168e838 | 79 | |
d99c31c6 | 80 | binutils: dependencies $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/ld |
9168e838 MNI |
81 | |
82 | binutils-source: $(DL_DIR)/$(BINUTILS_SOURCE) | |
83 | ||
84 | binutils-clean: | |
85 | rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)* | |
86 | -$(MAKE) -C $(BINUTILS_DIR1) clean | |
87 | ||
88 | binutils-dirclean: | |
89 | rm -rf $(BINUTILS_DIR1) | |
90 | ||
91 | ||
92 | ||
93 | ############################################################# | |
94 | # | |
95 | # build binutils for use on the target system | |
96 | # | |
97 | ############################################################# | |
3ad3d8a1 | 98 | BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target |
9168e838 MNI |
99 | $(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched |
100 | mkdir -p $(BINUTILS_DIR2) | |
101 | (cd $(BINUTILS_DIR2); \ | |
102 | PATH=$(TARGET_PATH) \ | |
103 | CFLAGS="$(TARGET_CFLAGS)" \ | |
93703bf4 | 104 | CFLAGS_FOR_BUILD="-O2 -g" \ |
9168e838 MNI |
105 | $(BINUTILS_DIR)/configure \ |
106 | --prefix=/usr \ | |
107 | --exec-prefix=/usr \ | |
108 | --build=$(GNU_HOST_NAME) \ | |
109 | --host=$(REAL_GNU_TARGET_NAME) \ | |
110 | --target=$(REAL_GNU_TARGET_NAME) \ | |
23e3dd40 | 111 | $(DISABLE_NLS) \ |
9168e838 | 112 | $(MULTILIB) \ |
42b8eb19 | 113 | --disable-werror \ |
9168e838 MNI |
114 | $(SOFT_FLOAT_CONFIG_OPTION) ); |
115 | touch $(BINUTILS_DIR2)/.configured | |
116 | ||
117 | $(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured | |
118 | PATH=$(TARGET_PATH) \ | |
c7bf26e6 | 119 | $(MAKE) -C $(BINUTILS_DIR2) all |
9168e838 | 120 | |
2d523c23 | 121 | $(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump |
9168e838 | 122 | PATH=$(TARGET_PATH) \ |
c7bf26e6 | 123 | $(MAKE) DESTDIR=$(TARGET_DIR) \ |
9168e838 MNI |
124 | tooldir=/usr build_tooldir=/usr \ |
125 | -C $(BINUTILS_DIR2) install | |
126 | #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ | |
127 | # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc | |
128 | -$(STRIP) $(TARGET_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/* > /dev/null 2>&1 | |
2d523c23 | 129 | -$(STRIP) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1 |
9168e838 MNI |
130 | |
131 | binutils_target: $(GCC_DEPENDANCY) $(TARGET_DIR)/usr/bin/ld | |
132 | ||
133 | binutils_target-clean: | |
8500fcd5 MF |
134 | (cd $(TARGET_DIR)/usr/bin; \ |
135 | rm -f addr2line ar as gprof ld nm objcopy \ | |
136 | objdump ranlib readelf size strings strip) | |
9168e838 MNI |
137 | rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)* |
138 | -$(MAKE) -C $(BINUTILS_DIR2) clean | |
139 | ||
140 | binutils_target-dirclean: | |
141 | rm -rf $(BINUTILS_DIR2) |