]>
Commit | Line | Data |
---|---|---|
cd1a2927 | 1 | ############################################################################### |
cd1a2927 | 2 | # # |
70df8302 | 3 | # IPFire.org - A linux based firewall # |
aafdd71b | 4 | # Copyright (C) 2007-2021 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 | ||
25 | include Config | |
26 | ||
a6098f80 | 27 | VER = 2.39 |
cd1a2927 MT |
28 | |
29 | THISAPP = binutils-$(VER) | |
25e33293 | 30 | DL_FILE = $(THISAPP).tar.xz |
1751628e | 31 | DL_FROM = $(URL_IPFIRE) |
cd1a2927 MT |
32 | DIR_APP = $(DIR_SRC)/$(THISAPP) |
33 | ||
6c4cc7ea | 34 | # Normal build or $(TOOLS_DIR) build. |
cd1a2927 MT |
35 | # |
36 | ifeq "$(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 | 47 | else |
15679d9f | 48 | ifeq "$(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)) | |
d83422d1 AF |
54 | CFLAGS := $(patsubst -fstack-clash-protection,,$(CFLAGS)) |
55 | CFLAGS := $(patsubst -fcf-protection,,$(CFLAGS)) | |
8e01581f | 56 | |
cd1a2927 | 57 | TARGET = $(DIR_INFO)/$(THISAPP)-tools1 |
35a8f5f0 MT |
58 | EXTRA_CONFIG = \ |
59 | --target=$(CROSSTARGET) \ | |
6c4cc7ea | 60 | --prefix=$(TOOLS_DIR) \ |
2eb67894 | 61 | --with-sysroot=$(ROOT) \ |
e111b836 MT |
62 | --with-lib-path=$(TOOLS_DIR)/lib \ |
63 | --disable-nls | |
35a8f5f0 | 64 | EXTRA_MAKE = |
66c36198 | 65 | EXTRA_INSTALL = |
cd1a2927 MT |
66 | else |
67 | TARGET = $(DIR_INFO)/$(THISAPP)-tools2 | |
35a8f5f0 | 68 | EXTRA_ENV = \ |
a74272d2 | 69 | CC="$(CROSSTARGET)-gcc" \ |
35a8f5f0 MT |
70 | AR="$(CROSSTARGET)-ar" \ |
71 | RANLIB="$(CROSSTARGET)-ranlib" | |
72 | EXTRA_CONFIG = \ | |
c16a83df MT |
73 | --build=$(BUILDTARGET) \ |
74 | --host=$(BUILDTARGET) \ | |
6c4cc7ea | 75 | --prefix=$(TOOLS_DIR) \ |
e111b836 MT |
76 | --with-lib-path=$(TOOLS_DIR)/lib \ |
77 | --with-sysroot \ | |
78 | --disable-nls | |
66c36198 PM |
79 | EXTRA_MAKE = |
80 | EXTRA_INSTALL = | |
cd1a2927 MT |
81 | endif |
82 | endif | |
83 | ||
aafdd71b | 84 | ifeq "$(BUILD_ARCH)" "armv6l" |
51f9e7ac | 85 | EXTRA_CONFIG += \ |
51f9e7ac | 86 | --with-abi=aapcs-linux \ |
aafdd71b | 87 | --with-float=softfp |
51f9e7ac MT |
88 | endif |
89 | ||
81aa9714 | 90 | EXTRA_CONFIG += \ |
18f49339 | 91 | --disable-werror \ |
81aa9714 MT |
92 | --enable-64-bit-bfd |
93 | ||
cd1a2927 MT |
94 | ############################################################################### |
95 | # Top-level Rules | |
96 | ############################################################################### | |
97 | ||
98 | objects = $(DL_FILE) | |
99 | ||
100 | $(DL_FILE) = $(DL_FROM)/$(DL_FILE) | |
101 | ||
a6098f80 | 102 | $(DL_FILE)_BLAKE2 = ac6a5296c6586d53eaadcbffc5c399a6d79edf72450b9bb8b3525ce525129cef3d2eb90c85ef3bb3270b5a03b0e1ffb8f0b705f028158726f9777ebb8685066f |
cd1a2927 MT |
103 | |
104 | install : $(TARGET) | |
105 | ||
106 | check : $(patsubst %,$(DIR_CHK)/%,$(objects)) | |
107 | ||
108 | download :$(patsubst %,$(DIR_DL)/%,$(objects)) | |
109 | ||
9a7e4d85 | 110 | b2 : $(subst %,%_BLAKE2,$(objects)) |
cd1a2927 MT |
111 | |
112 | ############################################################################### | |
9a7e4d85 | 113 | # Downloading, checking, b2sum |
cd1a2927 MT |
114 | ############################################################################### |
115 | ||
116 | $(patsubst %,$(DIR_CHK)/%,$(objects)) : | |
117 | @$(CHECK) | |
118 | ||
119 | $(patsubst %,$(DIR_DL)/%,$(objects)) : | |
120 | @$(LOAD) | |
121 | ||
9a7e4d85 PM |
122 | $(subst %,%_BLAKE2,$(objects)) : |
123 | @$(B2SUM) | |
cd1a2927 MT |
124 | |
125 | ############################################################################### | |
126 | # Installation Details | |
127 | ############################################################################### | |
128 | ||
129 | $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) | |
130 | @$(PREBUILD) | |
7cefbe1c | 131 | @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) |
cd1a2927 | 132 | @mkdir $(DIR_SRC)/binutils-build |
fc5076e3 MT |
133 | |
134 | # Prevent installing libiberty to lib64. | |
135 | cd $(DIR_APP) && sed -i 's%\(^MULTIOSDIR = \).*%\1 ../lib%' libiberty/Makefile.in | |
136 | ||
dc7d6b20 MT |
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 | |
b4b6bcdb | 140 | ifeq "$(ROOT)" "" |
f97be0a6 | 141 | cp -v $(DIR_APP)/include/libiberty.h /usr/include |
18f49339 MT |
142 | endif |
143 | ||
144 | ifeq "$(TOOLCHAIN)" "1" | |
145 | ifeq "$(PASS)" "2" | |
dc7d6b20 MT |
146 | cd $(DIR_SRC)/binutils-build && make -C ld clean |
147 | cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib | |
6c4cc7ea | 148 | cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new $(TOOLS_DIR)/bin |
18f49339 | 149 | endif |
90d372c4 | 150 | endif |
18f49339 | 151 | |
cd1a2927 MT |
152 | @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build |
153 | @$(POSTBUILD) |