1 ###############################################################################
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2021 IPFire Team <info@ipfire.org> #
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. #
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. #
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/>. #
19 ###############################################################################
21 ###############################################################################
23 ###############################################################################
29 THISAPP = binutils-$(VER)
30 DL_FILE = $(THISAPP).tar.xz
31 DL_FROM = $(URL_IPFIRE)
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
34 # Normal build or $(TOOLS_DIR) build.
37 TARGET = $(DIR_INFO)/$(THISAPP)
45 EXTRA_MAKE = tooldir=/usr
46 EXTRA_INSTALL = tooldir=/usr
49 CFLAGS := $(patsubst -march=%,,$(CFLAGS))
50 CFLAGS := $(patsubst -mfpu=%,,$(CFLAGS))
51 CFLAGS := $(patsubst -mfloat-abi=%,,$(CFLAGS))
52 CFLAGS := $(patsubst -mindirect-branch=%,,$(CFLAGS))
53 CFLAGS := $(patsubst -mfunction-return=%,,$(CFLAGS))
54 CFLAGS := $(patsubst -fstack-clash-protection,,$(CFLAGS))
55 CFLAGS := $(patsubst -fcf-protection,,$(CFLAGS))
57 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
59 --target=$(CROSSTARGET) \
60 --prefix=$(TOOLS_DIR) \
61 --with-sysroot=$(ROOT) \
62 --with-lib-path=$(TOOLS_DIR)/lib \
67 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
69 CC="$(CROSSTARGET)-gcc" \
70 AR="$(CROSSTARGET)-ar" \
71 RANLIB="$(CROSSTARGET)-ranlib"
73 --build=$(BUILDTARGET) \
74 --host=$(BUILDTARGET) \
75 --prefix=$(TOOLS_DIR) \
76 --with-lib-path=$(TOOLS_DIR)/lib \
84 ifeq "$(BUILD_ARCH)" "armv6l"
86 --with-abi=aapcs-linux \
94 ###############################################################################
96 ###############################################################################
100 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
102 $(DL_FILE)_BLAKE2 = f5a374fdf0300f7734d1e462333296b16c9d5ed6eba167e1742a4da7082f4388c929e286bf76c3933b3e434937380340732a31790723654b491ea0c8ab5b9ba5
106 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
108 download :$(patsubst %,$(DIR_DL)/%,$(objects))
110 b2 : $(subst %,%_BLAKE2,$(objects))
112 ###############################################################################
113 # Downloading, checking, b2sum
114 ###############################################################################
116 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
119 $(patsubst %,$(DIR_DL)/%,$(objects)) :
122 $(subst %,%_BLAKE2,$(objects)) :
125 ###############################################################################
126 # Installation Details
127 ###############################################################################
129 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
131 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
132 @mkdir $(DIR_SRC)/binutils-build
134 # Prevent installing libiberty to lib64.
135 cd $(DIR_APP) && sed -i 's%\(^MULTIOSDIR = \).*%\1 ../lib%' libiberty/Makefile.in
137 cd $(DIR_SRC)/binutils-build && $(EXTRA_ENV) $(DIR_APP)/configure $(EXTRA_CONFIG)
138 cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING)
139 cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install
141 cp -v $(DIR_APP)/include/libiberty.h /usr/include
144 ifeq "$(TOOLCHAIN)" "1"
146 cd $(DIR_SRC)/binutils-build && make -C ld clean
147 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib
148 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new $(TOOLS_DIR)/bin
152 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build