]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - lfs/binutils
toolchain: Build without hardening
[people/pmueller/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
7cefbe1c 27VER = 2.28
cd1a2927
MT
28
29THISAPP = binutils-$(VER)
7cefbe1c 30DL_FILE = $(THISAPP).tar.gz
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))
cd1a2927 49 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
35a8f5f0
MT
50 EXTRA_CONFIG = \
51 --target=$(CROSSTARGET) \
52 --prefix=/tools \
2eb67894
AF
53 --with-sysroot=$(ROOT) \
54 --with-lib-path=/tools/lib \
35a8f5f0
MT
55 --disable-nls \
56 --disable-werror
57 EXTRA_MAKE =
cd1a2927
MT
58 EXTRA_INSTALL =
59else
60 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
35a8f5f0
MT
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 \
2eb67894
AF
70 --disable-nls \
71 --disable-werror
cd1a2927
MT
72 EXTRA_MAKE =
73 EXTRA_INSTALL =
74endif
75endif
76
7cefbe1c 77ifeq "$(MACHINE)" "armv5tel"
51f9e7ac 78 EXTRA_CONFIG += \
51f9e7ac 79 --with-abi=aapcs-linux \
35a8f5f0 80 --with-float=soft
51f9e7ac
MT
81endif
82
81aa9714
MT
83EXTRA_CONFIG += \
84 --enable-64-bit-bfd
85
cd1a2927
MT
86###############################################################################
87# Top-level Rules
88###############################################################################
89
90objects = $(DL_FILE)
91
92$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
93
7cefbe1c 94$(DL_FILE)_MD5 = d5d270fd0b698ed59ca5ade8e1b5059c
cd1a2927
MT
95
96install : $(TARGET)
97
98check : $(patsubst %,$(DIR_CHK)/%,$(objects))
99
100download :$(patsubst %,$(DIR_DL)/%,$(objects))
101
102md5 : $(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)
7cefbe1c 123 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
cd1a2927 124 @mkdir $(DIR_SRC)/binutils-build
fc5076e3
MT
125
126 # Prevent installing libiberty to lib64.
127 cd $(DIR_APP) && sed -i 's%\(^MULTIOSDIR = \).*%\1 ../lib%' libiberty/Makefile.in
128
11fbf1fa 129 cd $(DIR_SRC)/binutils-build && $(EXTRA_ENV) MACHINE= $(DIR_APP)/configure $(EXTRA_CONFIG)
7cefbe1c
MT
130 cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING)
131 cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install
b4b6bcdb 132ifeq "$(ROOT)" ""
f97be0a6 133 cp -v $(DIR_APP)/include/libiberty.h /usr/include
cd1a2927 134else
35a8f5f0 135ifeq "$(PASS)" "2"
7cefbe1c
MT
136 cd $(DIR_SRC)/binutils-build && make -C ld clean
137 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib
dd714b8a 138 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new /tools/bin
90d372c4 139endif
cd1a2927
MT
140endif
141 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build
142 @$(POSTBUILD)