#!/usr/local/bin/bash # # File: build.script.2.1.1 # Author: Mike Gruber # Date: November 17, 2002 # # This file automates the build process for the Rev. 2.1 m68hc1x port of # the GNU C compiler. The script is invoked from the directory which # contains all of the files needed to build the port. # # The INSTALLDIR must be set to a directory in which the user has write # permission. The tools will be found in INSTALLDIR/bin after this script # has run. # # !!!!!! NOTE !!!!!! # # I have switched from a Linux environment to FreeBSD. In order to # successfully build this toolchain on BSD, you need to use gmake instead # of make. I also prefer the bash shell, so this script has the strange # path to bash that you find on a BSD system. Linux users will probably # want to execute this script with /bin/sh, and modify the MAKE variable # below back to just call 'make'. # # Some nice defines export ROOTDIR=`pwd` export BINUTILS=binutils-2.12.1 export GCC=gcc-3.0.4 export GDB=gdb-5.2.1 export NEWLIB=newlib-1.10.0 export TARGET=m6811-elf export PROGRAM_PREFIX=m6811-elf- export INSTALLDIR=$ROOTDIR/tools # For FreeBSD, change to 'make' for Linux export MAKE=gmake # Make sure all of the required files exist if [ ! -e $BINUTILS.tar.gz ] ; then echo "No $BINUTILS.tar.gz file found." exit 1 fi if [ ! -e $BINUTILS-m68hc1x-20030103.diffs.gz ] ; then echo " No $BINUTILS-m68hc1x-20030103.diffs.gz file found." exit 1 fi if [ ! -e $GCC.tar.gz ] ; then echo "No $GCC.tar.gz file found." exit 1 fi if [ ! -e $GCC-m68hc1x-20021111.diffs.gz ] ; then echo " No $GCC-m68hc1x-20021111.diffs.gz file found." exit 1 fi if [ ! -e $GDB.tar.gz ] ; then echo "No $GDB.tar.gz file found." exit 1 fi if [ ! -e $GDB-m68hc1x-20030103.diffs.gz ] ; then echo " No $GDB-m68hc1x-20030103.diffs.gz file found." exit 1 fi if [ ! -e $NEWLIB.tar.gz ] ; then echo "No $NEWLIB.tar.gz file found." exit 1 fi if [ ! -e $NEWLIB-m68hc1x-20021111.diffs.gz ] ; then echo " No $NEWLIB-m68hc1x-20021111.diffs.gz file found." exit 1 fi # Build binutils gzip -d $BINUTILS-m68hc1x-20030103.diffs.gz tar -xzf $BINUTILS.tar.gz mv $BINUTILS $BINUTILS-m68hc1x cd $BINUTILS-m68hc1x patch -p1 < ../$BINUTILS-m68hc1x-20030103.diffs gzip ../$BINUTILS-m68hc1x-20030103.diffs sh ./configure --target=$TARGET \ --prefix=$INSTALLDIR \ --program-prefix=$PROGRAM_PREFIX $MAKE $MAKE install cd $ROOTDIR rm -rf $BINUTILS-m68hc1x # Further steps require the binutils we just built export PATH=$INSTALLDIR/bin:$PATH # Build gcc gzip -d $GCC-m68hc1x-20021111.diffs.gz tar -xzf $GCC.tar.gz mv $GCC $GCC-m68hc1x cd $GCC-m68hc1x patch -p1 < ../$GCC-m68hc1x-20021111.diffs gzip ../$GCC-m68hc1x-20021111.diffs sh ./configure --target=$TARGET \ --prefix=$INSTALLDIR \ --program-prefix=$PROGRAM_PREFIX \ --enable-languages=c $MAKE $MAKE install cd $ROOTDIR rm -rf $GCC-m68hc1x # Build gdb gzip -d $GDB-m68hc1x-20030103.diffs.gz tar -xzf $GDB.tar.gz mv $GDB $GDB-m68hc1x cd $GDB-m68hc1x patch -p1 < ../$GDB-m68hc1x-20030103.diffs gzip ../$GDB-m68hc1x-20030103.diffs sh ./configure --target=$TARGET \ --prefix=$INSTALLDIR \ --program-prefix=$PROGRAM_PREFIX $MAKE $MAKE install cd $ROOTDIR rm -rf $GDB-m68hc1x # Build newlib gzip -d $NEWLIB-m68hc1x-20021111.diffs.gz tar -xzf $NEWLIB.tar.gz mv $NEWLIB $NEWLIB-m68hc1x cd $NEWLIB-m68hc1x patch -p1 < ../$NEWLIB-m68hc1x-20021111.diffs gzip ../$NEWLIB-m68hc1x-20021111.diffs cd .. mkdir build-newlib cd build-newlib sh ../$NEWLIB-m68hc1x/configure \ --target=$TARGET \ --prefix=$INSTALLDIR \ --program-prefix=$PROGRAM_PREFIX $MAKE CFLAGS="-g -Os -Wall -mrelax" $MAKE install cd $ROOTDIR rm -rf $NEWLIB-m68hc1x rm -rf build-newlib