fix "make target/linux/package/*-*" targets
[openwrt.git] / openwrt / toolchain / binutils / Makefile
1 include $(TOPDIR)/rules.mk
2
3 #############################################################
4 #
5 # build binutils for use on the host system
6 #
7 #############################################################
8 BINUTILS_VERSION:=$(strip $(subst ",, $(BR2_BINUTILS_VERSION)))
9 #"
10
11 BINUTILS_SITE:=http://www.fr.kernel.org/pub/linux/devel/binutils \
12 http://www.fi.kernel.org/pub/linux/devel/binutils \
13 http://ftp.kernel.org/pub/linux/devel/binutils \
14 http://www.de.kernel.org/pub/linux/devel/binutils
15
16 BINUTILS_STABLE_SITE:=http://ftp.gnu.org/gnu/binutils/ \
17 ftp://gatekeeper.dec.com/pub/GNU/ \
18 ftp://ftp.uu.net/archive/systems/gnu/ \
19 ftp://ftp.eu.uu.net/pub/gnu/ \
20 ftp://ftp.funet.fi/pub/gnu/prep/ \
21 ftp://ftp.leo.org/pub/comp/os/unix/gnu/
22
23 ifeq ($(BINUTILS_VERSION),2.16.1)
24 BINUTILS_SITE:=$(BINUTILS_STABLE_SITE)
25 endif
26
27 BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2
28 BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)
29 BINUTILS_CAT:=bzcat
30
31 BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)-build
32
33 $(DL_DIR)/$(BINUTILS_SOURCE):
34 mkdir -p $(DL_DIR)
35 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(BINUTILS_SOURCE) x $(BINUTILS_SITE)
36
37 $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
38 mkdir -p $(TOOL_BUILD_DIR)
39 $(BINUTILS_CAT) $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
40 touch $(BINUTILS_DIR)/.unpacked
41
42 $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
43 # Apply appropriate binutils patches.
44 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./all \*.patch
45 $(SCRIPT_DIR)/patch-kernel.sh $(BINUTILS_DIR) ./$(BINUTILS_VERSION) \*.patch
46 touch $(BINUTILS_DIR)/.patched
47
48 $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched
49 mkdir -p $(BINUTILS_DIR1)
50 (cd $(BINUTILS_DIR1); \
51 $(BINUTILS_DIR)/configure \
52 --prefix=$(STAGING_DIR) \
53 --build=$(GNU_HOST_NAME) \
54 --host=$(GNU_HOST_NAME) \
55 --target=$(REAL_GNU_TARGET_NAME) \
56 --disable-werror \
57 $(DISABLE_NLS) \
58 $(MULTILIB) \
59 $(SOFT_FLOAT_CONFIG_OPTION) );
60 touch $(BINUTILS_DIR1)/.configured
61
62 $(BINUTILS_DIR1)/binutils/objdump: $(BINUTILS_DIR1)/.configured
63 $(MAKE) -C $(BINUTILS_DIR1) all
64
65 # Make install will put gettext data in staging_dir/share/locale.
66 # Unfortunatey, it isn't configureable.
67 $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld: $(BINUTILS_DIR1)/binutils/objdump
68 $(MAKE) -C $(BINUTILS_DIR1) install
69
70
71 #############################################################
72 #
73 # build binutils for use on the target system
74 #
75 #############################################################
76 BINUTILS_DIR2:=$(BUILD_DIR)/binutils-$(BINUTILS_VERSION)-target
77 $(BINUTILS_DIR2)/.configured: $(BINUTILS_DIR)/.patched
78 mkdir -p $(BINUTILS_DIR2)
79 (cd $(BINUTILS_DIR2); \
80 PATH=$(TARGET_PATH) \
81 CFLAGS="$(TARGET_CFLAGS)" \
82 CFLAGS_FOR_BUILD="-O2 -g" \
83 $(BINUTILS_DIR)/configure \
84 --prefix=/usr \
85 --exec-prefix=/usr \
86 --build=$(GNU_HOST_NAME) \
87 --host=$(REAL_GNU_TARGET_NAME) \
88 --target=$(REAL_GNU_TARGET_NAME) \
89 $(DISABLE_NLS) \
90 $(MULTILIB) \
91 $(SOFT_FLOAT_CONFIG_OPTION) );
92 touch $(BINUTILS_DIR2)/.configured
93
94 $(BINUTILS_DIR2)/binutils/objdump: $(BINUTILS_DIR2)/.configured
95 PATH=$(TARGET_PATH) \
96 $(MAKE) -C $(BINUTILS_DIR2) all
97
98 source: $(DL_DIR)/$(BINUTILS_SOURCE)
99 prepare: $(BINUTILS_DIR)/.patched
100 compile: $(BINUTILS_DIR1)/binutils/objdump
101 install: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld
102 clean:
103 rm -f $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)*
104 rm -rf $(BINUTILS_DIR) $(BINUTILS_DIR1)
105
106
This page took 0.043431 seconds and 5 git commands to generate.