]> git.ipfire.org Git - ipfire-2.x.git/blame - lfs/binutils
Add support to build an ARM toolchain.
[ipfire-2.x.git] / lfs / binutils
CommitLineData
cd1a2927 1###############################################################################
cd1a2927 2# #
70df8302 3# IPFire.org - A linux based firewall #
46c2a9e3 4# Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
70df8302
MT
5# #
6# This program is free software: you can redistribute it and/or modify #
cd1a2927 7# it under the terms of the GNU General Public License as published by #
70df8302 8# the Free Software Foundation, either version 3 of the License, or #
cd1a2927
MT
9# (at your option) any later version. #
10# #
70df8302 11# This program is distributed in the hope that it will be useful, #
cd1a2927
MT
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 #
70df8302 17# along with this program. If not, see <http://www.gnu.org/licenses/>. #
cd1a2927 18# #
cd1a2927
MT
19###############################################################################
20
21###############################################################################
22# Definitions
23###############################################################################
24
25include Config
26
51f9e7ac
MT
27ifeq "$(MACHINE)" "arm"
28 VER = 2.18
29else
30 VER = 2.17
31endif
cd1a2927
MT
32
33THISAPP = binutils-$(VER)
34DL_FILE = $(THISAPP).tar.bz2
1751628e 35DL_FROM = $(URL_IPFIRE)
cd1a2927
MT
36DIR_APP = $(DIR_SRC)/$(THISAPP)
37
51f9e7ac
MT
38# XXX maybe we can remove that ugly MACHINE= by this
39#unexport MACHINE
40
cd1a2927
MT
41# Normal build or /tools build.
42#
43ifeq "$(ROOT)" ""
bc9f0c12
MT
44ifeq "$(LFS_PASS)" "install"
45 TARGET = $(DIR_INFO)/$(THISAPP)-install
a50d04ab
MT
46 EXTRA_CONFIG = --prefix=/opt/$(MACHINE)-uClibc \
47 --build=$(MACHINE)-pc-linux-gnu \
48 --host=$(MACHINE)-pc-linux-gnu \
49 --target=$(MACHINE)-linux-uclibc \
50 --disable-nls \
51 --enable-multilib \
52 --disable-werror
53 EXTRA_MAKE = all
54 EXTRA_INSTALL =
bc9f0c12 55else
cd1a2927
MT
56 TARGET = $(DIR_INFO)/$(THISAPP)
57 EXTRA_CONFIG = --prefix=/usr --enable-shared --disable-nls
857d9bf2
MT
58 EXTRA_MAKE = tooldir=/usr
59 EXTRA_INSTALL = tooldir=/usr
bc9f0c12 60endif
cd1a2927 61else
15679d9f 62ifeq "$(PASS)" "1"
cd1a2927 63 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
46c2a9e3 64 EXTRA_CONFIG = --prefix=/tools --disable-nls --disable-werror --disable-gprof
51f9e7ac 65 #EXTRA_MAKE = LDFLAGS="-all-static"
cd1a2927
MT
66 EXTRA_INSTALL =
67else
68 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
dd714b8a 69 EXTRA_CONFIG = --prefix=/tools --with-lib-path=/tools/lib --disable-nls
cd1a2927
MT
70 EXTRA_MAKE =
71 EXTRA_INSTALL =
72endif
73endif
74
51f9e7ac
MT
75ifeq "$(MACHINE)" "arm"
76 EXTRA_CONFIG += \
77 --host=$(BUILDTARGET) \
78 --build=$(BUILDTARGET) \
79 --target=$(BUILDTARGET) \
80 --with-abi=aapcs-linux \
81 --with-float=soft
82endif
83
cd1a2927
MT
84###############################################################################
85# Top-level Rules
86###############################################################################
87
88objects = $(DL_FILE)
89
90$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
91
51f9e7ac
MT
92ifeq "$(MACHINE)" "arm"
93 $(DL_FILE)_MD5 = 9d22ee4dafa3a194457caf4706f9cf01
94else
95 $(DL_FILE)_MD5 = e26e2e06b6e4bf3acf1dc8688a94c0d1
96endif
cd1a2927
MT
97
98install : $(TARGET)
99
100check : $(patsubst %,$(DIR_CHK)/%,$(objects))
101
102download :$(patsubst %,$(DIR_DL)/%,$(objects))
103
104md5 : $(subst %,%_MD5,$(objects))
105
106###############################################################################
107# Downloading, checking, md5sum
108###############################################################################
109
110$(patsubst %,$(DIR_CHK)/%,$(objects)) :
111 @$(CHECK)
112
113$(patsubst %,$(DIR_DL)/%,$(objects)) :
114 @$(LOAD)
115
116$(subst %,%_MD5,$(objects)) :
117 @$(MD5)
118
119###############################################################################
120# Installation Details
121###############################################################################
122
123$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
124 @$(PREBUILD)
125 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
126 @mkdir $(DIR_SRC)/binutils-build
51f9e7ac 127 cd $(DIR_SRC)/binutils-build && MACHINE= $(DIR_APP)/configure $(EXTRA_CONFIG)
e22c7973 128ifeq "$(PASS)" "1"
51f9e7ac 129 cd $(DIR_SRC)/binutils-build && make configure-host MAKEINFO=makeinfo MACHINE=
e22c7973 130endif
51f9e7ac
MT
131 cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING) MAKEINFO=makeinfo MACHINE=
132 cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install MAKEINFO=makeinfo MACHINE=
b4b6bcdb 133ifeq "$(ROOT)" ""
bc9f0c12 134ifneq "$(LFS_PASS)" "install"
f97be0a6 135 cp -v $(DIR_APP)/include/libiberty.h /usr/include
bc9f0c12 136endif
cd1a2927 137else
15679d9f 138ifeq "$(PASS)" "1"
51f9e7ac
MT
139 cd $(DIR_SRC)/binutils-build && make -C ld clean MACHINE=
140 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/tools/lib MACHINE=
90d372c4 141 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new /tools/bin
dd714b8a 142else
51f9e7ac
MT
143 cd $(DIR_SRC)/binutils-build && make -C ld clean MACHINE=
144 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib MACHINE=
dd714b8a 145 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new /tools/bin
90d372c4 146endif
cd1a2927
MT
147endif
148 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build
149 @$(POSTBUILD)