]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - lfs/binutils
suricata: Change midstream policy to "pass-flow"
[people/pmueller/ipfire-2.x.git] / lfs / binutils
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2021 IPFire Team <info@ipfire.org> #
5 # #
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. #
10 # #
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. #
15 # #
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/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 VER = 2.40
28
29 THISAPP = binutils-$(VER)
30 DL_FILE = $(THISAPP).tar.xz
31 DL_FROM = $(URL_IPFIRE)
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33
34 # Normal build or $(TOOLS_DIR) build.
35 #
36 ifeq "$(ROOT)" ""
37 TARGET = $(DIR_INFO)/$(THISAPP)
38 EXTRA_CONFIG = \
39 --prefix=/usr \
40 --enable-shared \
41 --with-system-zlib \
42 --enable-plugins \
43 --enable-ld=default \
44 --disable-gold
45 EXTRA_MAKE = tooldir=/usr
46 EXTRA_INSTALL = tooldir=/usr
47 else
48 ifeq "$(PASS)" "1"
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))
56
57 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
58 EXTRA_CONFIG = \
59 --target=$(CROSSTARGET) \
60 --prefix=$(TOOLS_DIR) \
61 --with-sysroot=$(ROOT) \
62 --with-lib-path=$(TOOLS_DIR)/lib \
63 --disable-nls
64 EXTRA_MAKE =
65 EXTRA_INSTALL =
66 else
67 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
68 EXTRA_ENV = \
69 CC="$(CROSSTARGET)-gcc" \
70 AR="$(CROSSTARGET)-ar" \
71 RANLIB="$(CROSSTARGET)-ranlib"
72 EXTRA_CONFIG = \
73 --build=$(BUILDTARGET) \
74 --host=$(BUILDTARGET) \
75 --prefix=$(TOOLS_DIR) \
76 --with-lib-path=$(TOOLS_DIR)/lib \
77 --with-sysroot \
78 --disable-nls
79 EXTRA_MAKE =
80 EXTRA_INSTALL =
81 endif
82 endif
83
84 EXTRA_CONFIG += \
85 --disable-werror \
86 --enable-64-bit-bfd
87
88 ###############################################################################
89 # Top-level Rules
90 ###############################################################################
91
92 objects = $(DL_FILE)
93
94 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
95
96 $(DL_FILE)_BLAKE2 = 8d799f7c595f878b9af5b17a490021dd8b8300ac2fe0ed8574c012929d22d2d0493e003a3e631a9436e8e712da801779b777c566167fe42b0bde119ffa5ad1c2
97
98 install : $(TARGET)
99
100 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
101
102 download :$(patsubst %,$(DIR_DL)/%,$(objects))
103
104 b2 : $(subst %,%_BLAKE2,$(objects))
105
106 ###############################################################################
107 # Downloading, checking, b2sum
108 ###############################################################################
109
110 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
111 @$(CHECK)
112
113 $(patsubst %,$(DIR_DL)/%,$(objects)) :
114 @$(LOAD)
115
116 $(subst %,%_BLAKE2,$(objects)) :
117 @$(B2SUM)
118
119 ###############################################################################
120 # Installation Details
121 ###############################################################################
122
123 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
124 @$(PREBUILD)
125 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
126 @mkdir $(DIR_SRC)/binutils-build
127
128 # Prevent installing libiberty to lib64.
129 cd $(DIR_APP) && sed -i 's%\(^MULTIOSDIR = \).*%\1 ../lib%' libiberty/Makefile.in
130
131 cd $(DIR_SRC)/binutils-build && $(EXTRA_ENV) $(DIR_APP)/configure $(EXTRA_CONFIG)
132 cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING)
133 cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install
134 ifeq "$(ROOT)" ""
135 cp -v $(DIR_APP)/include/libiberty.h /usr/include
136 endif
137
138 ifeq "$(TOOLCHAIN)" "1"
139 ifeq "$(PASS)" "2"
140 cd $(DIR_SRC)/binutils-build && make -C ld clean
141 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib
142 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new $(TOOLS_DIR)/bin
143 endif
144 endif
145
146 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build
147 @$(POSTBUILD)