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