]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/binutils
toolchain: build toolchain on armv6l and armv7l.
[ipfire-2.x.git] / lfs / binutils
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 VER = 2.18
28
29 THISAPP = binutils-$(VER)
30 DL_FILE = $(THISAPP).tar.bz2
31 DL_FROM = $(URL_IPFIRE)
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33
34 # XXX maybe we can remove that ugly MACHINE= by this
35 #unexport MACHINE
36
37 # Normal build or /tools build.
38 #
39 ifeq "$(ROOT)" ""
40 TARGET = $(DIR_INFO)/$(THISAPP)
41 EXTRA_CONFIG = --prefix=/usr --enable-shared --disable-nls
42 EXTRA_MAKE = tooldir=/usr
43 EXTRA_INSTALL = tooldir=/usr
44 else
45 ifeq "$(PASS)" "1"
46 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
47 CFLAGS =
48 EXTRA_CONFIG = --prefix=/tools --disable-nls --disable-werror --disable-gprof
49 #EXTRA_MAKE = LDFLAGS="-all-static"
50 EXTRA_INSTALL =
51 else
52 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
53 EXTRA_CONFIG = --prefix=/tools --with-lib-path=/tools/lib --disable-nls
54 EXTRA_MAKE =
55 EXTRA_INSTALL =
56 endif
57 endif
58
59 EXTRA_CONFIG += --build=$(BUILDTARGET)
60
61 ifeq "$(MACHINE_TYPE)" "arm"
62 EXTRA_CONFIG += \
63 --with-abi=aapcs-linux \
64 --with-float=soft
65 endif
66
67 ###############################################################################
68 # Top-level Rules
69 ###############################################################################
70
71 objects = $(DL_FILE)
72
73 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
74
75 $(DL_FILE)_MD5 = 9d22ee4dafa3a194457caf4706f9cf01
76
77 install : $(TARGET)
78
79 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
80
81 download :$(patsubst %,$(DIR_DL)/%,$(objects))
82
83 md5 : $(subst %,%_MD5,$(objects))
84
85 ###############################################################################
86 # Downloading, checking, md5sum
87 ###############################################################################
88
89 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
90 @$(CHECK)
91
92 $(patsubst %,$(DIR_DL)/%,$(objects)) :
93 @$(LOAD)
94
95 $(subst %,%_MD5,$(objects)) :
96 @$(MD5)
97
98 ###############################################################################
99 # Installation Details
100 ###############################################################################
101
102 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
103 @$(PREBUILD)
104 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
105 @mkdir $(DIR_SRC)/binutils-build
106 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/$(THISAPP)-configure-1.patch
107 cd $(DIR_SRC)/binutils-build && MACHINE= $(DIR_APP)/configure $(EXTRA_CONFIG)
108 ifeq "$(PASS)" "1"
109 cd $(DIR_SRC)/binutils-build && make configure-host MAKEINFO=makeinfo MACHINE=
110 endif
111 cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING) MAKEINFO=makeinfo MACHINE=
112 cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install MAKEINFO=makeinfo MACHINE=
113 ifeq "$(ROOT)" ""
114 cp -v $(DIR_APP)/include/libiberty.h /usr/include
115 else
116 ifeq "$(PASS)" "1"
117 cd $(DIR_SRC)/binutils-build && make -C ld clean MACHINE=
118 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/tools/lib MACHINE=
119 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new /tools/bin
120 else
121 cd $(DIR_SRC)/binutils-build && make -C ld clean MACHINE=
122 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib MACHINE=
123 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new /tools/bin
124 endif
125 endif
126 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build
127 @$(POSTBUILD)