#!/bin/bash

INSTALLDIR=$HOME/llvm
MAKEJOBS=1

mkdir -p obj-llvm
pushd obj-llvm

#TARGETS=host,x86,x86_64,powerpc,arm,msil,cbe,cpp
TARGETS=host,x86,x86_64,cpp
#  --enable-targets        Build specific host targets: all or
#                          target1,target2,... Valid targets are: host, x86,
#                          x86_64, sparc, powerpc, alpha, arm, mips, spu,
#                          pic16, xcore, msp430, systemz, blackfin, cbe, msil,
#                          and cpp (default=all)

## Stop on first error
make update &&
../llvm/configure --prefix=$INSTALLDIR \
                  --enable-bindings=none \
                  --enable-targets=$TARGETS \
                  --enable-optimized \
                  --with-llvmgccdir=$INSTALLDIR \
                  --with-llvm-externals=$HOME &&
make -j$MAKEJOBS ENABLE_OPTIMIZED=1 &&
make install -j$MAKEJOBS
ret=$?

popd
exit $ret

