fix qdisc ordering
[openwrt.git] / openwrt / toolchain / binutils / binutils.mk
1 #############################################################
2 #
3 # build binutils for use on the host system
4 #
5 #############################################################
6 BINUTILS_VERSION:=$(strip $(subst ",, $(BR2_BINUTILS_VERSION)))
7
8 BINUTILS_SITE:=http://www.fr.kernel.org/pub/linux/devel/binutils \
9 http://www.fi.kernel.org/pub/linux/devel/binutils \
10 http://ftp.kernel.org/pub/linux/devel/binutils \
11 http://www.de.kernel.org/pub/linux/devel/binutils
12 ifeq ($(BINUTILS_VERSION),2.15)
13 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/ \
14 ftp://gatekeeper.dec.com/pub/GNU/ \
15 ftp://ftp.uu.net/archive/systems/gnu/ \
16 ftp://ftp.eu.uu.net/pub/gnu/ \
17 ftp://ftp.funet.fi/pub/gnu/prep/ \
18 ftp://ftp.leo.org/pub/comp/os/unix/gnu/
19 endif
20 ifeq ($(BINUTILS_VERSION),2.14)
21 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/ \
22 ftp://gatekeeper.dec.com/pub/GNU/ \
23 ftp://ftp.uu.net/archive/systems/gnu/ \
24 ftp://ftp.eu.uu.net/pub/gnu/ \
25 ftp://ftp.funet.fi/pub/gnu/prep/ \
26 ftp://ftp.leo.org/pub/comp/os/unix/gnu/
27 endif
28 ifeq ($(BINUTILS_VERSION),2.13)
29 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/ \
30 ftp://gatekeeper.dec.com/pub/GNU/ \
31 ftp://ftp.uu.net/archive/systems/gnu/ \
32 ftp://ftp.eu.uu.net/pub/gnu/ \
33 ftp://ftp.funet.fi/pub/gnu/prep/ \
34 ftp://ftp.leo.org/pub/comp/os/unix/gnu/
35 endif
36
37 BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2
38 BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)
39 BINUTILS_CAT:=bzcat
40
41 BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)-build
42
43 $(DL_DIR)/$(BINUTILS_SOURCE):
44 mkdir -p $(DL_DIR)
45 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(BINUTILS_SOURCE) x $(BINUTILS_SITE)
46
47 $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
48 mkdir -p $(TOOL_BUILD_DIR)
49 $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
50 touch $(BINUTILS_DIR)/.unpacked
51
52 $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
53 # Apply appropriate binutils patches.
54 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./all \*.patch
55 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./$(BINUTILS_VERSION) \*.patch
56 touch $(BINUTILS_DIR)/.patched
57
58 $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched
59 mkdir -p $(BINUTILS_DIR1)
60 (cd $(BINUTILS_DIR1); \
61 $(BINUTILS_DIR)/configure \
62 --prefix=$(STAGING_DIR) \
63 --build=$(GNU_HOST_NAME) \
64 --host=$(GNU_HOST_NAME) \
65 --target=$(REAL_GNU_TARGET_NAME) \
66 --disable-werror \
67 $(DISABLE_NLS) \
68 $(MULTILIB) \
69 $(SOFT_FLOAT_CONFIG_OPTION) );
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)/bin/$(REAL_GNU_TARGET_NAME)-ld: $(BINUTILS_DIR1)/binutils/objdump
78 $(MAKE) -C $(BINUTILS_DIR1) install
79
80 binutils-dependencies:
81 @if ! which bison > /dev/null ; then \
82 echo -e "\n\nYou must install 'bison' on your build machine\n"; \
83 exit 1; \
84 fi;
85 @if ! which flex > /dev/null ; then \
86 echo -e "\n\nYou must install 'flex' on your build machine\n"; \
87 exit 1; \
88 fi;
89 @if ! which msgfmt > /dev/null ; then \
90 echo -e "\n\nYou must install 'gettext' on your build machine\n"; \
91 exit 1; \
92 fi;
93
94 binutils: binutils-dependencies $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld
95
96 binutils-source: $(DL_DIR)/$(BINUTILS_SOURCE)
97
98 binutils-clean:
99 rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
100 -$(MAKE) -C $(BINUTILS_DIR1) clean
101
102 binutils-toolclean:
103 rm -rf $(BINUTILS_DIR1)
104
105 binutils-distclean:
106 rm -rf $(BINUTILS_DIR)
107
108
109 #############################################################
110 #
111 # build binutils for use on the target system
112 #
113 #############################################################
114 BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target
115 $(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched
116 mkdir -p $(BINUTILS_DIR2)
117 (cd $(BINUTILS_DIR2); \
118 PATH=$(TARGET_PATH) \
119 CFLAGS="$(TARGET_CFLAGS)" \
120 CFLAGS_FOR_BUILD="-O2 -g" \
121 $(BINUTILS_DIR)/configure \
122 --prefix=/usr \
123 --exec-prefix=/usr \
124 --build=$(GNU_HOST_NAME) \
125 --host=$(REAL_GNU_TARGET_NAME) \
126 --target=$(REAL_GNU_TARGET_NAME) \
127 $(DISABLE_NLS) \
128 $(MULTILIB) \
129 $(SOFT_FLOAT_CONFIG_OPTION) );
130 touch $(BINUTILS_DIR2)/.configured
131
132 $(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured
133 PATH=$(TARGET_PATH) \
134 $(MAKE) -C $(BINUTILS_DIR2) all
135
136 $(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump
137 PATH=$(TARGET_PATH) \
138 $(MAKE) DESTDIR=$(TARGET_DIR) \
139 tooldir=/usr build_tooldir=/usr \
140 -C $(BINUTILS_DIR2) install
141 #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
142 # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
143 -$(STRIP) $(TARGET_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/* > /dev/null 2>&1
144 -$(STRIP) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1
145
146 binutils_target: $(GCC_DEPENDANCY) $(TARGET_DIR)/usr/bin/ld
147
148 binutils_target-clean:
149 (cd $(TARGET_DIR)/usr/bin; \
150 rm -f addr2line ar as gprof ld nm objcopy \
151 objdump ranlib readelf size strings strip)
152 rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
153 -$(MAKE) -C $(BINUTILS_DIR2) clean
154
155 binutils_target-toolclean:
156 rm -rf $(BINUTILS_DIR2)
This page took 0.053482 seconds and 5 git commands to generate.