]>
Commit | Line | Data |
---|---|---|
1 | ############################################################# | |
2 | # | |
3 | # build binutils for use on the host system | |
4 | # | |
5 | ############################################################# | |
6 | BINUTILS_VERSION:=$(strip $(subst ",, $(BR2_BINUTILS_VERSION))) | |
7 | #")) | |
8 | ||
9 | EXTRA_BINUTILS_CONFIG_OPTIONS:=$(strip $(subst ",, $(BR2_EXTRA_BINUTILS_CONFIG_OPTIONS))) | |
10 | #")) | |
11 | BINUTILS_SITE:=ftp://ftp.kernel.org/pub/linux/devel/binutils | |
12 | ifeq ($(BINUTILS_VERSION),2.17) | |
13 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ | |
14 | endif | |
15 | ifeq ($(BINUTILS_VERSION),2.16) | |
16 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ | |
17 | endif | |
18 | ifeq ($(BINUTILS_VERSION),2.16.1) | |
19 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ | |
20 | endif | |
21 | ifeq ($(BINUTILS_VERSION),2.15) | |
22 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ | |
23 | endif | |
24 | ifeq ($(BINUTILS_VERSION),2.14) | |
25 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ | |
26 | endif | |
27 | ifeq ($(BINUTILS_VERSION),2.13) | |
28 | BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils/ | |
29 | endif | |
30 | ifeq ($(BINUTILS_VERSION),2.15.97) | |
31 | BINUTILS_SITE:=ftp://sources.redhat.com/pub/binutils/snapshots/ | |
32 | endif | |
33 | ||
34 | BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2 | |
35 | BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION) | |
36 | BINUTILS_CAT:=$(BZCAT) | |
37 | ||
38 | BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)-build | |
39 | ||
40 | $(DL_DIR)/$(BINUTILS_SOURCE): | |
41 | mkdir -p $(DL_DIR) | |
42 | $(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE) | |
43 | ||
44 | binutils-unpacked: $(BINUTILS_DIR)/.unpacked | |
45 | $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE) | |
46 | mkdir -p $(TOOL_BUILD_DIR) | |
47 | $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) - | |
48 | $(CONFIG_UPDATE) $(BINUTILS_DIR) | |
49 | touch $(BINUTILS_DIR)/.unpacked | |
50 | ||
51 | $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked | |
52 | # Apply appropriate binutils patches. | |
53 | toolchain/patch-kernel.sh $(BINUTILS_DIR) toolchain/binutils/$(BINUTILS_VERSION) \*.patch | |
54 | touch $(BINUTILS_DIR)/.patched | |
55 | ||
56 | $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched | |
57 | mkdir -p $(BINUTILS_DIR1) | |
58 | (cd $(BINUTILS_DIR1); \ | |
59 | CC="$(HOSTCC)" \ | |
60 | $(BINUTILS_DIR)/configure \ | |
61 | --prefix=$(STAGING_DIR) \ | |
62 | --build=$(GNU_HOST_NAME) \ | |
63 | --host=$(GNU_HOST_NAME) \ | |
64 | --target=$(REAL_GNU_TARGET_NAME) \ | |
65 | $(DISABLE_NLS) \ | |
66 | $(MULTILIB) \ | |
67 | --disable-werror \ | |
68 | $(SOFT_FLOAT_CONFIG_OPTION) \ | |
69 | $(EXTRA_BINUTILS_CONFIG_OPTIONS)); | |
70 | touch $(BINUTILS_DIR1)/.configured | |
71 | ||
72 | $(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured | |
73 | $(MAKE) -C $(BINUTILS_DIR1) all | |
74 | ||
75 | # Make install will put gettext data in staging_dir/share/locale. | |
76 | # Unfortunatey, it isn't configureable. | |
77 | $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/ld: $(BINUTILS_DIR1)/binutils/objdump | |
78 | $(MAKE) -C $(BINUTILS_DIR1) install | |
79 | ||
80 | binutils: dependencies $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/ld | |
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 | ############################################################# | |
98 | BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target | |
99 | $(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched | |
100 | mkdir -p $(BINUTILS_DIR2) | |
101 | (cd $(BINUTILS_DIR2); \ | |
102 | PATH=$(TARGET_PATH) \ | |
103 | CFLAGS="$(TARGET_CFLAGS)" \ | |
104 | CFLAGS_FOR_BUILD="-O2 -g" \ | |
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) \ | |
111 | $(DISABLE_NLS) \ | |
112 | $(MULTILIB) \ | |
113 | --disable-werror \ | |
114 | $(SOFT_FLOAT_CONFIG_OPTION) ); | |
115 | touch $(BINUTILS_DIR2)/.configured | |
116 | ||
117 | $(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured | |
118 | PATH=$(TARGET_PATH) \ | |
119 | $(MAKE) -C $(BINUTILS_DIR2) all | |
120 | ||
121 | $(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump | |
122 | PATH=$(TARGET_PATH) \ | |
123 | $(MAKE) DESTDIR=$(TARGET_DIR) \ | |
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 | |
129 | -$(STRIP) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1 | |
130 | ||
131 | binutils_target: $(GCC_DEPENDANCY) $(TARGET_DIR)/usr/bin/ld | |
132 | ||
133 | binutils_target-clean: | |
134 | (cd $(TARGET_DIR)/usr/bin; \ | |
135 | rm -f addr2line ar as gprof ld nm objcopy \ | |
136 | objdump ranlib readelf size strings strip) | |
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) |