Makefile 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. GMP_VER=5.0.5
  2. GMP_URL=http://ftp.gnu.org/gnu/gmp/gmp-$(GMP_VER).tar.bz2
  3. GMP_TAR=gmp-$(GMP_VER).tar.bz2
  4. MPFR_VER=3.1.1
  5. MPFR_URL=http://ftp.gnu.org/gnu/mpfr/mpfr-$(MPFR_VER).tar.bz2
  6. MPFR_TAR=mpfr-$(MPFR_VER).tar.bz2
  7. MPC_VER=1.0.1
  8. MPC_URL=http://ftp.gnu.org/gnu/mpc/mpc-$(MPC_VER).tar.gz
  9. MPC_TAR=mpc-$(MPC_VER).tar.gz
  10. BINUTILS_VER=2.23.1
  11. BINUTILS_URL=http://ftp.gnu.org/gnu/binutils/binutils-$(BINUTILS_VER).tar.bz2
  12. BINUTILS_TAR=binutils-$(BINUTILS_VER).tar.bz2
  13. GCC_VER=4.7.2
  14. GCC_URL=http://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VER)/gcc-$(GCC_VER).tar.bz2
  15. GCC_TAR=gcc-$(GCC_VER).tar.bz2
  16. BASEDIR=$(shell pwd)
  17. TOOLCHAIN_DIR=$(BASEDIR)/toolchain
  18. TARGET=xtensa-elf
  19. all: toolchain
  20. gmp-$(GMP_VER):
  21. wget -N -P $(TOOLCHAIN_DIR)/dl $(GMP_URL)
  22. tar -C $(TOOLCHAIN_DIR)/dl -xjf $(TOOLCHAIN_DIR)/dl/$(GMP_TAR)
  23. gmp: gmp-$(GMP_VER)
  24. mkdir -p $(TOOLCHAIN_DIR)/build/gmp
  25. cd $(TOOLCHAIN_DIR)/build/gmp; \
  26. $(TOOLCHAIN_DIR)/dl/$</configure --disable-shared --enable-static --prefix=$(TOOLCHAIN_DIR)/inst; \
  27. $(MAKE); $(MAKE) check;$(MAKE) install
  28. mpfr-$(MPFR_VER):
  29. wget -N -P $(TOOLCHAIN_DIR)/dl $(MPFR_URL)
  30. tar -C $(TOOLCHAIN_DIR)/dl -xjf $(TOOLCHAIN_DIR)/dl/$(MPFR_TAR)
  31. mpfr: mpfr-$(MPFR_VER)
  32. mkdir -p $(TOOLCHAIN_DIR)/build/mpfr
  33. cd $(TOOLCHAIN_DIR)/build/mpfr; \
  34. $(TOOLCHAIN_DIR)/dl/$</configure --disable-shared --enable-static --with-gmp=$(TOOLCHAIN_DIR)/inst \
  35. --prefix=$(TOOLCHAIN_DIR)/inst; \
  36. $(MAKE); $(MAKE) check;$(MAKE) install
  37. mpc-$(MPC_VER):
  38. wget -N -P $(TOOLCHAIN_DIR)/dl $(MPC_URL)
  39. tar -C $(TOOLCHAIN_DIR)/dl -zxvf $(TOOLCHAIN_DIR)/dl/$(MPC_TAR)
  40. mpc: mpc-$(MPC_VER)
  41. mkdir -p $(TOOLCHAIN_DIR)/build/mpfc
  42. cd $(TOOLCHAIN_DIR)/build/mpfc; \
  43. $(TOOLCHAIN_DIR)/dl/$</configure --disable-shared --enable-static --with-gmp=$(TOOLCHAIN_DIR)/inst \
  44. --with-mpfr=$(TOOLCHAIN_DIR)/inst --prefix=$(TOOLCHAIN_DIR)/inst; \
  45. $(MAKE); $(MAKE) check;$(MAKE) install
  46. binutils-$(BINUTILS_VER):
  47. wget -N -P $(TOOLCHAIN_DIR)/dl $(BINUTILS_URL)
  48. tar -C $(TOOLCHAIN_DIR)/dl -xjf $(TOOLCHAIN_DIR)/dl/$(BINUTILS_TAR)
  49. patch -d $(TOOLCHAIN_DIR)/dl/$@ -p1 < local/patches/binutils.patch
  50. binutils: binutils-$(BINUTILS_VER)
  51. mkdir -p $(TOOLCHAIN_DIR)/build/binutils
  52. cd $(TOOLCHAIN_DIR)/build/binutils; \
  53. $(TOOLCHAIN_DIR)/dl/$</configure --target=$(TARGET) --prefix=$(TOOLCHAIN_DIR)/inst; \
  54. $(MAKE) all; $(MAKE) install
  55. gcc-$(GCC_VER):
  56. wget -N -P $(TOOLCHAIN_DIR)/dl $(GCC_URL)
  57. tar -C $(TOOLCHAIN_DIR)/dl -xjf $(TOOLCHAIN_DIR)/dl/$(GCC_TAR)
  58. patch -d $(TOOLCHAIN_DIR)/dl/$@ -p1 < local/patches/gcc.patch
  59. gcc: gcc-$(GCC_VER)
  60. mkdir -p $(TOOLCHAIN_DIR)/build/gcc
  61. cd $(TOOLCHAIN_DIR)/build/gcc; \
  62. export PATH=$(TOOLCHAIN_DIR)/inst/bin:$(PATH); \
  63. $(TOOLCHAIN_DIR)/dl/$</configure --target=$(TARGET) --prefix=$(TOOLCHAIN_DIR)/inst \
  64. --enable-languages=c --disable-libssp --disable-shared --disable-libquadmath \
  65. --with-gmp=$(TOOLCHAIN_DIR)/inst \
  66. --with-mpfr=$(TOOLCHAIN_DIR)/inst \
  67. --with-mpc=$(TOOLCHAIN_DIR)/inst --with-newlib; \
  68. $(MAKE) all; $(MAKE) install
  69. toolchain: gmp mpfr mpc binutils gcc
  70. clean:
  71. rm -rf $(TOOLCHAIN_DIR)/build $(TOOLCHAIN_DIR)/inst