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