2007-06-15 14:12:33 +02:00
|
|
|
# output dir:
|
|
|
|
TOOLCHAIN=/opt/arm-toolchain
|
|
|
|
|
|
|
|
# build arch:
|
|
|
|
BUILDARCH=i686-linux-gnu
|
2010-05-01 17:07:30 +02:00
|
|
|
TARGETARCH=arm-elf
|
2007-06-15 14:12:33 +02:00
|
|
|
|
2010-04-17 14:11:12 +02:00
|
|
|
MAKEOPTS=-j4
|
|
|
|
|
2007-06-15 14:12:33 +02:00
|
|
|
# #####################################################################
|
|
|
|
# MAIN TARGETS (binutils, gcc, g++, newlib, gdb for arm7tdmi)
|
|
|
|
# #####################################################################
|
2010-04-17 14:11:12 +02:00
|
|
|
toolchain: binutils gcc newlib gdb openocd
|
2007-06-15 14:12:33 +02:00
|
|
|
|
|
|
|
# #####################################################################
|
|
|
|
BASE=$(shell /bin/pwd)
|
|
|
|
DOWNLOADS=$(BASE)/download
|
|
|
|
SOURCE=$(BASE)/source
|
|
|
|
|
|
|
|
PATH:=$(PATH):$(TOOLCHAIN)/bin
|
|
|
|
WGET:=/usr/bin/wget --passive-ftp -nd
|
|
|
|
|
|
|
|
# #####################################################################
|
2010-05-01 17:07:30 +02:00
|
|
|
BINUTILS_VERSION=2.20.1
|
2007-06-15 14:12:33 +02:00
|
|
|
BINUTILS_PACKAGE=binutils-$(BINUTILS_VERSION).tar.bz2
|
2010-04-17 14:11:12 +02:00
|
|
|
BINUTILS_DOWNLOAD=http://ftp.gnu.org/gnu/binutils/$(BINUTILS_PACKAGE)
|
2007-06-15 14:12:33 +02:00
|
|
|
BINUTILS_SOURCE=$(SOURCE)/binutils-$(BINUTILS_VERSION)
|
|
|
|
BINUTILS_BUILD=$(BINUTILS_SOURCE)-build
|
|
|
|
|
|
|
|
# #####################################################################
|
2010-05-01 17:07:30 +02:00
|
|
|
GCC_VERSION=4.4.3
|
2007-06-15 14:12:33 +02:00
|
|
|
GCC_PACKAGE=gcc-$(GCC_VERSION).tar.bz2
|
2010-04-17 14:11:12 +02:00
|
|
|
GCC_DOWNLOAD=http://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_PACKAGE)
|
2007-06-15 14:12:33 +02:00
|
|
|
GCC_SOURCE=$(SOURCE)/gcc-$(GCC_VERSION)
|
|
|
|
GCC_BUILD=$(GCC_SOURCE)-build
|
|
|
|
|
|
|
|
# #####################################################################
|
2010-05-01 17:07:30 +02:00
|
|
|
GMP_VERSION=4.3.2
|
2010-04-17 14:11:12 +02:00
|
|
|
GMP_PACKAGE=gmp-$(GMP_VERSION).tar.bz2
|
|
|
|
GMP_DOWNLOAD=http://ftp.gnu.org/gnu/gmp/$(GMP_PACKAGE)
|
|
|
|
GMP_SOURCE=$(GCC_SOURCE)/gmp-$(GMP_VERSION)
|
|
|
|
|
|
|
|
# #####################################################################
|
2010-05-01 17:07:30 +02:00
|
|
|
MPFR_VERSION=2.4.2
|
2010-04-17 14:11:12 +02:00
|
|
|
MPFR_PACKAGE=mpfr-$(MPFR_VERSION).tar.bz2
|
|
|
|
MPFR_DOWNLOAD=http://www.mpfr.org/mpfr-$(MPFR_VERSION)/$(MPFR_PACKAGE)
|
|
|
|
MPFR_SOURCE=$(GCC_SOURCE)/mpfr-$(MPFR_VERSION)
|
|
|
|
|
|
|
|
# #####################################################################
|
2010-05-01 17:07:30 +02:00
|
|
|
NEWLIB_VERSION=1.18.0
|
2007-06-15 14:12:33 +02:00
|
|
|
NEWLIB_PACKAGE=newlib-$(NEWLIB_VERSION).tar.gz
|
2010-04-17 14:11:12 +02:00
|
|
|
NEWLIB_DOWNLOAD=ftp://sources.redhat.com/pub/newlib/$(NEWLIB_PACKAGE)
|
2007-06-15 14:12:33 +02:00
|
|
|
NEWLIB_SOURCE=$(SOURCE)/newlib-$(NEWLIB_VERSION)
|
|
|
|
NEWLIB_BUILD=$(NEWLIB_SOURCE)-build
|
|
|
|
|
|
|
|
# #####################################################################
|
2010-05-01 17:07:30 +02:00
|
|
|
GDB_VERSION=7.1
|
2007-06-15 14:12:33 +02:00
|
|
|
GDB_PACKAGE=gdb-$(GDB_VERSION).tar.bz2
|
|
|
|
GDB_DOWNLOAD=http://ftp.gnu.org/gnu/gdb/$(GDB_PACKAGE)
|
|
|
|
GDB_SOURCE=$(SOURCE)/gdb-$(GDB_VERSION)
|
|
|
|
GDB_BUILD=$(GDB_SOURCE)-build
|
|
|
|
|
2010-04-17 14:11:12 +02:00
|
|
|
# #####################################################################
|
|
|
|
OOCD_VERSION=0.4.0
|
|
|
|
OOCD_PACKAGE=openocd-$(OOCD_VERSION).tar.bz2
|
|
|
|
OOCD_DOWNLOAD=http://downloads.sourceforge.net/project/openocd/openocd/$(OOCD_VERSION)/$(OOCD_PACKAGE)
|
|
|
|
OOCD_SOURCE=$(SOURCE)/openocd-$(OOCD_VERSION)
|
|
|
|
OOCD_BUILD=$(OOCD_SOURCE)-build
|
|
|
|
|
2007-06-15 14:12:33 +02:00
|
|
|
# #####################################################################
|
|
|
|
binutils: $(BINUTILS_BUILD)/.installed
|
|
|
|
|
|
|
|
$(DOWNLOADS)/$(BINUTILS_PACKAGE):
|
|
|
|
$(WGET) -P $(DOWNLOADS) $(BINUTILS_DOWNLOAD)
|
|
|
|
|
|
|
|
$(BINUTILS_SOURCE)/.unpacked: $(DOWNLOADS)/$(BINUTILS_PACKAGE)
|
|
|
|
tar -C $(SOURCE) -xjf $^
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(BINUTILS_BUILD)/.configured: $(BINUTILS_SOURCE)/.unpacked
|
|
|
|
mkdir -p $(BINUTILS_BUILD)
|
|
|
|
(cd $(BINUTILS_BUILD); $(BINUTILS_SOURCE)/configure \
|
2010-05-01 17:07:30 +02:00
|
|
|
--build=$(BUILDARCH) --host=$(BUILDARCH) --target=$(TARGETARCH) \
|
2007-06-15 14:12:33 +02:00
|
|
|
--prefix=$(TOOLCHAIN) \
|
|
|
|
--enable-interwork \
|
|
|
|
--enable-multilib \
|
2010-05-01 17:07:30 +02:00
|
|
|
--enable-target-optspace \
|
2007-06-15 14:12:33 +02:00
|
|
|
--disable-nls \
|
|
|
|
);
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(BINUTILS_BUILD)/.compiled: $(BINUTILS_BUILD)/.configured
|
2010-04-17 14:11:12 +02:00
|
|
|
$(MAKE) -C $(BINUTILS_BUILD) $(MAKEOPTS) all
|
2007-06-15 14:12:33 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(BINUTILS_BUILD)/.installed: $(BINUTILS_BUILD)/.compiled
|
2010-04-17 14:11:12 +02:00
|
|
|
$(MAKE) -C $(BINUTILS_BUILD) install
|
2007-06-15 14:12:33 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
# #####################################################################
|
|
|
|
gcc: $(GCC_BUILD)/.installed
|
|
|
|
|
|
|
|
$(DOWNLOADS)/$(GCC_PACKAGE):
|
|
|
|
$(WGET) -P $(DOWNLOADS) $(GCC_DOWNLOAD)
|
|
|
|
|
|
|
|
$(GCC_SOURCE)/.unpacked: $(DOWNLOADS)/$(GCC_PACKAGE)
|
|
|
|
tar -C $(SOURCE) -xjf $^
|
|
|
|
touch $@
|
|
|
|
|
2010-04-17 14:11:12 +02:00
|
|
|
$(GCC_BUILD)/.configured: $(GCC_SOURCE)/.unpacked $(GMP_SOURCE)/.unpacked $(MPFR_SOURCE)/.unpacked $(NEWLIB_SOURCE)/.unpacked
|
2007-06-15 14:12:33 +02:00
|
|
|
mkdir -p $(GCC_BUILD)
|
|
|
|
(cd $(GCC_BUILD); $(GCC_SOURCE)/configure \
|
2010-05-01 17:07:30 +02:00
|
|
|
--build=$(BUILDARCH) --host=$(BUILDARCH) --target=$(TARGETARCH) \
|
2007-06-15 14:12:33 +02:00
|
|
|
--prefix=$(TOOLCHAIN) \
|
|
|
|
--enable-languages="c,c++" \
|
|
|
|
--enable-interwork \
|
|
|
|
--enable-multilib \
|
2010-05-01 17:07:30 +02:00
|
|
|
--disable-libssp \
|
|
|
|
--enable-target-optspace \
|
|
|
|
--with-cpu=arm7tdmi --with-cpu=cortex-m3 --with-cpu=arm966e-s \
|
2007-06-15 14:12:33 +02:00
|
|
|
--with-newlib --with-headers=$(NEWLIB_SOURCE)/newlib/libc/include \
|
|
|
|
--disable-nls \
|
|
|
|
);
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(GCC_BUILD)/.stage1.compiled: $(GCC_BUILD)/.configured $(BINUTILS_BUILD)/.installed
|
2010-04-17 14:11:12 +02:00
|
|
|
$(MAKE) -C $(GCC_BUILD) $(MAKEOPTS) all-gcc
|
2007-06-15 14:12:33 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(GCC_BUILD)/.stage1.installed: $(GCC_BUILD)/.stage1.compiled
|
2010-04-17 14:11:12 +02:00
|
|
|
$(MAKE) -C $(GCC_BUILD) install-gcc
|
2007-06-15 14:12:33 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(GCC_BUILD)/.stage2.compiled: $(GCC_BUILD)/.stage1.installed $(NEWLIB_BUILD)/.installed
|
2010-04-17 14:11:12 +02:00
|
|
|
$(MAKE) -C $(GCC_BUILD) $(MAKEOPTS) all
|
2007-06-15 14:12:33 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(GCC_BUILD)/.stage2.installed: $(GCC_BUILD)/.stage2.compiled
|
2010-04-17 14:11:12 +02:00
|
|
|
$(MAKE) -C $(GCC_BUILD) install
|
2007-06-15 14:12:33 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(GCC_BUILD)/.installed: $(GCC_BUILD)/.stage1.installed $(GCC_BUILD)/.stage2.installed
|
|
|
|
touch $@
|
|
|
|
|
2010-04-17 14:11:12 +02:00
|
|
|
# #####################################################################
|
|
|
|
$(DOWNLOADS)/$(GMP_PACKAGE):
|
|
|
|
$(WGET) -P $(DOWNLOADS) $(GMP_DOWNLOAD)
|
|
|
|
|
|
|
|
$(GMP_SOURCE)/.unpacked: $(DOWNLOADS)/$(GMP_PACKAGE) $(GCC_SOURCE)/.unpacked
|
|
|
|
tar -C $(GCC_SOURCE) -xjf $(DOWNLOADS)/$(GMP_PACKAGE)
|
|
|
|
ln -s gmp-$(GMP_VERSION) $(GCC_SOURCE)/gmp
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
# #####################################################################
|
|
|
|
$(DOWNLOADS)/$(MPFR_PACKAGE):
|
|
|
|
$(WGET) -P $(DOWNLOADS) $(MPFR_DOWNLOAD)
|
|
|
|
|
|
|
|
$(MPFR_SOURCE)/.unpacked: $(DOWNLOADS)/$(MPFR_PACKAGE) $(GCC_SOURCE)/.unpacked
|
|
|
|
tar -C $(GCC_SOURCE) -xjf $(DOWNLOADS)/$(MPFR_PACKAGE)
|
|
|
|
ln -s mpfr-$(MPFR_VERSION) $(GCC_SOURCE)/mpfr
|
|
|
|
touch $@
|
|
|
|
|
2007-06-15 14:12:33 +02:00
|
|
|
# #####################################################################
|
|
|
|
newlib: $(NEWLIB_BUILD)/.installed
|
|
|
|
|
|
|
|
$(DOWNLOADS)/$(NEWLIB_PACKAGE):
|
|
|
|
$(WGET) -P $(DOWNLOADS) $(NEWLIB_DOWNLOAD)
|
|
|
|
|
|
|
|
$(NEWLIB_SOURCE)/.unpacked: $(DOWNLOADS)/$(NEWLIB_PACKAGE)
|
|
|
|
tar -C $(SOURCE) -xzf $^
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(NEWLIB_BUILD)/.configured: $(NEWLIB_SOURCE)/.unpacked $(GCC_BUILD)/.stage1.installed
|
|
|
|
mkdir -p $(NEWLIB_BUILD)
|
|
|
|
(cd $(NEWLIB_BUILD); $(NEWLIB_SOURCE)/configure \
|
2010-05-01 17:07:30 +02:00
|
|
|
--build=$(BUILDARCH) --host=$(BUILDARCH) --target=$(TARGETARCH) \
|
2007-06-15 14:12:33 +02:00
|
|
|
--prefix=$(TOOLCHAIN) \
|
|
|
|
--enable-interwork \
|
|
|
|
--enable-multilib \
|
2010-05-01 17:07:30 +02:00
|
|
|
--disable-newlib-io-float \
|
|
|
|
--disable-newlib-supplied-syscalls \
|
2007-06-15 14:12:33 +02:00
|
|
|
--disable-nls \
|
|
|
|
);
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(NEWLIB_BUILD)/.compiled: $(NEWLIB_BUILD)/.configured
|
2010-04-17 14:11:12 +02:00
|
|
|
$(MAKE) -C $(NEWLIB_BUILD) $(MAKEOPTS) all
|
2007-06-15 14:12:33 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(NEWLIB_BUILD)/.installed: $(NEWLIB_BUILD)/.compiled
|
2010-04-17 14:11:12 +02:00
|
|
|
$(MAKE) -C $(NEWLIB_BUILD) install
|
2007-06-15 14:12:33 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
# #####################################################################
|
|
|
|
gdb: $(GDB_BUILD)/.installed
|
|
|
|
|
|
|
|
$(DOWNLOADS)/$(GDB_PACKAGE):
|
|
|
|
$(WGET) -P $(DOWNLOADS) $(GDB_DOWNLOAD)
|
|
|
|
|
|
|
|
$(GDB_SOURCE)/.unpacked: $(DOWNLOADS)/$(GDB_PACKAGE)
|
|
|
|
tar -C $(SOURCE) -xjf $^
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(GDB_BUILD)/.configured: $(GDB_SOURCE)/.unpacked $(GCC_BUILD)/.installed
|
|
|
|
mkdir -p $(GDB_BUILD)
|
|
|
|
(cd $(GDB_BUILD); $(GDB_SOURCE)/configure \
|
2010-05-01 17:07:30 +02:00
|
|
|
--build=$(BUILDARCH) --host=$(BUILDARCH) --target=$(TARGETARCH) \
|
2007-06-15 14:12:33 +02:00
|
|
|
--prefix=$(TOOLCHAIN) \
|
|
|
|
--enable-interwork \
|
|
|
|
--enable-multilib \
|
|
|
|
--disable-nls \
|
|
|
|
);
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(GDB_BUILD)/.compiled: $(GDB_BUILD)/.configured
|
2010-04-17 14:11:12 +02:00
|
|
|
$(MAKE) -C $(GDB_BUILD) $(MAKEOPTS) all
|
2007-06-15 14:12:33 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(GDB_BUILD)/.installed: $(GDB_BUILD)/.compiled
|
2010-04-17 14:11:12 +02:00
|
|
|
$(MAKE) -C $(GDB_BUILD) install
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
# #####################################################################
|
|
|
|
openocd: $(OOCD_BUILD)/.installed
|
|
|
|
|
|
|
|
$(DOWNLOADS)/$(OOCD_PACKAGE):
|
|
|
|
$(WGET) -P $(DOWNLOADS) $(OOCD_DOWNLOAD)
|
|
|
|
|
|
|
|
$(OOCD_SOURCE)/.unpacked: $(DOWNLOADS)/$(OOCD_PACKAGE)
|
|
|
|
tar -C $(SOURCE) -xjf $^
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(OOCD_BUILD)/.configured: $(OOCD_SOURCE)/.unpacked
|
|
|
|
mkdir -p $(OOCD_BUILD)
|
|
|
|
(cd $(OOCD_BUILD); $(OOCD_SOURCE)/configure \
|
|
|
|
--prefix=$(TOOLCHAIN) \
|
|
|
|
--disable-static \
|
|
|
|
--disable-doxygen-html \
|
|
|
|
--enable-parport \
|
|
|
|
--enable-ft2232_libftdi \
|
|
|
|
);
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(OOCD_BUILD)/.compiled: $(OOCD_BUILD)/.configured
|
|
|
|
$(MAKE) -C $(OOCD_BUILD) $(MAKEOPTS) all
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(OOCD_BUILD)/.installed: $(OOCD_BUILD)/.compiled
|
|
|
|
$(MAKE) -C $(OOCD_BUILD) install
|
2007-06-15 14:12:33 +02:00
|
|
|
touch $@
|