177 lines
5.1 KiB
Makefile
177 lines
5.1 KiB
Makefile
|
# output dir:
|
||
|
TOOLCHAIN=/opt/arm-toolchain
|
||
|
|
||
|
# build arch:
|
||
|
BUILDARCH=i686-linux-gnu
|
||
|
|
||
|
# #####################################################################
|
||
|
# MAIN TARGETS (binutils, gcc, g++, newlib, gdb for arm7tdmi)
|
||
|
# #####################################################################
|
||
|
toolchain: binutils gcc newlib gdb
|
||
|
|
||
|
# #####################################################################
|
||
|
BASE=$(shell /bin/pwd)
|
||
|
DOWNLOADS=$(BASE)/download
|
||
|
SOURCE=$(BASE)/source
|
||
|
|
||
|
PATH:=$(PATH):$(TOOLCHAIN)/bin
|
||
|
WGET:=/usr/bin/wget --passive-ftp -nd
|
||
|
|
||
|
# #####################################################################
|
||
|
BINUTILS_VERSION=2.17
|
||
|
BINUTILS_PACKAGE=binutils-$(BINUTILS_VERSION).tar.bz2
|
||
|
BINUTILS_DOWNLOAD=http://www.gnuarm.com/$(BINUTILS_PACKAGE)
|
||
|
BINUTILS_SOURCE=$(SOURCE)/binutils-$(BINUTILS_VERSION)
|
||
|
BINUTILS_BUILD=$(BINUTILS_SOURCE)-build
|
||
|
|
||
|
# #####################################################################
|
||
|
GCC_VERSION=4.1.1
|
||
|
GCC_PACKAGE=gcc-$(GCC_VERSION).tar.bz2
|
||
|
GCC_DOWNLOAD=http://www.gnuarm.com/$(GCC_PACKAGE)
|
||
|
GCC_SOURCE=$(SOURCE)/gcc-$(GCC_VERSION)
|
||
|
GCC_BUILD=$(GCC_SOURCE)-build
|
||
|
|
||
|
# #####################################################################
|
||
|
NEWLIB_VERSION=1.14.0
|
||
|
NEWLIB_PACKAGE=newlib-$(NEWLIB_VERSION).tar.gz
|
||
|
NEWLIB_DOWNLOAD=http://www.gnuarm.com/$(NEWLIB_PACKAGE)
|
||
|
NEWLIB_SOURCE=$(SOURCE)/newlib-$(NEWLIB_VERSION)
|
||
|
NEWLIB_BUILD=$(NEWLIB_SOURCE)-build
|
||
|
|
||
|
# #####################################################################
|
||
|
GDB_VERSION=6.6
|
||
|
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
|
||
|
|
||
|
# #####################################################################
|
||
|
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 \
|
||
|
--build=$(BUILDARCH) --host=$(BUILDARCH) --target=arm-elf \
|
||
|
--prefix=$(TOOLCHAIN) \
|
||
|
--enable-interwork \
|
||
|
--enable-multilib \
|
||
|
--disable-nls \
|
||
|
);
|
||
|
touch $@
|
||
|
|
||
|
$(BINUTILS_BUILD)/.compiled: $(BINUTILS_BUILD)/.configured
|
||
|
make -C $(BINUTILS_BUILD) all
|
||
|
touch $@
|
||
|
|
||
|
$(BINUTILS_BUILD)/.installed: $(BINUTILS_BUILD)/.compiled
|
||
|
make -C $(BINUTILS_BUILD) install
|
||
|
touch $@
|
||
|
|
||
|
# #####################################################################
|
||
|
gcc: $(GCC_BUILD)/.installed
|
||
|
|
||
|
$(DOWNLOADS)/$(GCC_PACKAGE):
|
||
|
$(WGET) -P $(DOWNLOADS) $(GCC_DOWNLOAD)
|
||
|
|
||
|
$(GCC_SOURCE)/.unpacked: $(DOWNLOADS)/$(GCC_PACKAGE)
|
||
|
tar -C $(SOURCE) -xjf $^
|
||
|
touch $@
|
||
|
|
||
|
$(GCC_BUILD)/.configured: $(GCC_SOURCE)/.unpacked $(NEWLIB_SOURCE)/.unpacked
|
||
|
mkdir -p $(GCC_BUILD)
|
||
|
(cd $(GCC_BUILD); $(GCC_SOURCE)/configure \
|
||
|
--build=$(BUILDARCH) --host=$(BUILDARCH) --target=arm-elf \
|
||
|
--prefix=$(TOOLCHAIN) \
|
||
|
--enable-languages="c,c++" \
|
||
|
--enable-interwork \
|
||
|
--enable-multilib \
|
||
|
--with-cpu=arm7tdmi \
|
||
|
--with-newlib --with-headers=$(NEWLIB_SOURCE)/newlib/libc/include \
|
||
|
--disable-nls \
|
||
|
);
|
||
|
touch $@
|
||
|
|
||
|
$(GCC_BUILD)/.stage1.compiled: $(GCC_BUILD)/.configured $(BINUTILS_BUILD)/.installed
|
||
|
make -C $(GCC_BUILD) all-gcc
|
||
|
touch $@
|
||
|
|
||
|
$(GCC_BUILD)/.stage1.installed: $(GCC_BUILD)/.stage1.compiled
|
||
|
make -C $(GCC_BUILD) install-gcc
|
||
|
touch $@
|
||
|
|
||
|
$(GCC_BUILD)/.stage2.compiled: $(GCC_BUILD)/.stage1.installed $(NEWLIB_BUILD)/.installed
|
||
|
make -C $(GCC_BUILD) all
|
||
|
touch $@
|
||
|
|
||
|
$(GCC_BUILD)/.stage2.installed: $(GCC_BUILD)/.stage2.compiled
|
||
|
make -C $(GCC_BUILD) install
|
||
|
touch $@
|
||
|
|
||
|
$(GCC_BUILD)/.installed: $(GCC_BUILD)/.stage1.installed $(GCC_BUILD)/.stage2.installed
|
||
|
touch $@
|
||
|
|
||
|
# #####################################################################
|
||
|
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 \
|
||
|
--build=$(BUILDARCH) --host=$(BUILDARCH) --target=arm-elf \
|
||
|
--prefix=$(TOOLCHAIN) \
|
||
|
--enable-interwork \
|
||
|
--enable-multilib \
|
||
|
--disable-nls \
|
||
|
);
|
||
|
touch $@
|
||
|
|
||
|
$(NEWLIB_BUILD)/.compiled: $(NEWLIB_BUILD)/.configured
|
||
|
make -C $(NEWLIB_BUILD) all
|
||
|
touch $@
|
||
|
|
||
|
$(NEWLIB_BUILD)/.installed: $(NEWLIB_BUILD)/.compiled
|
||
|
make -C $(NEWLIB_BUILD) install
|
||
|
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 \
|
||
|
--build=$(BUILDARCH) --host=$(BUILDARCH) --target=arm-elf \
|
||
|
--prefix=$(TOOLCHAIN) \
|
||
|
--enable-interwork \
|
||
|
--enable-multilib \
|
||
|
--disable-nls \
|
||
|
);
|
||
|
touch $@
|
||
|
|
||
|
$(GDB_BUILD)/.compiled: $(GDB_BUILD)/.configured
|
||
|
make -C $(GDB_BUILD) all
|
||
|
touch $@
|
||
|
|
||
|
$(GDB_BUILD)/.installed: $(GDB_BUILD)/.compiled
|
||
|
make -C $(GDB_BUILD) install
|
||
|
touch $@
|