• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh -xe
2
3gollvmdir=$(dirname "$0")/llvm
4
5workdir=$gollvmdir/workdir
6llvmdir=$gollvmdir/../../..
7llvm_builddir=$workdir/llvm_build
8
9mkdir -p $llvm_builddir
10
11cmake_flags="../../../../.. $@"
12llvm_config="$llvm_builddir/bin/llvm-config"
13llvm_go="$llvm_builddir/bin/llvm-go"
14
15if 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
23else
24  (cd $llvm_builddir && cmake $cmake_flags)
25  make -C $llvm_builddir -j4
26fi
27
28$llvm_go print-config > $gollvmdir/llvm_config.go
29