[llvm-commits] [llvm-top] r38524 - in /llvm-top/trunk: build configure get library.sh
Reid Spencer
reid at x10sys.com
Tue Jul 10 20:39:16 PDT 2007
Author: reid
Date: Tue Jul 10 22:39:16 2007
New Revision: 38524
URL: http://llvm.org/viewvc/llvm-project?rev=38524&view=rev
Log:
Add the build script to build a module and its dependencies.
Use the msg function instead of echo.
Added:
llvm-top/trunk/build (with props)
Modified:
llvm-top/trunk/configure (contents, props changed)
llvm-top/trunk/get
llvm-top/trunk/library.sh
Added: llvm-top/trunk/build
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/build?rev=38524&view=auto
==============================================================================
--- llvm-top/trunk/build (added)
+++ llvm-top/trunk/build Tue Jul 10 22:39:16 2007
@@ -0,0 +1,86 @@
+#!/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 checked out, configured and built all in
+# one step. Use it like this:
+#
+# cd llvm-top
+# ./build {module_names} {configure_options} {build_options}
+#
+# where:
+# {module_names} is a list of modules you want to configure (e.g. llvm, hlvm)
+# {configure_options} start with -- and are passed to the configure tool
+# of *all* the modules you are building that need configuration.
+# {build_options} contain an = and are passed to the build tool of *all*
+# the modules you are building.
+#
+# Note that the script will checkout and configure any dependent modules as well
+# as the ones specified in {module_names} so it is only necessary to specify the
+# minimal set you're interested in.
+
+# Get the library code
+. ./library.sh
+
+# 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.
+for arg in "$@" ; do
+ case "$arg" in
+ --*)
+ CONFIGURE_ARGS="$CONFIGURE_ARGS $arg"
+ ;;
+ *=*)
+ BUILD_ARGS="$BUILD_ARGS $arg"
+ ;;
+ *)
+ MODULE_NAMES="$MODULE_NAMES $arg"
+ esac
+done
+
+# 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).
+MODULE_DEPENDENCIES=""
+get_dependencies $MODULE_NAMES
+
+build_module() {
+ module="$1"
+ build_opts="$2"
+ if test ! -d "$module" ; then
+ die 1 "Module $module did not get checked out!"
+ fi
+ LLVM_TOP=`pwd`
+ MODULE_INFO="$LLVM_TOP/$module/ModuleInfo.txt"
+ if test -f "$MODULE_INFO" ; then
+ build_command=`grep -i BuildCmd: $MODULE_INFO | sed -e 's/BuildCmd: //'`
+ fi
+ if test -z "$build_command" ; then
+ msg 0 "Module $module has no BuildCmd entry so it won't be built."
+ return 0
+ fi
+ cd $module
+ build_command=`echo $build_command $build_opts | sed \
+ -e "s#@LLVM_TOP@#$LLVM_TOP#g" \
+ -e "s#@BUILD_OPTS@#$build_opts#g"`
+ if test "$?" -ne 0 ; then
+ die $? "Failed to generate build command"
+ fi
+ msg 0 "Building Module $module with this command:"
+ msg 0 " $build_command"
+ $build_command || die $? "Can't build $module"
+ cd $LLVM_TOP
+}
+# 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
+ configure_module "$mod" "$CONFIGURE_ARGS"
+ build_module "$mod" "$BUILD_ARGS"
+done
+
+# Just indicate what modules we configured
+msg 0 Modules built:"$MODULE_DEPENDENCIES".
+
Propchange: llvm-top/trunk/build
------------------------------------------------------------------------------
svn:executable = *
Propchange: llvm-top/trunk/build
------------------------------------------------------------------------------
svn:execute = true
Modified: llvm-top/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/configure?rev=38524&r1=38523&r2=38524&view=diff
==============================================================================
--- llvm-top/trunk/configure (original)
+++ llvm-top/trunk/configure Tue Jul 10 22:39:16 2007
@@ -49,4 +49,4 @@
done
# Just indicate what modules we configured
-echo Modules configured:"$MODULE_DEPENDENCIES".
+msg 0 Modules configured:"$MODULE_DEPENDENCIES".
Propchange: llvm-top/trunk/configure
------------------------------------------------------------------------------
svn:execute = true
Modified: llvm-top/trunk/get
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/get?rev=38524&r1=38523&r2=38524&view=diff
==============================================================================
--- llvm-top/trunk/get (original)
+++ llvm-top/trunk/get Tue Jul 10 22:39:16 2007
@@ -15,4 +15,4 @@
get_dependencies "$@"
# Report what happened.
-echo Modules checked out:"$MODULE_DEPENDENCIES".
+msg 0 Modules checked out:"$MODULE_DEPENDENCIES".
Modified: llvm-top/trunk/library.sh
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/library.sh?rev=38524&r1=38523&r2=38524&view=diff
==============================================================================
--- llvm-top/trunk/library.sh (original)
+++ llvm-top/trunk/library.sh Tue Jul 10 22:39:16 2007
@@ -126,3 +126,4 @@
fi
cd $LLVM_TOP
}
+
More information about the llvm-commits
mailing list