Add pcre package
[openwrt.git] / 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://ftp.kernel.org/pub/linux/devel/binutils
9 ifeq ($(BINUTILS_VERSION),2.15)
10 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/
11 endif
12 ifeq ($(BINUTILS_VERSION),2.14)
13 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/
14 endif
15 ifeq ($(BINUTILS_VERSION),2.13)
16 BINUTILS_SITE:=http://ftp.gnu.org/gnu/binutils/
17 endif
18
19 BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2
20 BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)
21 BINUTILS_CAT:=bzcat
22
23 BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)-build
24
25 $(DL_DIR)/$(BINUTILS_SOURCE):
26 mkdir -p $(DL_DIR)
27 $(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE)
28
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
33
34 $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
35 # Apply appropriate binutils patches.
36 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./$(BINUTILS_VERSION) \*.patch
37 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./all \*.patch
38 touch $(BINUTILS_DIR)/.patched
39
40 $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched
41 mkdir -p $(BINUTILS_DIR1)
42 (cd $(BINUTILS_DIR1); \
43 $(BINUTILS_DIR)/configure \
44 --prefix=$(STAGING_DIR) \
45 --build=$(GNU_HOST_NAME) \
46 --host=$(GNU_HOST_NAME) \
47 --target=$(REAL_GNU_TARGET_NAME) \
48 $(DISABLE_NLS) \
49 $(MULTILIB) \
50 $(SOFT_FLOAT_CONFIG_OPTION) );
51 touch $(BINUTILS_DIR1)/.configured
52
53 $(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured
54 $(MAKE) -C $(BINUTILS_DIR1) all
55
56 # Make install will put gettext data in staging_dir/share/locale.
57 # Unfortunatey, it isn't configureable.
58 $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld: $(BINUTILS_DIR1)/binutils/objdump
59 $(MAKE) -C $(BINUTILS_DIR1) install
60
61 binutils-dependencies:
62 @if ! which bison > /dev/null ; then \
63 echo -e "\n\nYou must install 'bison' on your build machine\n"; \
64 exit 1; \
65 fi;
66 @if ! which flex > /dev/null ; then \
67 echo -e "\n\nYou must install 'flex' on your build machine\n"; \
68 exit 1; \
69 fi;
70 @if ! which msgfmt > /dev/null ; then \
71 echo -e "\n\nYou must install 'gettext' on your build machine\n"; \
72 exit 1; \
73 fi;
74
75 binutils: binutils-dependencies $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld
76
77 binutils-source: $(DL_DIR)/$(BINUTILS_SOURCE)
78
79 binutils-clean:
80 rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
81 -$(MAKE) -C $(BINUTILS_DIR1) clean
82
83 binutils-toolclean:
84 rm -rf $(BINUTILS_DIR1)
85
86 binutils-distclean:
87 rm -rf $(BINUTILS_DIR)
88
89
90 #############################################################
91 #
92 # build binutils for use on the target system
93 #
94 #############################################################
95 BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target
96 $(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched
97 mkdir -p $(BINUTILS_DIR2)
98 (cd $(BINUTILS_DIR2); \
99 PATH=$(TARGET_PATH) \
100 CFLAGS="$(TARGET_CFLAGS)" \
101 CFLAGS_FOR_BUILD="-O2 -g" \
102 $(BINUTILS_DIR)/configure \
103 --prefix=/usr \
104 --exec-prefix=/usr \
105 --build=$(GNU_HOST_NAME) \
106 --host=$(REAL_GNU_TARGET_NAME) \
107 --target=$(REAL_GNU_TARGET_NAME) \
108 $(DISABLE_NLS) \
109 $(MULTILIB) \
110 $(SOFT_FLOAT_CONFIG_OPTION) );
111 touch $(BINUTILS_DIR2)/.configured
112
113 $(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured
114 PATH=$(TARGET_PATH) \
115 $(MAKE) -C $(BINUTILS_DIR2) all
116
117 $(TARGET_DIR)/usr/bin/ld: $(BINUTILS_DIR2)/binutils/objdump
118 PATH=$(TARGET_PATH) \
119 $(MAKE) DESTDIR=$(TARGET_DIR) \
120 tooldir=/usr build_tooldir=/usr \
121 -C $(BINUTILS_DIR2) install
122 #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
123 # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
124 -$(STRIP) $(TARGET_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/* > /dev/null 2>&1
125 -$(STRIP) $(TARGET_DIR)/usr/bin/* > /dev/null 2>&1
126
127 binutils_target: $(GCC_DEPENDANCY) $(TARGET_DIR)/usr/bin/ld
128
129 binutils_target-clean:
130 (cd $(TARGET_DIR)/usr/bin; \
131 rm -f addr2line ar as gprof ld nm objcopy \
132 objdump ranlib readelf size strings strip)
133 rm -f $(TARGET_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
134 -$(MAKE) -C $(BINUTILS_DIR2) clean
135
136 binutils_target-toolclean:
137 rm -rf $(BINUTILS_DIR2)
This page took 0.047645 seconds and 5 git commands to generate.