mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
bdc3a5b99a
This tool lets us build LLVM components within the tree by setting up a $GOPATH that resembles a tree fetched in the normal way with "go get". It is intended that components such as the Go frontend will be built in-tree using this tool. Differential Revision: http://reviews.llvm.org/D5902 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220462 91177308-0d34-0410-b5e6-96231b3b80d8
32 lines
962 B
Bash
Executable File
32 lines
962 B
Bash
Executable File
#!/bin/sh -xe
|
|
|
|
gollvmdir=$(dirname "$0")/llvm
|
|
|
|
workdir=$gollvmdir/workdir
|
|
llvmdir=$gollvmdir/../../..
|
|
llvm_builddir=$workdir/llvm_build
|
|
|
|
mkdir -p $llvm_builddir
|
|
|
|
cmake_flags="../../../../.. $@"
|
|
llvm_config="$llvm_builddir/bin/llvm-config"
|
|
llvm_go="$llvm_builddir/bin/llvm-go"
|
|
|
|
if test -n "`which ninja`" ; then
|
|
# If Ninja is available, we can speed up the build by building only the
|
|
# required subset of LLVM.
|
|
(cd $llvm_builddir && cmake -G Ninja $cmake_flags)
|
|
ninja -C $llvm_builddir llvm-config llvm-go
|
|
llvm_components="$($llvm_go print-components)"
|
|
llvm_buildtargets="$($llvm_config --libs $llvm_components | sed -e 's/-l//g')"
|
|
ninja -C $llvm_builddir $llvm_buildtargets FileCheck
|
|
else
|
|
(cd $llvm_builddir && cmake $cmake_flags)
|
|
make -C $llvm_builddir -j4
|
|
fi
|
|
|
|
$llvm_go print-config > $gollvmdir/llvm_config.go
|
|
|
|
llvm_version="$($llvm_config --version)"
|
|
printf "package llvm\n\nconst Version = \"%s\"\n" "$llvm_version" > $gollvmdir/version.go
|