]> git.ipfire.org Git - ipfire-2.x.git/blame - lfs/binutils
Cleanup toolchain scripts
[ipfire-2.x.git] / lfs / binutils
CommitLineData
cd1a2927 1###############################################################################
cd1a2927 2# #
70df8302 3# IPFire.org - A linux based firewall #
f3c01b39 4# Copyright (C) 2007-2017 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
25e33293 27VER = 2.30
cd1a2927
MT
28
29THISAPP = binutils-$(VER)
25e33293 30DL_FILE = $(THISAPP).tar.xz
1751628e 31DL_FROM = $(URL_IPFIRE)
cd1a2927
MT
32DIR_APP = $(DIR_SRC)/$(THISAPP)
33
6c4cc7ea 34# Normal build or $(TOOLS_DIR) build.
cd1a2927
MT
35#
36ifeq "$(ROOT)" ""
37 TARGET = $(DIR_INFO)/$(THISAPP)
1d627130
MT
38 EXTRA_CONFIG = \
39 --prefix=/usr \
40 --enable-shared \
18f49339
MT
41 --with-system-zlib \
42 --enable-plugins \
43 --enable-ld=default \
44 --disable-gold
857d9bf2
MT
45 EXTRA_MAKE = tooldir=/usr
46 EXTRA_INSTALL = tooldir=/usr
cd1a2927 47else
15679d9f 48ifeq "$(PASS)" "1"
8e01581f 49 CFLAGS := $(patsubst -march=%,,$(CFLAGS))
f3c01b39 50 CFLAGS := $(patsubst -mfpu=%,,$(CFLAGS))
8e01581f 51 CFLAGS := $(patsubst -mfloat-abi=%,,$(CFLAGS))
11b5e5cb
AF
52 CFLAGS := $(patsubst -mindirect-branch=%,,$(CFLAGS))
53 CFLAGS := $(patsubst -mfunction-return=%,,$(CFLAGS))
8e01581f 54
cd1a2927 55 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
35a8f5f0
MT
56 EXTRA_CONFIG = \
57 --target=$(CROSSTARGET) \
6c4cc7ea 58 --prefix=$(TOOLS_DIR) \
2eb67894 59 --with-sysroot=$(ROOT) \
6c4cc7ea 60 --with-lib-path=$(TOOLS_DIR)/lib
35a8f5f0 61 EXTRA_MAKE =
cd1a2927
MT
62 EXTRA_INSTALL =
63else
64 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
35a8f5f0 65 EXTRA_ENV = \
a74272d2 66 CC="$(CROSSTARGET)-gcc" \
35a8f5f0
MT
67 AR="$(CROSSTARGET)-ar" \
68 RANLIB="$(CROSSTARGET)-ranlib"
69 EXTRA_CONFIG = \
70 --host=$(BUILDTARGET) \
71 --build=$(BUILDTARGET) \
6c4cc7ea
MT
72 --prefix=$(TOOLS_DIR) \
73 --with-lib-path=$(TOOLS_DIR)/lib
cd1a2927
MT
74 EXTRA_MAKE =
75 EXTRA_INSTALL =
76endif
77endif
78
dc7d6b20 79ifeq "$(BUILD_ARCH)" "armv5tel"
51f9e7ac 80 EXTRA_CONFIG += \
51f9e7ac 81 --with-abi=aapcs-linux \
35a8f5f0 82 --with-float=soft
51f9e7ac
MT
83endif
84
81aa9714 85EXTRA_CONFIG += \
18f49339 86 --disable-werror \
81aa9714
MT
87 --enable-64-bit-bfd
88
cd1a2927
MT
89###############################################################################
90# Top-level Rules
91###############################################################################
92
93objects = $(DL_FILE)
94
95$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
96
25e33293 97$(DL_FILE)_MD5 = ffc476dd46c96f932875d1b2e27e929f
cd1a2927
MT
98
99install : $(TARGET)
100
101check : $(patsubst %,$(DIR_CHK)/%,$(objects))
102
103download :$(patsubst %,$(DIR_DL)/%,$(objects))
104
105md5 : $(subst %,%_MD5,$(objects))
106
107###############################################################################
108# Downloading, checking, md5sum
109###############################################################################
110
111$(patsubst %,$(DIR_CHK)/%,$(objects)) :
112 @$(CHECK)
113
114$(patsubst %,$(DIR_DL)/%,$(objects)) :
115 @$(LOAD)
116
117$(subst %,%_MD5,$(objects)) :
118 @$(MD5)
119
120###############################################################################
121# Installation Details
122###############################################################################
123
124$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
125 @$(PREBUILD)
7cefbe1c 126 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
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
dc7d6b20
MT
132 cd $(DIR_SRC)/binutils-build && $(EXTRA_ENV) $(DIR_APP)/configure $(EXTRA_CONFIG)
133 cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING)
134 cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install
b4b6bcdb 135ifeq "$(ROOT)" ""
f97be0a6 136 cp -v $(DIR_APP)/include/libiberty.h /usr/include
18f49339
MT
137endif
138
139ifeq "$(TOOLCHAIN)" "1"
140 ifeq "$(PASS)" "2"
dc7d6b20
MT
141 cd $(DIR_SRC)/binutils-build && make -C ld clean
142 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib
6c4cc7ea 143 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new $(TOOLS_DIR)/bin
18f49339 144 endif
90d372c4 145endif
18f49339 146
cd1a2927
MT
147 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build
148 @$(POSTBUILD)