2 BINUTILS_TAR=binutils-$(BINUTILS_VER).tar.bz2
3 BINUTILS_URL="http://mirrors.kernel.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.bz2
11 GCC_URL="http://mirrors.kernel.org/gnu/gcc/gcc-$(GCC_VER)/$(GCC_TAR)"
13 JOBS?=$(shell grep -c ^processor /proc/cpuinfo)
18 @if grep -q ' $(subst .,\.,$(1))$$' SHA256SUMS; then \
19 grep ' $(subst .,\.,$(1))$$' SHA256SUMS | sha256sum -c || rm $(1); \
21 echo "WARNING: no checksum defined for $(1)"; \
28 wget -P "$(BASEDIR)/src" $(BINUTILS_URL)
32 wget -P "$(BASEDIR)/src" $(NEWLIB_URL)
36 wget -P "$(BASEDIR)/src" $(GCC_URL)
39 src/binutils-$(BINUTILS_VER): src/$(BINUTILS_TAR)
40 tar -C "$(BASEDIR)/src" -xf $<
42 src/newlib-$(NEWLIB_VER): src/$(NEWLIB_TAR)
43 tar -C "$(BASEDIR)/src" -xf $<
45 src/gcc-$(GCC_VER): src/$(GCC_TAR) src/newlib-$(NEWLIB_VER)
46 tar -C "$(BASEDIR)/src" -xf $<
47 ln -s $(BASEDIR)/src/newlib-$(NEWLIB_VER)/newlib $@
48 ln -s $(BASEDIR)/src/newlib-$(NEWLIB_VER)/libgloss $@
50 binutils: src/binutils-$(BINUTILS_VER)
51 mkdir -p "$(BASEDIR)/build/binutils"
52 cd "$(BASEDIR)/build/binutils"; \
53 $(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst; \
57 gcc: src/gcc-$(GCC_VER) binutils
58 mkdir -p "$(BASEDIR)/build/gcc"
59 cd "$(BASEDIR)/build/gcc"; \
60 $(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst -enable-languages=c --without-pkgversion --with-newlib; \
65 rm -rf "$(BASEDIR)/build" "$(BASEDIR)/inst"
68 rm -rf "$(BASEDIR)/src"