GCC_TAR=gcc-$(GCC_VER).tar.xz
GCC_URL="http://mirrors.kernel.org/gnu/gcc/gcc-$(GCC_VER)/$(GCC_TAR)"
+MPFR_VER=3.1.6
+MPFR_TAR=mpfr-$(MPFR_VER).tar.xz
+MPFR_URL="http://ftpmirror.gnu.org/gnu/mpfr/$(MPFR_TAR)"
+
+GMP_VER=6.1.2
+GMP_TAR=gmp-$(GMP_VER).tar.xz
+GMP_URL="http://ftpmirror.gnu.org/gnu/gmp/$(GMP_TAR)"
+
+MPC_VER=1.0.3
+MPC_TAR=mpc-$(MPC_VER).tar.gz
+MPC_URL="http://ftpmirror.gnu.org/gnu/mpc/$(MPC_TAR)"
+
JOBS?=$(shell grep -c ^processor /proc/cpuinfo)
BASEDIR=$(shell pwd)
all: clean gcc
+src/$(MPFR_TAR):
+ wget -P "$(BASEDIR)/src" "$(MPFR_URL)"
+ $(call checksum,$@)
+
+src/$(GMP_TAR):
+ wget -P "$(BASEDIR)/src" "$(GMP_URL)"
+ $(call checksum,$@)
+
+src/$(MPC_TAR):
+ wget -P "$(BASEDIR)/src" "$(MPC_URL)"
+ $(call checksum,$@)
+
src/$(BINUTILS_TAR):
- wget -P "$(BASEDIR)/src" $(BINUTILS_URL)
+ wget -P "$(BASEDIR)/src" "$(BINUTILS_URL)"
$(call checksum,$@)
src/$(NEWLIB_TAR):
- wget -P "$(BASEDIR)/src" $(NEWLIB_URL)
+ wget -P "$(BASEDIR)/src" "$(NEWLIB_URL)"
$(call checksum,$@)
src/$(GCC_TAR):
- wget -P "$(BASEDIR)/src" $(GCC_URL)
+ wget -P "$(BASEDIR)/src" "$(GCC_URL)"
$(call checksum,$@)
+src/mpfr-$(MPFR_VER): src/$(MPFR_TAR)
+ tar -C "$(BASEDIR)/src" -xf "$<"
+
+src/gmp-$(GMP_VER): src/$(GMP_TAR)
+ tar -C "$(BASEDIR)/src" -xf "$<"
+
+src/mpc-$(MPC_VER): src/$(MPC_TAR)
+ tar -C "$(BASEDIR)/src" -xf "$<"
+
src/binutils-$(BINUTILS_VER): src/$(BINUTILS_TAR)
- tar -C "$(BASEDIR)/src" -xf $<
+ tar -C "$(BASEDIR)/src" -xf "$<"
src/newlib-$(NEWLIB_VER): src/$(NEWLIB_TAR)
- tar -C "$(BASEDIR)/src" -xf $<
+ tar -C "$(BASEDIR)/src" -xf "$<"
-src/gcc-$(GCC_VER): src/$(GCC_TAR) src/newlib-$(NEWLIB_VER)
- tar -C "$(BASEDIR)/src" -xf $<
- ln -s $(BASEDIR)/src/newlib-$(NEWLIB_VER)/newlib $@
- ln -s $(BASEDIR)/src/newlib-$(NEWLIB_VER)/libgloss $@
+src/gcc-$(GCC_VER): src/$(GCC_TAR) src/newlib-$(NEWLIB_VER) src/mpc-$(MPC_VER) src/gmp-$(GMP_VER) src/mpfr-$(MPFR_VER)
+ tar -C "$(BASEDIR)/src" -xf "$<"
+ ln -s "$(BASEDIR)/src/newlib-$(NEWLIB_VER)/newlib" "$@"
+ ln -s "$(BASEDIR)/src/newlib-$(NEWLIB_VER)/libgloss" "$@"
+ ln -s "$(BASEDIR)/src/gmp-$(GMP_VER)" "$@/gmp"
+ ln -s "$(BASEDIR)/src/mpfr-$(MPFR_VER)" "$@/mpfr"
+ ln -s "$(BASEDIR)/src/mpc-$(MPC_VER)" "$@/mpc"
binutils: src/binutils-$(BINUTILS_VER)
mkdir -p "$(BASEDIR)/build/binutils"
cd "$(BASEDIR)/build/binutils"; \
- $(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst; \
+ "$(BASEDIR)"/$</configure --target=sh-elf --prefix="$(BASEDIR)/inst"; \
$(MAKE) -j$(JOBS); \
$(MAKE) install
gcc: src/gcc-$(GCC_VER) binutils
mkdir -p "$(BASEDIR)/build/gcc"
cd "$(BASEDIR)/build/gcc"; \
- $(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst -enable-languages=c --without-pkgversion --with-newlib; \
+ "$(BASEDIR)"/$</configure --target=sh-elf --prefix="$(BASEDIR)/inst" -enable-languages=c --without-pkgversion --with-newlib; \
$(MAKE) -j$(JOBS); \
$(MAKE) install