]>
Commit | Line | Data |
---|---|---|
1 | ############################################################################### | |
2 | # # | |
3 | # IPFire.org - A linux based firewall # | |
4 | # Copyright (C) 2007-2015 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.22 | |
28 | ||
29 | THISAPP = binutils-$(VER) | |
30 | DL_FILE = $(THISAPP).tar.bz2 | |
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 | --disable-nls | |
42 | EXTRA_MAKE = tooldir=/usr | |
43 | EXTRA_INSTALL = tooldir=/usr | |
44 | else | |
45 | ifeq "$(PASS)" "1" | |
46 | CFLAGS := $(patsubst -march=%,,$(CFLAGS)) | |
47 | CFLAGS := $(patsubst -mfloat-abi=%,,$(CFLAGS)) | |
48 | TARGET = $(DIR_INFO)/$(THISAPP)-tools1 | |
49 | EXTRA_CONFIG = \ | |
50 | --target=$(CROSSTARGET) \ | |
51 | --prefix=/tools \ | |
52 | --disable-nls \ | |
53 | --disable-werror | |
54 | EXTRA_MAKE = | |
55 | EXTRA_INSTALL = | |
56 | else | |
57 | TARGET = $(DIR_INFO)/$(THISAPP)-tools2 | |
58 | EXTRA_ENV = \ | |
59 | CC="$(CROSSTARGET)-gcc -B/tools/lib/" \ | |
60 | AR="$(CROSSTARGET)-ar" \ | |
61 | RANLIB="$(CROSSTARGET)-ranlib" | |
62 | EXTRA_CONFIG = \ | |
63 | --host=$(BUILDTARGET) \ | |
64 | --build=$(BUILDTARGET) \ | |
65 | --prefix=/tools \ | |
66 | --with-lib-path=/tools/lib \ | |
67 | --disable-nls | |
68 | EXTRA_MAKE = | |
69 | EXTRA_INSTALL = | |
70 | endif | |
71 | endif | |
72 | ||
73 | ifeq "$(MACHINE_TYPE)" "arm" | |
74 | EXTRA_CONFIG += \ | |
75 | --with-abi=aapcs-linux \ | |
76 | --with-float=soft | |
77 | endif | |
78 | ||
79 | EXTRA_CONFIG += \ | |
80 | --enable-64-bit-bfd | |
81 | ||
82 | ############################################################################### | |
83 | # Top-level Rules | |
84 | ############################################################################### | |
85 | ||
86 | objects = $(DL_FILE) | |
87 | ||
88 | $(DL_FILE) = $(DL_FROM)/$(DL_FILE) | |
89 | ||
90 | $(DL_FILE)_MD5 = ee0f10756c84979622b992a4a61ea3f5 | |
91 | ||
92 | install : $(TARGET) | |
93 | ||
94 | check : $(patsubst %,$(DIR_CHK)/%,$(objects)) | |
95 | ||
96 | download :$(patsubst %,$(DIR_DL)/%,$(objects)) | |
97 | ||
98 | md5 : $(subst %,%_MD5,$(objects)) | |
99 | ||
100 | ############################################################################### | |
101 | # Downloading, checking, md5sum | |
102 | ############################################################################### | |
103 | ||
104 | $(patsubst %,$(DIR_CHK)/%,$(objects)) : | |
105 | @$(CHECK) | |
106 | ||
107 | $(patsubst %,$(DIR_DL)/%,$(objects)) : | |
108 | @$(LOAD) | |
109 | ||
110 | $(subst %,%_MD5,$(objects)) : | |
111 | @$(MD5) | |
112 | ||
113 | ############################################################################### | |
114 | # Installation Details | |
115 | ############################################################################### | |
116 | ||
117 | $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) | |
118 | @$(PREBUILD) | |
119 | @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) | |
120 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/binutils-2.22-pt-pax-flags-20111121.patch | |
121 | ||
122 | # texinfo 5 syntax-fix. | |
123 | cd $(DIR_APP) && sed -i -e "s/@colophon/@@colophon/" \ | |
124 | -e "s/doc@cygnus/doc@@cygnus/" bfd/doc/bfd.texinfo | |
125 | ||
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) MACHINE= $(DIR_APP)/configure $(EXTRA_CONFIG) | |
132 | cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING) MACHINE= | |
133 | cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install MACHINE= | |
134 | ifeq "$(ROOT)" "" | |
135 | cp -v $(DIR_APP)/include/libiberty.h /usr/include | |
136 | else | |
137 | ifeq "$(PASS)" "2" | |
138 | cd $(DIR_SRC)/binutils-build && make -C ld clean MACHINE= | |
139 | cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib MACHINE= | |
140 | cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new /tools/bin | |
141 | endif | |
142 | endif | |
143 | @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build | |
144 | @$(POSTBUILD) |