2 BINUTILS_TAR=binutils-$(BINUTILS_VER).tar.xz
3 BINUTILS_URL="http://ftpmirror.gnu.org/gnu/binutils/$(BINUTILS_TAR)"
6 NEWLIB_TAR=newlib-$(NEWLIB_VER).tar.gz
7 NEWLIB_URL="ftp://sourceware.org/pub/newlib/$(NEWLIB_TAR)"
10 GCC_TAR=gcc-$(GCC_VER).tar.xz
11 GCC_URL="http://ftpmirror.gnu.org/gnu/gcc/gcc-$(GCC_VER)/$(GCC_TAR)"
14 MPFR_TAR=mpfr-$(MPFR_VER).tar.xz
15 MPFR_URL="http://ftpmirror.gnu.org/gnu/mpfr/$(MPFR_TAR)"
18 GMP_TAR=gmp-$(GMP_VER).tar.xz
19 GMP_URL="http://ftpmirror.gnu.org/gnu/gmp/$(GMP_TAR)"
22 MPC_TAR=mpc-$(MPC_VER).tar.gz
23 MPC_URL="http://ftpmirror.gnu.org/gnu/mpc/$(MPC_TAR)"
25 JOBS?=$(shell grep -c ^processor /proc/cpuinfo)
30 @if grep -q ' $(subst .,\.,$(1))$$' SHA256SUMS; then \
31 grep ' $(subst .,\.,$(1))$$' SHA256SUMS | sha256sum -c || rm $(1); \
33 echo "WARNING: no checksum defined for $(1)"; \
40 wget -P "$(BASEDIR)/src" "$(MPFR_URL)"
44 wget -P "$(BASEDIR)/src" "$(GMP_URL)"
48 wget -P "$(BASEDIR)/src" "$(MPC_URL)"
52 wget -P "$(BASEDIR)/src" "$(BINUTILS_URL)"
56 wget -P "$(BASEDIR)/src" "$(NEWLIB_URL)"
60 wget -P "$(BASEDIR)/src" "$(GCC_URL)"
63 src/mpfr-$(MPFR_VER): src/$(MPFR_TAR)
64 tar -C "$(BASEDIR)/src" -xf "$<"
66 src/gmp-$(GMP_VER): src/$(GMP_TAR)
67 tar -C "$(BASEDIR)/src" -xf "$<"
69 src/mpc-$(MPC_VER): src/$(MPC_TAR)
70 tar -C "$(BASEDIR)/src" -xf "$<"
72 src/binutils-$(BINUTILS_VER): src/$(BINUTILS_TAR)
73 tar -C "$(BASEDIR)/src" -xf "$<"
75 src/newlib-$(NEWLIB_VER): src/$(NEWLIB_TAR)
76 tar -C "$(BASEDIR)/src" -xf "$<"
78 src/gcc-$(GCC_VER): src/$(GCC_TAR) src/newlib-$(NEWLIB_VER) src/mpc-$(MPC_VER) src/gmp-$(GMP_VER) src/mpfr-$(MPFR_VER)
79 tar -C "$(BASEDIR)/src" -xf "$<"
80 ln -s "$(BASEDIR)/src/newlib-$(NEWLIB_VER)/newlib" "$@"
81 ln -s "$(BASEDIR)/src/newlib-$(NEWLIB_VER)/libgloss" "$@"
82 ln -s "$(BASEDIR)/src/gmp-$(GMP_VER)" "$@/gmp"
83 ln -s "$(BASEDIR)/src/mpfr-$(MPFR_VER)" "$@/mpfr"
84 ln -s "$(BASEDIR)/src/mpc-$(MPC_VER)" "$@/mpc"
86 binutils: src/binutils-$(BINUTILS_VER)
87 mkdir -p "$(BASEDIR)/build/binutils"
88 cd "$(BASEDIR)/build/binutils"; \
89 "$(BASEDIR)"/$</configure --target=sh-elf --prefix="$(BASEDIR)/inst"; \
93 gcc: src/gcc-$(GCC_VER) binutils
94 mkdir -p "$(BASEDIR)/build/gcc"
95 cd "$(BASEDIR)/build/gcc"; \
96 "$(BASEDIR)"/$</configure --target=sh-elf --prefix="$(BASEDIR)/inst" -enable-languages=c --without-pkgversion --with-newlib; \
101 rm -rf "$(BASEDIR)/build" "$(BASEDIR)/inst"
104 rm -rf "$(BASEDIR)/src"