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