Commit | Line | Data |
---|---|---|
851a4f23 JB |
1 | # |
2 | # Makefile | |
3 | # | |
4 | ||
5 | include vars.mk | |
6 | ||
7 | .PHONY: all clean distclean | |
8 | ||
ba3bcc7f | 9 | all: linux-headers libgmp libmpfr libmpc binutils gcc-static glibc gcc-final libtool setup test |
851a4f23 | 10 | |
ba3bcc7f | 11 | clean: linux-headers-clean libgmp-clean libmpfr-clean libmpc-clean binutils-clean gcc-static-clean glibc-clean gcc-final-clean libtool-clean test-clean |
851a4f23 | 12 | |
ba3bcc7f | 13 | distclean: clean linux-headers-distclean libgmp-distclean libmpfr-distclean libmpc-distclean binutils-distclean gcc-static-distclean glibc-distclean gcc-final-distclean libtool-distclean test-distclean |
851a4f23 JB |
14 | |
15 | ||
16 | # LINUX HEADERS | |
17 | $(WORK)/linux-$(KERNEL_HEADERS_VERSION).tar.bz2: | |
0d50b215 | 18 | wget -P $(WORK) -c ftp://ftp.kernel.org/pub/linux/kernel/v3.0/linux-$(KERNEL_HEADERS_VERSION).tar.bz2 |
851a4f23 JB |
19 | |
20 | $(WORK)/linux-$(KERNEL_HEADERS_VERSION): $(WORK)/linux-$(KERNEL_HEADERS_VERSION).tar.bz2 | |
21 | tar -C $(WORK) -xvjf $(WORK)/linux-$(KERNEL_HEADERS_VERSION).tar.bz2 | |
22 | touch $(WORK)/linux-$(KERNEL_HEADERS_VERSION) | |
23 | ||
24 | $(CLFS)/usr/include/asm: $(WORK)/linux-$(KERNEL_HEADERS_VERSION) | |
25 | mkdir -p $(CLFS)/usr/include | |
26 | cd $(WORK)/linux-$(KERNEL_HEADERS_VERSION) && \ | |
27 | make mrproper && \ | |
28 | make ARCH=arm headers_check && \ | |
29 | make ARCH=arm INSTALL_HDR_PATH=$(CLFS)/usr headers_install | |
30 | touch $(CLFS)/usr/include/asm | |
31 | ||
32 | linux-headers: $(CLFS)/usr/include/asm | |
33 | ||
34 | linux-headers-clean: | |
35 | rm -vrf $(WORK)/linux-$(KERNEL_HEADERS_VERSION) | |
36 | ||
37 | linux-headers-distclean: linux-headers-clean | |
38 | rm -vf $(WORK)/linux-$(KERNEL_HEADERS_VERSION).tar.bz2 | |
39 | ||
40 | ||
41 | # LIBGMP | |
42 | $(WORK)/gmp-$(LIBGMP_VERSION).tar.bz2: | |
43 | wget -P $(WORK) -c ftp://ftp.gnu.org/gnu/gmp/gmp-$(LIBGMP_VERSION).tar.bz2 | |
44 | ||
45 | $(WORK)/gmp-$(LIBGMP_VERSION): $(WORK)/gmp-$(LIBGMP_VERSION).tar.bz2 | |
46 | tar -C $(WORK) -xvjf $(WORK)/gmp-$(LIBGMP_VERSION).tar.bz2 | |
47 | touch $(WORK)/gmp-$(LIBGMP_VERSION) | |
48 | ||
49 | $(WORK)/build-libgmp: $(WORK)/gmp-$(LIBGMP_VERSION) | |
50 | mkdir -p $(WORK)/build-libgmp | |
51 | touch $(WORK)/build-libgmp | |
52 | ||
53 | $(CROSSTOOLS)/lib/libgmp.so: $(WORK)/build-libgmp | |
54 | cd $(WORK)/build-libgmp && \ | |
55 | unset CFLAGS && unset CXXFLAGS && \ | |
56 | CPPFLAGS=-fexceptions \ | |
57 | $(WORK)/gmp-$(LIBGMP_VERSION)/configure --prefix=$(CROSSTOOLS) --enable-cxx && \ | |
58 | make && make install || exit 1 | |
59 | touch $(CROSSTOOLS)/lib/libgmp.so | |
60 | ||
61 | libgmp: $(CROSSTOOLS)/lib/libgmp.so | |
62 | ||
63 | libgmp-clean: | |
64 | rm -vrf $(WORK)/build-libgmp $(WORK)/gmp-$(LIBGMP_VERSION) | |
65 | ||
66 | libgmp-distclean: libgmp-clean | |
67 | rm -vrf $(WORK)/gmp-$(LIBGMP_VERSION).tar.bz2 | |
68 | ||
69 | ||
70 | # LIBMPFR | |
71 | $(WORK)/mpfr-$(LIBMPFR_VERSION).tar.bz2: | |
72 | wget -P $(WORK) -c http://ftp.gnu.org/gnu/mpfr/mpfr-$(LIBMPFR_VERSION).tar.bz2 | |
73 | ||
71a47ce9 | 74 | $(WORK)/mpfr-$(LIBMPFR_VERSION): $(WORK)/mpfr-$(LIBMPFR_VERSION).tar.bz2 |
851a4f23 JB |
75 | tar -C $(WORK) -xvjf $(WORK)/mpfr-$(LIBMPFR_VERSION).tar.bz2 |
76 | touch $(WORK)/mpfr-$(LIBMPFR_VERSION) | |
77 | ||
78 | $(WORK)/build-libmpfr: $(WORK)/mpfr-$(LIBMPFR_VERSION) | |
79 | mkdir -p $(WORK)/build-libmpfr | |
80 | touch $(WORK)/build-libmpfr | |
81 | ||
82 | $(CROSSTOOLS)/lib/libmpfr.so: $(WORK)/build-libmpfr | |
83 | cd $(WORK)/build-libmpfr && \ | |
84 | unset CFLAGS && unset CXXFLAGS && \ | |
85 | LDFLAGS="-Wl,-rpath,$(CROSSTOOLS)/lib" && \ | |
86 | $(WORK)/mpfr-$(LIBMPFR_VERSION)/configure --prefix=$(CROSSTOOLS) --enable-shared --with-gmp=$(CROSSTOOLS) && \ | |
87 | make && make install || exit 1 | |
88 | touch $(CROSSTOOLS)/lib/libmpfr.so | |
89 | ||
90 | libmpfr: $(CROSSTOOLS)/lib/libmpfr.so | |
91 | ||
92 | libmpfr-clean: | |
93 | rm -vrf $(WORK)/build-libmpfr $(WORK)/mpfr-$(LIBMPFR_VERSION) | |
94 | ||
95 | libmpfr-distclean: libmpfr-clean | |
96 | rm -vrf $(WORK)/mpfr-$(LIBMPFR_VERSION).tar.bz2 | |
97 | ||
98 | ||
99 | # LIBMPC | |
100 | $(WORK)/mpc-$(LIBMPC_VERSION).tar.gz: | |
101 | wget -P $(WORK) -c http://www.multiprecision.org/mpc/download/mpc-$(LIBMPC_VERSION).tar.gz | |
102 | ||
103 | $(WORK)/mpc-$(LIBMPC_VERSION): $(WORK)/mpc-$(LIBMPC_VERSION).tar.gz | |
104 | tar -C $(WORK) -xvzf $(WORK)/mpc-$(LIBMPC_VERSION).tar.gz | |
105 | touch $(WORK)/mpc-$(LIBMPC_VERSION) | |
106 | ||
107 | $(WORK)/build-libmpc: $(WORK)/mpc-$(LIBMPC_VERSION) | |
108 | mkdir -p $(WORK)/build-libmpc | |
109 | touch $(WORK)/build-libmpc | |
110 | ||
111 | $(CROSSTOOLS)/lib/libmpc.so: $(WORK)/build-libmpc | |
112 | cd $(WORK)/build-libmpc && \ | |
113 | unset CFLAGS && unset CXXFLAGS && \ | |
114 | LDFLAGS="-Wl,-rpath,$(CROSSTOOLS)/lib" && \ | |
115 | $(WORK)/mpc-$(LIBMPC_VERSION)/configure --prefix=$(CROSSTOOLS) \ | |
116 | --enable-shared --with-gmp=$(CROSSTOOLS) --with-mpfr=$(CROSSTOOLS) && \ | |
117 | make && make install || exit 1 | |
118 | touch $(CROSSTOOLS)/lib/libmpc.so | |
119 | ||
120 | libmpc: $(CROSSTOOLS)/lib/libmpc.so | |
121 | ||
122 | libmpc-clean: | |
123 | rm -vrf $(WORK)/build-libmpc $(WORK)/mpc-$(LIBMPC_VERSION) | |
124 | ||
125 | libmpc-distclean: libmpc-clean | |
126 | rm -vrf $(WORK)/mpc-$(LIBMPC_VERSION).tar.bz2 | |
127 | ||
128 | ||
129 | # BINUTILS | |
130 | $(WORK)/binutils-$(BINUTILS_VERSION).tar.bz2: | |
131 | wget -P $(WORK) -c ftp://ftp.gnu.org/gnu/binutils/binutils-$(BINUTILS_VERSION).tar.bz2 | |
132 | ||
133 | $(WORK)/binutils-$(BINUTILS_VERSION): $(WORK)/binutils-$(BINUTILS_VERSION).tar.bz2 | |
71a47ce9 | 134 | tar -C $(WORK) -xvf $(WORK)/binutils-$(BINUTILS_VERSION).tar.bz2 |
0d50b215 | 135 | sed -i '/^SUBDIRS/s/doc//' $(WORK)/binutils-$(BINUTILS_VERSION)/*/Makefile.in |
851a4f23 JB |
136 | touch $(WORK)/binutils-$(BINUTILS_VERSION) |
137 | ||
138 | $(WORK)/build-binutils: $(WORK)/binutils-$(BINUTILS_VERSION) | |
139 | mkdir -p $(WORK)/build-binutils | |
ba3bcc7f | 140 | touch $(WORK)/build-binutils |
851a4f23 JB |
141 | |
142 | $(CLFS)/usr/include/libiberty.h: $(WORK)/build-binutils | |
143 | cd $(WORK)/build-binutils && \ | |
144 | unset CFLAGS && unset CXXFLAGS && \ | |
145 | AR=ar AS=as \ | |
146 | $(WORK)/binutils-$(BINUTILS_VERSION)/configure --prefix=$(CROSSTOOLS) \ | |
147 | --host=$(HOST) --target=$(TARGET) --with-sysroot=$(CLFS) \ | |
fd56a09b | 148 | --disable-nls --enable-shared --disable-multilib --enable-interwork && \ |
851a4f23 JB |
149 | make configure-host && make && make install || exit 1 |
150 | cp -va $(WORK)/binutils-$(BINUTILS_VERSION)/include/libiberty.h $(CLFS)/usr/include | |
151 | touch $(CLFS)/usr/include/libiberty.h | |
152 | ||
153 | binutils: linux-headers $(CLFS)/usr/include/libiberty.h | |
154 | ||
155 | binutils-clean: | |
156 | rm -vrf $(WORK)/build-binutils $(WORK)/binutils-$(BINUTILS_VERSION) | |
157 | ||
158 | binutils-distclean: binutils-clean | |
159 | rm -f $(WORK)/binutils-$(BINUTILS_VERSION).tar.bz2 | |
160 | ||
161 | ||
162 | # GCC-STATIC | |
163 | $(WORK)/gcc-$(GCC_VERSION).tar.bz2: | |
164 | wget -P $(WORK) -c ftp://sources.redhat.com/pub/gcc/releases/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.bz2 | |
165 | ||
71a47ce9 | 166 | $(WORK)/gcc-$(GCC_VERSION): $(WORK)/gcc-$(GCC_VERSION).tar.bz2 $(WORK)/gcc-$(GCC_VERSION)-gnueabihf.patch |
851a4f23 | 167 | tar -C $(WORK) -xvjf $(WORK)/gcc-$(GCC_VERSION).tar.bz2 |
fd56a09b VM |
168 | cd $(WORK)/gcc-$(GCC_VERSION) && \ |
169 | patch -p1 -i $(WORK)/gcc-$(GCC_VERSION)-gnueabihf.patch | |
851a4f23 JB |
170 | touch $(WORK)/gcc-$(GCC_VERSION) |
171 | ||
172 | $(WORK)/build-gcc-static: $(WORK)/gcc-$(GCC_VERSION) | |
173 | mkdir -p $(WORK)/build-gcc-static | |
174 | touch $(WORK)/build-gcc-static | |
175 | ||
176 | $(CROSSTOOLS)/lib/gcc: $(WORK)/build-gcc-static $(WORK)/gcc-$(GCC_VERSION) | |
177 | cd $(WORK)/build-gcc-static && \ | |
178 | unset CFLAGS && unset CXXFLAGS && \ | |
179 | AR=ar LDFLAGS="-Wl,-rpath,$(CROSSTOOLS)/lib" \ | |
180 | $(WORK)/gcc-$(GCC_VERSION)/configure --prefix=$(CROSSTOOLS) \ | |
181 | --build=$(HOST) --host=$(HOST) --target=$(TARGET) \ | |
182 | --disable-multilib --disable-nls \ | |
3fae615d | 183 | --without-headers --enable-__cxa_atexit --enable-symvers=gnu --disable-decimal-float \ |
851a4f23 JB |
184 | --disable-libgomp --disable-libmudflap --disable-libssp \ |
185 | --with-mpfr=$(CROSSTOOLS) --with-gmp=$(CROSSTOOLS) --with-mpc=$(CROSSTOOLS) \ | |
0d50b215 | 186 | --disable-shared --disable-threads --enable-languages=c --disable-libquadmath \ |
91b4e610 | 187 | --with-abi=$(ABI) --with-arch=$(ARCH) --with-mode=$(MODE) --with-float=$(FLOAT) --with-fpu=$(FPU) && \ |
fd56a09b | 188 | make all-gcc all-target-libgcc && make install-gcc install-target-libgcc || exit 1 |
851a4f23 JB |
189 | touch $(CROSSTOOLS)/lib/gcc |
190 | ||
191 | gcc-static: linux-headers libgmp libmpfr binutils $(CROSSTOOLS)/lib/gcc | |
192 | ||
193 | gcc-static-clean: | |
194 | rm -vrf $(WORK)/build-gcc-static $(WORK)/gcc-$(GCC_VERSION) | |
195 | ||
196 | gcc-static-distclean: gcc-static-clean | |
197 | rm -vf $(WORK)/gcc-$(GCC_VERSION).tar.bz2 | |
198 | ||
199 | ||
200 | # GLIBC | |
201 | $(WORK)/glibc-$(GLIBC_VERSION).tar.bz2: | |
202 | wget -P $(WORK) -c ftp://ftp.gnu.org/gnu/glibc/glibc-$(GLIBC_VERSION).tar.bz2 | |
203 | ||
204 | $(WORK)/glibc-ports-$(GLIBC_VERSION).tar.bz2: | |
205 | wget -P $(WORK) -c ftp://ftp.gnu.org/gnu/glibc/glibc-ports-$(GLIBC_VERSION).tar.bz2 | |
206 | ||
8232c538 | 207 | $(WORK)/glibc-$(GLIBC_VERSION): $(WORK)/glibc-$(GLIBC_VERSION).tar.bz2 $(WORK)/glibc-ports-$(GLIBC_VERSION).tar.bz2 |
851a4f23 JB |
208 | tar -C $(WORK) -xvjf $(WORK)/glibc-$(GLIBC_VERSION).tar.bz2 |
209 | cd $(WORK)/glibc-$(GLIBC_VERSION) && \ | |
210 | tar xvjf $(WORK)/glibc-ports-$(GLIBC_VERSION).tar.bz2 && \ | |
851a4f23 | 211 | mv glibc-ports-$(GLIBC_VERSION) ports && \ |
0d50b215 | 212 | sed -e 's/-lgcc_eh//g' -e 's/-lgcc_s//g' -i Makeconfig |
851a4f23 JB |
213 | touch $(WORK)/glibc-$(GLIBC_VERSION) |
214 | ||
215 | $(WORK)/build-glibc: $(WORK)/glibc-$(GLIBC_VERSION) | |
216 | mkdir -p $(WORK)/build-glibc | |
217 | touch $(WORK)/build-glibc | |
218 | ||
219 | $(CLFS)/usr/lib/libc.so: $(WORK)/build-glibc $(WORK)/glibc-$(GLIBC_VERSION) | |
220 | cd $(WORK)/build-glibc && \ | |
221 | export PATH=$(CROSSTOOLS)/bin:$$PATH && \ | |
222 | echo "libc_cv_forced_unwind=yes" > config.cache && \ | |
223 | echo "libc_cv_c_cleanup=yes" >> config.cache && \ | |
224 | echo "libc_cv_gnu89_inline=yes" >> config.cache && \ | |
0d50b215 | 225 | echo "libc_cv_ctors_header=yes" >> config.cache && \ |
851a4f23 JB |
226 | echo "install_root=$(CLFS)" > configparms && \ |
227 | unset CFLAGS && unset CXXFLAGS && \ | |
228 | BUILD_CC="gcc" CC="$(TARGET)-gcc" AR="$(TARGET)-ar" \ | |
229 | RANLIB="$(TARGET)-ranlib" \ | |
230 | $(WORK)/glibc-$(GLIBC_VERSION)/configure --prefix=/usr \ | |
231 | --libexecdir=/usr/lib/glibc --host=$(TARGET) --build=$(HOST) \ | |
232 | --disable-profile --enable-add-ons --with-tls --enable-kernel=2.6.0 \ | |
71a47ce9 | 233 | --with-__thread --with-binutils=$(CROSSTOOLS)/bin --with-fp=yes --enable-obsolete-rpc \ |
851a4f23 JB |
234 | --with-headers=$(CLFS)/usr/include --cache-file=config.cache && \ |
235 | make && make install || exit 1 | |
236 | touch $(CLFS)/usr/lib/libc.so | |
237 | ||
238 | glibc: binutils gcc-static $(CLFS)/usr/lib/libc.so | |
239 | ||
240 | glibc-clean: | |
241 | rm -vrf $(WORK)/build-glibc $(WORK)/glibc-$(GLIBC_VERSION) | |
242 | ||
243 | glibc-distclean: glibc-clean | |
244 | rm -vf $(WORK)/glibc-$(GLIBC_VERSION).tar.bz2 $(WORK)/glibc-ports-$(GLIBC_VERSION).tar.bz2 | |
245 | ||
246 | ||
247 | # GCC-FINAL | |
248 | $(WORK)/build-gcc-final: $(WORK)/gcc-$(GCC_VERSION) | |
249 | mkdir -p $(WORK)/build-gcc-final | |
250 | touch $(WORK)/build-gcc-final | |
251 | ||
252 | $(CLFS)/lib/gcc: $(WORK)/build-gcc-final $(WORK)/gcc-$(GCC_VERSION) | |
253 | cd $(WORK)/build-gcc-final && \ | |
254 | export PATH=$$PATH:$(CROSSTOOLS)/bin && \ | |
255 | unset CFLAGS && unset CXXFLAGS && unset CC && \ | |
256 | AR=ar LDFLAGS="-Wl,-rpath,$(CROSSTOOLS)/lib" \ | |
257 | $(WORK)/gcc-$(GCC_VERSION)/configure --prefix=$(CROSSTOOLS) \ | |
258 | --build=$(HOST) --host=$(HOST) --target=$(TARGET) \ | |
fd56a09b | 259 | --with-headers=$(CLFS)/usr/include --enable-shared \ |
851a4f23 | 260 | --disable-multilib --with-sysroot=$(CLFS) --disable-nls \ |
0d50b215 VM |
261 | --enable-languages=c,c++ --enable-__cxa_atexit \ |
262 | --enable-threads=posix --disable-libstdcxx-pch --disable-bootstrap --disable-libgomp \ | |
851a4f23 | 263 | --with-mpfr=$(CROSSTOOLS) --with-gmp=$(CROSSTOOLS) --with-mpc=$(CROSSTOOLS) \ |
91b4e610 | 264 | --with-abi=$(ABI) --with-arch=$(ARCH) --with-mode=$(MODE) --with-float=$(FLOAT) --with-fpu=$(FPU) && \ |
851a4f23 JB |
265 | make AS_FOR_TARGET="$(TARGET)-as" LD_FOR_TARGET="$(TARGET)-ld" && \ |
266 | make install || exit 1 | |
267 | touch $(CLFS)/lib/gcc | |
268 | ||
269 | gcc-final: libgmp libmpfr glibc $(CLFS)/lib/gcc | |
270 | ||
271 | gcc-final-clean: | |
272 | rm -vrf $(WORK)/build-gcc-final $(WORK)/gcc-$(GCC_VERSION) | |
273 | ||
274 | gcc-final-distclean: gcc-final-clean | |
275 | rm -vf $(WORK)/gcc-$(GCC_VERSION).tar.bz2 | |
276 | ||
277 | ||
ba3bcc7f JB |
278 | # LIBTOOL |
279 | ||
280 | $(WORK)/libtool-$(LIBTOOL_VERSION).tar.xz: | |
281 | wget -P $(WORK) -c http://ftp.gnu.org/gnu/libtool/libtool-$(LIBTOOL_VERSION).tar.xz | |
282 | ||
283 | $(WORK)/libtool-$(LIBTOOL_VERSION): $(WORK)/libtool-$(LIBTOOL_VERSION).tar.xz | |
284 | tar -C $(WORK) -xvJf $(WORK)/libtool-$(LIBTOOL_VERSION).tar.xz | |
285 | touch $(WORK)/libtool-$(LIBTOOL_VERSION) | |
286 | ||
287 | $(WORK)/build-libtool: $(WORK)/libtool-$(LIBTOOL_VERSION) | |
288 | mkdir -p $(WORK)/build-libtool | |
289 | touch $(WORK)/build-libtool | |
290 | ||
291 | $(CROSSTOOLS)/lib/libltdl.so: $(WORK)/build-libtool $(WORK)/libtool-$(LIBTOOL_VERSION) | |
292 | cd $(WORK)/build-libtool && \ | |
293 | unset CFLAGS && unset CXXFLAGS && \ | |
294 | LDFLAGS="-Wl,-rpath,$(CROSSTOOLS)/lib" && \ | |
295 | $(WORK)/libtool-$(LIBTOOL_VERSION)/configure --prefix=$(CROSSTOOLS) \ | |
296 | --program-prefix=$(TARGET)- && \ | |
297 | make && make install || exit 1 | |
298 | touch $(CROSSTOOLS)/lib/libltdl.so | |
299 | ||
300 | libtool: gcc-final $(CROSSTOOLS)/lib/libltdl.so | |
301 | ||
302 | libtool-clean: | |
303 | rm -vrf $(WORK)/build-libtool $(WORK)/libtool-$(LIBTOOL_VERSION) | |
304 | ||
305 | libtool-distclean: | |
306 | rm -vf $(WORK)/libtool-$(LIBTOOL_VERSION).tar.xz | |
307 | ||
851a4f23 JB |
308 | # SETUP FOR PKGUTILS |
309 | $(CLFS)/var/lib/pkg/db: | |
310 | install -d -m 0755 $(CLFS)/var/lib/pkg | |
311 | touch $(CLFS)/var/lib/pkg/db | |
312 | ||
313 | setup: $(CLFS)/var/lib/pkg/db | |
314 | ||
315 | # TEST THE TOOLCHAIN | |
316 | $(WORK)/test: $(WORK)/test.c | |
317 | export PATH=$$PATH:$(CROSSTOOLS)/bin && \ | |
318 | unset CFLAGS && unset CXXFLAGS && unset CC && \ | |
319 | AR=ar LDFLAGS="-Wl,-rpath,$(CROSSTOOLS)/lib" \ | |
320 | $(TARGET)-gcc -Wall -o $(WORK)/test $(WORK)/test.c | |
321 | [ "`file -b $(WORK)/test | cut -d',' -f2 | sed 's| ||g'`" = "ARM" ] || exit 1 | |
322 | touch $(WORK)/test | |
323 | ||
324 | test: gcc-final $(WORK)/test | |
325 | ||
326 | test-clean: | |
327 | rm -vrf $(WORK)/test | |
328 | ||
329 | test-distclean: test-clean | |
330 | ||
331 | # End of file |