Home | History | Annotate | Download | only in go
      1 #!/bin/sh -xe
      2 
      3 gollvmdir=$(dirname "$0")/llvm
      4 
      5 workdir=$gollvmdir/workdir
      6 llvmdir=$gollvmdir/../../..
      7 llvm_builddir=$workdir/llvm_build
      8 
      9 mkdir -p $llvm_builddir
     10 
     11 cmake_flags="../../../../.. $@"
     12 llvm_config="$llvm_builddir/bin/llvm-config"
     13 llvm_go="$llvm_builddir/bin/llvm-go"
     14 
     15 if test -n "`which ninja`" ; then
     16   # If Ninja is available, we can speed up the build by building only the
     17   # required subset of LLVM.
     18   (cd $llvm_builddir && cmake -G Ninja $cmake_flags)
     19   ninja -C $llvm_builddir llvm-config llvm-go
     20   llvm_components="$($llvm_go print-components)"
     21   llvm_buildtargets="$($llvm_config --libs $llvm_components | sed -e 's/-l//g')"
     22   ninja -C $llvm_builddir $llvm_buildtargets FileCheck
     23 else
     24   (cd $llvm_builddir && cmake $cmake_flags)
     25   make -C $llvm_builddir -j4
     26 fi
     27 
     28 $llvm_go print-config > $gollvmdir/llvm_config.go
     29