]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/binutils
binutils: Cleanup makefile
[ipfire-2.x.git] / lfs / binutils
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2016 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.28
28
29 THISAPP = binutils-$(VER)
30 DL_FILE = $(THISAPP).tar.gz
31 DL_FROM = $(URL_IPFIRE)
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33
34 # Normal build or /tools 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 TARGET = $(DIR_INFO)/$(THISAPP)-tools1
50 EXTRA_CONFIG = \
51 --target=$(CROSSTARGET) \
52 --prefix=/tools \
53 --with-sysroot=$(ROOT) \
54 --with-lib-path=/tools/lib
55 EXTRA_MAKE =
56 EXTRA_INSTALL =
57 else
58 TARGET = $(DIR_INFO)/$(THISAPP)-tools2
59 EXTRA_ENV = \
60 CC="$(CROSSTARGET)-gcc" \
61 AR="$(CROSSTARGET)-ar" \
62 RANLIB="$(CROSSTARGET)-ranlib"
63 EXTRA_CONFIG = \
64 --host=$(BUILDTARGET) \
65 --build=$(BUILDTARGET) \
66 --prefix=/tools \
67 --with-lib-path=/tools/lib
68 EXTRA_MAKE =
69 EXTRA_INSTALL =
70 endif
71 endif
72
73 ifeq "$(BUILD_ARCH)" "armv5tel"
74 EXTRA_CONFIG += \
75 --with-abi=aapcs-linux \
76 --with-float=soft
77 endif
78
79 EXTRA_CONFIG += \
80 --disable-werror \
81 --enable-64-bit-bfd
82
83 ###############################################################################
84 # Top-level Rules
85 ###############################################################################
86
87 objects = $(DL_FILE)
88
89 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
90
91 $(DL_FILE)_MD5 = d5d270fd0b698ed59ca5ade8e1b5059c
92
93 install : $(TARGET)
94
95 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
96
97 download :$(patsubst %,$(DIR_DL)/%,$(objects))
98
99 md5 : $(subst %,%_MD5,$(objects))
100
101 ###############################################################################
102 # Downloading, checking, md5sum
103 ###############################################################################
104
105 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
106 @$(CHECK)
107
108 $(patsubst %,$(DIR_DL)/%,$(objects)) :
109 @$(LOAD)
110
111 $(subst %,%_MD5,$(objects)) :
112 @$(MD5)
113
114 ###############################################################################
115 # Installation Details
116 ###############################################################################
117
118 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
119 @$(PREBUILD)
120 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
121 @mkdir $(DIR_SRC)/binutils-build
122
123 # Prevent installing libiberty to lib64.
124 cd $(DIR_APP) && sed -i 's%\(^MULTIOSDIR = \).*%\1 ../lib%' libiberty/Makefile.in
125
126 cd $(DIR_SRC)/binutils-build && $(EXTRA_ENV) $(DIR_APP)/configure $(EXTRA_CONFIG)
127 cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING)
128 cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install
129 ifeq "$(ROOT)" ""
130 cp -v $(DIR_APP)/include/libiberty.h /usr/include
131 endif
132
133 ifeq "$(TOOLCHAIN)" "1"
134 ifeq "$(PASS)" "2"
135 cd $(DIR_SRC)/binutils-build && make -C ld clean
136 cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib
137 cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new /tools/bin
138 endif
139 endif
140
141 @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build
142 @$(POSTBUILD)