Merge branch 'master' into msp430
[llvm/msp430.git] / build-for-llvm-top.sh
blob78e3ed87f092fdb4f2fce49cd9c3e45f72a0dfa9
1 #!/bin/sh
3 # This includes the Bourne shell library from llvm-top. Since this file is
4 # generally only used when building from llvm-top, it is safe to assume that
5 # llvm is checked out into llvm-top in which case .. just works.
6 . ../library.sh
8 # Process the options passed in to us by the build script into standard
9 # variables.
10 process_arguments "$@"
12 # First, see if the build directory is there. If not, create it.
13 build_dir="$LLVM_TOP/build.llvm"
14 if test ! -d "$build_dir" ; then
15 mkdir -p "$build_dir"
18 # See if we have previously been configured by sensing the presence
19 # of the config.status scripts
20 config_status="$build_dir/config.status"
21 if test ! -f "$config_status" -o "$config_status" -ot "$0" ; then
22 # We must configure so build a list of configure options
23 config_options="--prefix=$PREFIX --with-llvmgccdir=$PREFIX"
24 if test "$OPTIMIZED" -eq 1 ; then
25 config_options="$config_options --enable-optimized"
26 else
27 config_options="$config_options --disable-optimized"
29 if test "$DEBUG" -eq 1 ; then
30 config_options="$config_options --enable-debug"
31 else
32 config_options="$config_options --disable-debug"
34 if test "$ASSERTIONS" -eq 1 ; then
35 config_options="$config_options --enable-assertions"
36 else
37 config_options="$config_options --disable-assertions"
39 if test "$CHECKING" -eq 1 ; then
40 config_options="$config_options --enable-expensive-checks"
41 else
42 config_options="$config_options --disable-expensive-checks"
44 if test "$DOXYGEN" -eq 1 ; then
45 config_options="$config_options --enable-doxygen"
46 else
47 config_options="$config_options --disable-doxygen"
49 if test "$THREADS" -eq 1 ; then
50 config_options="$config_options --enable-threads"
51 else
52 config_options="$config_options --disable-threads"
54 config_options="$config_options $OPTIONS_DASH $OPTIONS_DASH_DASH"
55 src_dir=`pwd`
56 cd "$build_dir"
57 msg 0 Configuring $module with:
58 msg 0 " $src_dir/configure" $config_options
59 $src_dir/configure $config_options || \
60 die $? "Configuring $module module failed"
61 else
62 msg 0 Module $module already configured, ignoring configure options.
63 cd "$build_dir"
66 msg 0 Building $module with:
67 msg 0 " make" $OPTIONS_ASSIGN tools-only
68 make $OPTIONS_ASSIGN tools-only