#! /bin/bash PROJECT=ecc # Available sub-projects. AVAILABLE_PROJECTS=( ecc ) # Enabled sub-projects. PROJECTS=( ecc ) # Additional options (see functions sources below). # Options followed by a ':' require an argument, by '::' allow an optional argument. SHORT_OPTIONS= # Long options are not available with BSD getopt. LONG_OPTIONS= # Help for additional options usage() { # option h "help" "display this help and exit" return } # Find the directory containing this script. source="${BASH_SOURCE[0]}" while [ -h "${source}" ] ; do SCRIPTS="$(cd -P "$(dirname "${source}")" && pwd)" source="$(readlink "${source}")" [[ ${source} != /* ]] && source="$DIR/${source}" done SCRIPTS="$(cd -P "$(dirname "${source}")" && pwd)" # Get support functions and definitions. source ${SCRIPTS}/support if [ ! -d ${SRCTOP}/llvm ] ; then # Get and patch the LLVM sources. run ${SCRIPTS}/build-llvm -cp fi if [ ! -d ${SRCTOP}/binutils-gdb ] ; then # Get and patch the binutils-gdb sources. run ${SCRIPTS}/build-binutils-gdb -cp ${TARGETTUPLE} fi if [ "${TOOLS}" = "host" ] ; then # Using the host tools. Build just enough to bootstrap. run ${SCRIPTS}/build-binutils-gdb -Cbi run ${SCRIPTS}/build-llvm -Cbi # Recalculate. source ${SCRIPTS}/support ${TARGETTUPLE} fi if [ "${TOOLS}" = "clang" ] ; then # Using clang tools. Build just enough to bootstrap. run ${SCRIPTS}/build-binutils-gdb -Cbi run ${SCRIPTS}/build-llvm -Cbi # Recalculate. source ${SCRIPTS}/support ${TARGETTUPLE} # Built with clang, ready to create ecc. run cd ${LOCALBIN} run ln -sf clang-[0-9]* ecc run ln -sf clang-[0-9]* ecc++ run cd ${TOP} fi if [ "${HOSTTUPLE}" == "${TARGETTUPLE}" ] ; then # Install ecc tool info files. if [ ${TOOLINFO} != ${LOCALTOOLINFO} ] ; then run mkdir -p ${LOCALTOOLINFO} run cp ${TOOLINFO}/* ${LOCALTOOLINFO} fi fi # Check for cross compiling. if [ "${CROSS}" = "yes" ] ; then # Create ecc links. run cd ${LOCALBIN} run ln -sf clang-[0-9]* ecc run ln -sf clang-[0-9]* ecc++ exit 0 fi # Recalculate. source ${SCRIPTS}/support ${TARGETTUPLE} if [ "${TOOLS}" != "ecc" ] ; then # We should have ecc by now. bailout "ecc is unavailable. Something bad happened." fi run ${SCRIPTS}/make-libraries ${TARGETTUPLE} # Build ecc. run ${SCRIPTS}/build-llvm -Cbi ${TARGETTUPLE} # Create ecc links. run cd ${LOCALBIN} run ln -sf clang-[0-9]* ecc run ln -sf clang-[0-9]* ecc++ run cd ${TOP} # Configure, build, and install binutils with ecc. run ${SCRIPTS}/build-binutils-gdb -Cbi ${TARGETTUPLE} # RICH: Test basic compiled code functionality for each target.