summaryrefslogtreecommitdiffstats
path: root/carl9170fw/toolchain
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--carl9170fw/toolchain/Makefile66
-rw-r--r--carl9170fw/toolchain/SHA256SUMS3
2 files changed, 69 insertions, 0 deletions
diff --git a/carl9170fw/toolchain/Makefile b/carl9170fw/toolchain/Makefile
new file mode 100644
index 0000000..aaea8e8
--- /dev/null
+++ b/carl9170fw/toolchain/Makefile
@@ -0,0 +1,66 @@
+BINUTILS_VER=2.22
+BINUTILS_URL=http://mirrors.kernel.org/gnu/binutils/binutils-$(BINUTILS_VER).tar.bz2
+BINUTILS_TAR=binutils-$(BINUTILS_VER).tar.bz2
+
+NEWLIB_VER=1.20.0
+NEWLIB_URL=ftp://sources.redhat.com/pub/newlib/newlib-$(NEWLIB_VER).tar.gz
+NEWLIB_TAR=newlib-$(NEWLIB_VER).tar.gz
+
+GCC_VER=4.7.1
+GCC_URL=http://mirrors.kernel.org/gnu/gcc/gcc-$(GCC_VER)/gcc-$(GCC_VER).tar.bz2
+GCC_TAR=gcc-$(GCC_VER).tar.bz2
+
+BASEDIR=$(shell pwd)
+
+define checksum
+@if grep -q ' $(subst .,\.,$(1))$$' SHA256SUMS; then \
+ grep ' $(subst .,\.,$(1))$$' SHA256SUMS | sha256sum -c; \
+else \
+ echo "WARNING: no checksum defined for $(1)"; \
+fi
+endef
+
+all: gcc
+
+src/$(BINUTILS_TAR):
+ wget -P src $(BINUTILS_URL)
+ $(call checksum,$@)
+
+src/$(NEWLIB_TAR):
+ wget -P src $(NEWLIB_URL)
+ $(call checksum,$@)
+
+src/$(GCC_TAR):
+ wget -P src $(GCC_URL)
+ $(call checksum,$@)
+
+src/binutils-$(BINUTILS_VER): src/$(BINUTILS_TAR)
+ tar -C src -xjf $<
+
+src/newlib-$(NEWLIB_VER): src/$(NEWLIB_TAR)
+ tar -C src -xzf $<
+
+src/gcc-$(GCC_VER): src/$(GCC_TAR) src/newlib-$(NEWLIB_VER)
+ tar -C src -xjf $<
+ ln -s $(BASEDIR)/src/newlib-$(NEWLIB_VER)/newlib $@
+ ln -s $(BASEDIR)/src/newlib-$(NEWLIB_VER)/libgloss $@
+
+binutils: src/binutils-$(BINUTILS_VER)
+ install -d build/binutils
+ cd build/binutils; \
+ $(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst; \
+ $(MAKE) -j3; \
+ $(MAKE) install
+
+gcc: src/gcc-$(GCC_VER) binutils
+ install -d build/gcc
+ cd build/gcc; \
+ $(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst -enable-languages=c --without-pkgversion --with-newlib; \
+ $(MAKE) -j3; \
+ $(MAKE) install
+
+clean:
+ rm -rf build inst
+
+distclean: clean
+ rm -rf src
diff --git a/carl9170fw/toolchain/SHA256SUMS b/carl9170fw/toolchain/SHA256SUMS
new file mode 100644
index 0000000..00c3911
--- /dev/null
+++ b/carl9170fw/toolchain/SHA256SUMS
@@ -0,0 +1,3 @@
+6c7af8ed1c8cf9b4b9d6e6fe09a3e1d3d479fe63984ba8b9b26bf356b6313ca9 src/binutils-2.22.tar.bz2
+16093f6fa01732adf378d97fe338f113c933bdf56da22bf87c76beff13da406f src/gcc-4.7.1.tar.bz2
+c644b2847244278c57bec2ddda69d8fab5a7c767f3b9af69aa7aa3da823ff692 src/newlib-1.20.0.tar.gz