blob: 20560412c5186d74ad33d4152596189b4523aef0 [file] [log] [blame]
#!/bin/sh
# build script
#
# This file was developed by Reid Spencer and is distributed under the
# University of Illinois Open Source License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
#
# This script allows LLVM modules to be built. Specify the modules you want to
# build on the command line; or leave it blank to specify the currently checked
# out modules. Any dependencies will be checked out and built before the
# specified list. You can also specify build options. See the README.txt file.
# Get the library.
if test ! -z "$LLVM_TOP" ; then
if test -f "$LLVM_TOP/library.sh" ; then
. "$LLVM_TOP/library.sh"
else
echo "Your LLVM_TOP variable is not set to an llvm-top directory"
exit 1
fi
elif test -f ./library.sh ; then
. ./library.sh
elif test -f ../library.sh ; then
. ../library.sh
else
echo Please run $0 from the llvm-top directory or a module directory.
exit 1
fi
# Process the arguments so that anything starting with - is passed down to the
# configure scripts while anything else is a module name. Collect the arguments
# in appropriate variables for later use.
process_arguments "$@"
# Get (and possibly check out) the set of modules and their dependencies. This
# sets the MODULE_DEPENDENCIES variable to the set of module names that should
# be configured, in the correct order (least dependent first, no duplicates).
get_module_dependencies $MODULES
# Build a list of the static build options we'll pass to the modules
build_args="LLVM_TOP=$LLVM_TOP PREFIX=$PREFIX DESTDIR=$DESTDIR VERBOSE=$VERBOSE"
build_args="$build_args $OPTIONS_DASH $OPTIONS_DASH_DASH $OPTIONS_ASSIGN"
# Now that we have a list of dependent modules, we must configure each of them
# according to the specifications of the module.
for mod in $MODULE_DEPENDENCIES ; do
build_a_module "$mod"
done
# Just indicate what modules we configured
msg 1 Modules built:"$MODULE_DEPENDENCIES".