TARGET = arm-linux BUILD_DIR = BUILD_$(TARGET) BINUTILS = binutils-2.18 GCC = gcc-4.3.2 NEWLIB = newlib-1.16.0 GMP = gmp-4.2.4 MPFR = mpfr-2.3.2 CHUMBY_SDK = arm-linux-v4.1.2b GCC_VERSION = $(shell echo $(GCC) | sed -e 's/[^0-9.]//g') SDK_VERSION = $(shell echo $(CHUMBY_SDK) | sed -e 's/[^0-9.]//g') CHUMBY_ROOT = /usr/local/chumby SYS_ROOT = $(CHUMBY_ROOT)/usr/arm-linux TOOLCHAIN_DIR = toolchain all : chumby binutils gcc $(CHUMBY_SDK).tar.gz : wget http://files.chumby.com/toolchain/$@ $(CHUMBY_ROOT) : $(CHUMBY_SDK).tar.gz if ! [ -d $@ ]; then mkdir $@; fi; \ tar zvxf $< -C $@; \ cd $(SYS_ROOT); \ (cd include; \ ln -s ../sys-include/asm-arm asm; \ ln -s ../sys-include/linux .; \ ln -s ../sys-include/mtd .; \ ln -s ../sys-include/sound .); \ ln -s . usr; \ ln -s . arm-linux; chumby : $(CHUMBY_ROOT) $(BINUTILS).tar.bz2 : wget http://ftp.gnu.org/gnu/binutils/$@ $(BINUTILS) : $(BINUTILS).tar.bz2 tar jvxf $< $(GCC).tar.gz : wget ftp://ftp.ring.gr.jp/pub/GNU/gcc/$(GCC)/$@ $(GCC) : $(GCC).tar.gz tar zvxf $< binutils : $(BINUTILS) cd $<; \ if ! [ -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi; \ cd $(BUILD_DIR); \ if ! [ -f Makefile ]; then ../configure --prefix=$(CHUMBY_ROOT)/$(TOOLCHAIN_DIR) --target=$(TARGET) --with-sysroot=$(SYS_ROOT); fi; \ make; \ make install $(GMP).tar.bz2 : wget ftp://ftp.gmplib.org/pub/$@ $(GMP) : $(GMP).tar.bz2 tar jvxf $< gmp : $(GMP) cd $<; \ if ! [ -f Makefile ]; then ./configure; fi; \ make; \ rm -rf check.log; \ make check | tee check.log; $(MPFR).tar.bz2 : wget http://www.mpfr.org/mpfr-current/$@ $(MPFR) : $(MPFR).tar.bz2 tar jvxf $< mpfr : $(MPFR) cd $<; \ if ! [ -f Makefile ]; \ then ./configure --with-gmp-build=../$(GMP); \ sed -e s/\\/$(GMP)/\\/\\.\\.\\/$(GMP)/g < tests/Makefile > tests/Makefile.2; \ mv tests/Makefile.2 tests/Makefile; \ fi; \ make; \ rm -rf check.log; \ make check | tee check.log; gcc : $(GCC) gmp mpfr cd $<; \ if ! [ -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi; \ cd $(BUILD_DIR); \ if ! [ -f Makefile ]; \ then ../configure --prefix=$(CHUMBY_ROOT)/$(TOOLCHAIN_DIR) --target=$(TARGET) --enable-languages="c++" --with-sysroot=$(SYS_ROOT) --with-gmp-include=../../$(GMP) --with-gmp-lib=../../$(GMP)/.libs --with-mpfr-include=../../$(MPFR) --with-mpfr-lib=../../$(MPFR)/.libs; \ fi; \ make LANGUAGES="c c++"; \ make install; \ cd $(CHUMBY_ROOT)/$(TOOLCHAIN_DIR)/$(TARGET)/lib; \ ln -s $(CHUMBY_ROOT)/usr/lib/gcc/$(TARGET) .; \ if ! [ "$(SDK_VERSION)" = "$(GCC_VERSION)" ]; then (cd $(TARGET); ln -s $(CHUMBY_ROOT)/usr/lib/gcc/$(TARGET)/$(SDK_VERSION) $(GCC_VERSION)); fi;