]>
Commit | Line | Data |
---|---|---|
cd1a2927 | 1 | ############################################################################### |
cd1a2927 | 2 | # # |
70df8302 MT |
3 | # IPFire.org - A linux based firewall # |
4 | # Copyright (C) 2007 Michael Tremer & Christian Schmidt # | |
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 | ||
dd714b8a | 27 | VER = 4.0.3 |
cd1a2927 MT |
28 | |
29 | THISAPP = gcc-$(VER) | |
dd714b8a MT |
30 | DL_FILE = $(THISAPP).tar.bz2 |
31 | DL_FROM = $(URL_IPFIRE) | |
cd1a2927 MT |
32 | DIR_APP = $(DIR_SRC)/$(THISAPP) |
33 | CFLAGS = | |
34 | CXXFLAGS = | |
a50d04ab | 35 | TARGET_PATH = /opt/$(MACHINE)-uClibc/bin:$(PATH) |
cd1a2927 MT |
36 | |
37 | # Normal build or /tools build. | |
38 | # | |
39 | ifeq "$(ROOT)" "" | |
bc9f0c12 MT |
40 | ifeq "$(INST)" "1" |
41 | TARGET = $(DIR_INFO)/$(THISAPP)-install1 | |
a50d04ab MT |
42 | EXTRA_CONFIG = --prefix=/opt/$(MACHINE)-uClibc \ |
43 | --build=$(MACHINE)-pc-linux-gnu \ | |
44 | --host=$(MACHINE)-pc-linux-gnu \ | |
45 | --target=$(MACHINE)-linux-uclibc \ | |
46 | --enable-languages=c \ | |
47 | --with-sysroot=$(DIR_SRC)/uClibc_dev \ | |
48 | --disable-__cxa_atexit \ | |
49 | --enable-target-optspace \ | |
50 | --with-gnu-ld \ | |
51 | --disable-shared \ | |
52 | --enable-threads \ | |
53 | --enable-multilib \ | |
54 | --disable-nls | |
55 | EXTRA_MAKE = | |
56 | EXTRA_INSTALL = | |
bc9f0c12 MT |
57 | else |
58 | ifeq "$(INST)" "2" | |
59 | TARGET = $(DIR_INFO)/$(THISAPP)-install2 | |
a50d04ab MT |
60 | EXTRA_CONFIG = --prefix=/opt/$(MACHINE)-uClibc \ |
61 | --build=$(MACHINE)-pc-linux-gnu \ | |
62 | --host=$(MACHINE)-pc-linux-gnu \ | |
63 | --target=$(MACHINE)-linux-uclibc \ | |
64 | --enable-languages=c,c++ \ | |
65 | --with-sysroot=$(DIR_SRC)/uClibc_dev \ | |
66 | --disable-__cxa_atexit \ | |
67 | --enable-target-optspace \ | |
68 | --with-gnu-ld \ | |
69 | --enable-shared \ | |
70 | --disable-nls \ | |
71 | --enable-threads \ | |
72 | --enable-multilib | |
73 | EXTRA_MAKE = | |
74 | EXTRA_INSTALL = | |
bc9f0c12 | 75 | else |
cd1a2927 MT |
76 | TARGET = $(DIR_INFO)/$(THISAPP) |
77 | EXTRA_CONFIG = --prefix=/usr \ | |
a50d04ab MT |
78 | --libexecdir=/usr/lib \ |
79 | --enable-shared \ | |
80 | --enable-threads=posix \ | |
81 | --enable-__cxa_atexit \ | |
82 | --enable-clocale=gnu \ | |
83 | --enable-languages=c,c++ \ | |
84 | --disable-nls | |
857d9bf2 MT |
85 | EXTRA_MAKE = |
86 | EXTRA_INSTALL = | |
bc9f0c12 MT |
87 | endif |
88 | endif | |
cd1a2927 | 89 | else |
15679d9f | 90 | ifeq "$(PASS)" "1" |
cd1a2927 | 91 | TARGET = $(DIR_INFO)/$(THISAPP)-tools1 |
dd714b8a | 92 | EXTRA_CONFIG = --prefix=/tools \ |
a50d04ab MT |
93 | --with-local-prefix=/tools \ |
94 | --disable-nls \ | |
95 | --enable-shared \ | |
96 | --enable-languages=c | |
857d9bf2 | 97 | EXTRA_MAKE = bootstrap BOOT_LDFLAGS="-static" |
cd1a2927 MT |
98 | EXTRA_INSTALL = |
99 | else | |
100 | TARGET = $(DIR_INFO)/$(THISAPP)-tools2 | |
dd714b8a | 101 | EXTRA_CONFIG = --prefix=/tools \ |
a50d04ab MT |
102 | --with-local-prefix=/tools \ |
103 | --enable-clocale=gnu \ | |
104 | --enable-shared \ | |
105 | --enable-threads=posix \ | |
106 | --enable-__cxa_atexit \ | |
107 | --enable-languages=c,c++ \ | |
108 | --disable-libstdcxx-pch | |
cd1a2927 MT |
109 | EXTRA_MAKE = |
110 | EXTRA_INSTALL = | |
111 | endif | |
112 | endif | |
113 | ||
114 | ############################################################################### | |
115 | # Top-level Rules | |
116 | ############################################################################### | |
dd714b8a | 117 | objects = $(DL_FILE) |
cd1a2927 | 118 | |
41921bd9 | 119 | $(DL_FILE) = $(DL_FROM)/$(DL_FILE) |
cd1a2927 | 120 | |
857d9bf2 | 121 | $(DL_FILE)_MD5 = 6ff1af12c53cbb3f79b27f2d6a9a3d50 |
cd1a2927 MT |
122 | |
123 | install : $(TARGET) | |
124 | ||
125 | check : $(patsubst %,$(DIR_CHK)/%,$(objects)) | |
126 | ||
127 | download :$(patsubst %,$(DIR_DL)/%,$(objects)) | |
128 | ||
129 | md5 : $(subst %,%_MD5,$(objects)) | |
130 | ||
131 | ############################################################################### | |
132 | # Downloading, checking, md5sum | |
133 | ############################################################################### | |
134 | ||
135 | $(patsubst %,$(DIR_CHK)/%,$(objects)) : | |
136 | @$(CHECK) | |
137 | ||
138 | $(patsubst %,$(DIR_DL)/%,$(objects)) : | |
139 | @$(LOAD) | |
140 | ||
141 | $(subst %,%_MD5,$(objects)) : | |
142 | @$(MD5) | |
143 | ||
144 | ############################################################################### | |
145 | # Installation Details | |
146 | ############################################################################### | |
147 | ||
148 | $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) | |
149 | @$(PREBUILD) | |
150 | @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) | |
a092753f | 151 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-pr28045.patch |
dd714b8a | 152 | @mkdir $(DIR_SRC)/gcc-build |
cd1a2927 | 153 | ifeq "$(ROOT)" "" |
bc9f0c12 MT |
154 | ifeq "$(INST)" "1" |
155 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-uclibc-conf.patch | |
156 | cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG) | |
a50d04ab MT |
157 | cd $(DIR_SRC)/gcc-build && PATH=$(TARGET_PATH) make $(MAKETUNING) all-gcc |
158 | cd $(DIR_SRC)/gcc-build && PATH=$(TARGET_PATH) make install-gcc | |
159 | cd /opt/$(MACHINE)-uClibc/bin && for i in `ls -w1 $(MACHINE)-linux-uclibc-*`; do \ | |
160 | ln -svf $$i $(MACHINE)-linux-`echo $$i | cut -c 19-`; \ | |
161 | done | |
162 | ln -svf $(MACHINE)-linux-uclibc /opt/$(MACHINE)-uClibc/$(MACHINE)-linux | |
163 | ln -svf gcc /opt/$(MACHINE)-uClibc/$(MACHINE)-linux-uclibc/bin/cc | |
bc9f0c12 MT |
164 | else |
165 | ifeq "$(INST)" "2" | |
166 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-uclibc-conf.patch | |
167 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-uclibc-locale.patch | |
168 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-libstdc++-pic.patch | |
169 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-sdk-libstdc++-includes.patch | |
a50d04ab | 170 | ln -snf ../include /opt/$(MACHINE)-uClibc/$(MACHINE)-linux-uclibc/sys-include |
bc9f0c12 | 171 | cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG) |
a50d04ab MT |
172 | cd $(DIR_SRC)/gcc-build && PATH=$(TARGET_PATH) make $(MAKETUNING) $(EXTRA_MAKE) |
173 | cd $(DIR_SRC)/gcc-build && PATH=$(TARGET_PATH) make install $(EXTRA_INSTALL) | |
bc9f0c12 MT |
174 | cp -f /opt/$(MACHINE)-uClibc/lib/libgcc_s.so /lib |
175 | cd /lib && ln -sf libgcc_s.so libgcc_s.so.1 | |
176 | else | |
f97be0a6 MT |
177 | cd $(DIR_APP) && sed -i 's/install_to_$$(INSTALL_DEST) //' libiberty/Makefile.in |
178 | cd $(DIR_APP) && sed -i 's/^XCFLAGS =$$/& -fomit-frame-pointer/' gcc/Makefile.in | |
9b0ff0a0 MT |
179 | cd $(DIR_APP) && sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in |
180 | cd $(DIR_APP) && sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in | |
dd714b8a | 181 | |
f97be0a6 MT |
182 | cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG) |
183 | cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE) | |
184 | cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install | |
9b0ff0a0 MT |
185 | ln -sfv ../usr/bin/cpp /lib |
186 | ln -sfv gcc /usr/bin/cc | |
bc9f0c12 MT |
187 | endif |
188 | endif | |
cd1a2927 | 189 | else |
15679d9f | 190 | ifeq "$(PASS)" "1" |
f97be0a6 | 191 | cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG) |
dd714b8a | 192 | cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE) |
cd1a2927 | 193 | cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install |
9b0ff0a0 | 194 | ln -sfv gcc /tools/bin/cc |
cd1a2927 | 195 | else |
dd714b8a MT |
196 | cd $(DIR_APP) && cp -v gcc/Makefile.in{,.orig} |
197 | cd $(DIR_APP) && sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in | |
198 | cd $(DIR_APP) && cp -v gcc/Makefile.in{,.tmp} | |
90d372c4 MT |
199 | cd $(DIR_APP) && sed 's/^XCFLAGS =$\/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \ |
200 | > gcc/Makefile.in | |
9b0ff0a0 | 201 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/$(THISAPP)-specs-1.patch |
f97be0a6 | 202 | cd $(DIR_SRC)/gcc-build && $(DIR_APP)/configure $(EXTRA_CONFIG) |
dd714b8a MT |
203 | cd $(DIR_SRC)/gcc-build && make $(MAKETUNING) $(EXTRA_MAKE) |
204 | cd $(DIR_SRC)/gcc-build && make $(EXTRA_INSTALL) install | |
cd1a2927 | 205 | endif |
cd1a2927 MT |
206 | endif |
207 | @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build | |
208 | @$(POSTBUILD) |