]>
Commit | Line | Data |
---|---|---|
1 | ############################################################################### | |
2 | # # | |
3 | # IPFire.org - A linux based firewall # | |
4 | # Copyright (C) 2007-2013 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 | ############################################################################### | |
80 | # Top-level Rules | |
81 | ############################################################################### | |
82 | ||
83 | objects = $(DL_FILE) | |
84 | ||
85 | $(DL_FILE) = $(DL_FROM)/$(DL_FILE) | |
86 | ||
87 | $(DL_FILE)_MD5 = ee0f10756c84979622b992a4a61ea3f5 | |
88 | ||
89 | install : $(TARGET) | |
90 | ||
91 | check : $(patsubst %,$(DIR_CHK)/%,$(objects)) | |
92 | ||
93 | download :$(patsubst %,$(DIR_DL)/%,$(objects)) | |
94 | ||
95 | md5 : $(subst %,%_MD5,$(objects)) | |
96 | ||
97 | ############################################################################### | |
98 | # Downloading, checking, md5sum | |
99 | ############################################################################### | |
100 | ||
101 | $(patsubst %,$(DIR_CHK)/%,$(objects)) : | |
102 | @$(CHECK) | |
103 | ||
104 | $(patsubst %,$(DIR_DL)/%,$(objects)) : | |
105 | @$(LOAD) | |
106 | ||
107 | $(subst %,%_MD5,$(objects)) : | |
108 | @$(MD5) | |
109 | ||
110 | ############################################################################### | |
111 | # Installation Details | |
112 | ############################################################################### | |
113 | ||
114 | $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) | |
115 | @$(PREBUILD) | |
116 | @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) | |
117 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/binutils-2.22-pt-pax-flags-20111121.patch | |
118 | ||
119 | # texinfo 5 syntax-fix. | |
120 | cd $(DIR_APP) && sed -i -e "s/@colophon/@@colophon/" \ | |
121 | -e "s/doc@cygnus/doc@@cygnus/" bfd/doc/bfd.texinfo | |
122 | ||
123 | @mkdir $(DIR_SRC)/binutils-build | |
124 | ||
125 | # Prevent installing libiberty to lib64. | |
126 | cd $(DIR_APP) && sed -i 's%\(^MULTIOSDIR = \).*%\1 ../lib%' libiberty/Makefile.in | |
127 | ||
128 | cd $(DIR_SRC)/binutils-build && $(EXTRA_ENV) MACHINE= $(DIR_APP)/configure $(EXTRA_CONFIG) | |
129 | cd $(DIR_SRC)/binutils-build && make $(EXTRA_MAKE) $(MAKETUNING) MACHINE= | |
130 | cd $(DIR_SRC)/binutils-build && make $(EXTRA_INSTALL) install MACHINE= | |
131 | ifeq "$(ROOT)" "" | |
132 | cp -v $(DIR_APP)/include/libiberty.h /usr/include | |
133 | else | |
134 | ifeq "$(PASS)" "2" | |
135 | cd $(DIR_SRC)/binutils-build && make -C ld clean MACHINE= | |
136 | cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib MACHINE= | |
137 | cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new /tools/bin | |
138 | endif | |
139 | endif | |
140 | @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build | |
141 | @$(POSTBUILD) |