]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/binutils
Allow building the toolchain for x86_64
[ipfire-2.x.git] / lfs / binutils
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2013 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.22
28
29 THISAPP = binutils-$(VER)
30 DL_FILE = $(THISAPP).tar.bz2
31 DL_FROM = $(URL_IPFIRE)
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33
34 # Normal build or /tools build.
35 #
36 ifeq "$(ROOT)" ""
37 TARGET = $(DIR_INFO)/$(THISAPP)
38 EXTRA_CONFIG = \
39 --host="${BUILDTARGET}" \
40 --build="${BUILDTARGET}" \
41 --prefix=/usr \
42 --enable-shared \
43 --disable-nls
44 EXTRA_MAKE = tooldir=/usr
45 EXTRA_INSTALL = tooldir=/usr
46 else
47 ifeq "$(PASS)" "1"
48 CFLAGS := $(patsubst -march=%,,$(CFLAGS))
49 CFLAGS := $(patsubst -mfloat-abi=%,,$(CFLAGS))
50 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
51 EXTRA_CONFIG = \
52 --target=$(CROSSTARGET) \
53 --prefix=/tools \
54 --disable-nls \
55 --disable-werror
56 EXTRA_MAKE =
57 EXTRA_INSTALL =
58 else
59 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
60 EXTRA_ENV = \
61 CC="$(CROSSTARGET)-gcc -B/tools/lib/" \
62 AR="$(CROSSTARGET)-ar" \
63 RANLIB="$(CROSSTARGET)-ranlib"
64 EXTRA_CONFIG = \
65 --host=$(BUILDTARGET) \
66 --build=$(BUILDTARGET) \
67 --prefix=/tools \
68 --with-lib-path=/tools/lib \
69 --disable-nls
70 EXTRA_MAKE =
71 EXTRA_INSTALL =
72 endif
73 endif
74
75 ifeq "$(MACHINE_TYPE)" "arm"
76 EXTRA_CONFIG += \
77 --with-abi=aapcs-linux \
78 --with-float=soft
79 endif
80
81 EXTRA_CONFIG += \
82 --enable-64-bit-bfd
83
84 ###############################################################################
85 # Top-level Rules
86 ###############################################################################
87
88 objects = $(DL_FILE)
89
90 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
91
92 $(DL_FILE)_MD5 = ee0f10756c84979622b992a4a61ea3f5
93
94 install : $(TARGET)
95
96 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
97
98 download :$(patsubst %,$(DIR_DL)/%,$(objects))
99
100 md5 : $(subst %,%_MD5,$(objects))
101
102 ###############################################################################
103 # Downloading, checking, md5sum
104 ###############################################################################
105
106 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
107 @$(CHECK)
108
109 $(patsubst %,$(DIR_DL)/%,$(objects)) :
110 @$(LOAD)
111
112 $(subst %,%_MD5,$(objects)) :
113 @$(MD5)
114
115 ###############################################################################
116 # Installation Details
117 ###############################################################################
118
119 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
120 @$(PREBUILD)
121 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
122 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/binutils-2.22-pt-pax-flags-20111121.patch
123
124 # texinfo 5 syntax-fix.
125 cd $(DIR_APP) && sed -i -e "s/@colophon/@@colophon/" \
126 -e "s/doc@cygnus/doc@@cygnus/" bfd/doc/bfd.texinfo
127
128 @mkdir $(DIR_SRC)/binutils-build
129
130 # Prevent installing libiberty to lib64.
131 cd $(DIR_APP) && sed -i 's%\(^MULTIOSDIR = \).*%\1 ../lib%' libiberty/Makefile.in
132
133 cd $(DIR_SRC)/binutils-build && $(EXTRA_ENV) $(DIR_APP)/configure $(EXTRA_CONFIG)
134 cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING)
135 cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install
136 ifeq "$(ROOT)" ""
137 cp -v $(DIR_APP)/include/libiberty.h /usr/include
138 else
139 ifeq "$(PASS)" "2"
140 cd $(DIR_SRC)/binutils-build && make -C ld clean MACHINE=
141 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib MACHINE=
142 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new /tools/bin
143 endif
144 endif
145 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build
146 @$(POSTBUILD)