[llvm-commits] [llvm-top] r40374 - in /llvm-top/trunk: library.sh options
Reid Spencer
rspencer at reidspencer.com
Sat Jul 21 03:40:42 PDT 2007
Author: reid
Date: Sat Jul 21 05:40:41 2007
New Revision: 40374
URL: http://llvm.org/viewvc/llvm-project?rev=40374&view=rev
Log:
Add sticky options to the library and the ability to set the options
with the "options" command. This just avoids much redundant typing on the
command line.
Added:
llvm-top/trunk/options (with props)
Modified:
llvm-top/trunk/library.sh
Modified: llvm-top/trunk/library.sh
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/library.sh?rev=40374&r1=40373&r2=40374&view=diff
==============================================================================
--- llvm-top/trunk/library.sh (original)
+++ llvm-top/trunk/library.sh Sat Jul 21 05:40:41 2007
@@ -10,22 +10,36 @@
# the scripts in the llvm-top module.
# The arguments to all scripts are
+
+# Get the options. If there is no options file, default the values.
+options="./.options"
+if test -r "$options" -a -f "$options" ; then
+ . "$options"
+else
+ LLVM_TOP=`pwd`
+ PREFIX="$LLVM_TOP/installed"
+ DESTDIR=
+ VERBOSE=0
+ TOOL_VERBOSE=0
+ SHAREDLIBS=0
+ ARCHIVELIBS=1
+ OPTIMIZED=0
+ DEBUG=1
+ ASSERT=1
+ EXPENSIVE=0
+ PROFILING=0
+ USEOBJDIR=0
+ STRIP=0
+ OPTFORSIZE=0
+fi
+
# Define where subversion is. We assume by default its in the path.
SVN=`which svn`
-# Get the llvm-top directory before anyone has a chance to cd out of it
-LLVM_TOP=`pwd`
-PREFIX="$LLVM_TOP/installed"
-DESTDIR=
-
# A command to figure out the root of the SVN repository by asking for it from
# the 'svn info' command. To use, execute it in a script with something like
SVNROOT=`$SVN info . | grep 'Repository Root:' |sed -e 's/^Repository Root: //'`
-# Set this to non-zero (after sourcing this library) if you want verbose
-# output from the library. The higher the value, the more output you get
-VERBOSE=0
-
# Generate an informative message to the user based on the verbosity level
msg() {
local level=$1
Added: llvm-top/trunk/options
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/options?rev=40374&view=auto
==============================================================================
--- llvm-top/trunk/options (added)
+++ llvm-top/trunk/options Sat Jul 21 05:40:41 2007
@@ -0,0 +1,66 @@
+#!/bin/sh
+# options 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 lets you set sticky options that can be set once with this command
+# and then ignored for remaining commands used from the same directory.
+
+# Include the library. This will either read the options from the .options
+# file or it will set the variables to their default values.
+. ./library.sh
+
+# Process the arguments to set the new values
+msg 3 "Processing new option arguments"
+for arg in "$@" ; do
+ case "$arg" in
+ LLVM_TOP=*) LLVM_TOP=`echo "$arg" | sed -e 's/LLVM_TOP=//'` ;;
+ PREFIX=*) PREFIX=`echo "$arg" | sed -e 's/PREFIX=//'` ;;
+ DESTDIR=*) DESTDIR=`echo "$arg" | sed -e 's/DESTDIR=//'` ;;
+ VERBOSE=*) VERBOSE=`echo "$arg" | sed -e 's/VERBOSE=//'` ;;
+ TOOL_VERBOSE=*) TOOL_VERBOSE=`echo "$arg" | sed -e 's/TOOL_VERBOSE=//'` ;;
+ SHARED_LIBS=*) SHARED_LIBS=`echo "$arg" | sed -e 's/SHARED_LIBS=//'` ;;
+ ARCHIVE_LIBS=*) ARCHIVE_LIBS=`echo "$arg" | sed -e 's/ARCHIVE_LIBS=//'` ;;
+ OPTIMIZED=*) OPTIMIZED=`echo "$arg" | sed -e 's/OPTIMIZED=//'` ;;
+ DEBUG=*) DEBUG=`echo "$arg" | sed -e 's/DEBUG=//'` ;;
+ ASSERTS=*) ASSERTS=`echo "$arg" | sed -e 's/ASSERTS=//'` ;;
+ EXPENSIVE=*) EXPENSIVE=`echo "$arg" | sed -e 's/EXPENSIVE=//'` ;;
+ PROFILING=*) PROFILING=`echo "$arg" | sed -e 's/PROFILING=//'` ;;
+ USEOBJDIR=*) USEOBJDIR=`echo "$arg" | sed -e 's/USEOBJDIR=//'` ;;
+ STRIP=*) STRIP=`echo "$arg" | sed -e 's/STRIP=//'` ;;
+ OPTFORSIZE=*) OPTFORSIZE=`echo "$arg" | sed -e 's/OPTFORSIZE=//'` ;;
+ *) die 1 "Unrecognized option: $arg" ;;
+ esac
+done
+
+# Write the new options set to the .options file
+msg 3 "Write options to .options file"
+cat <<__EOF__ > "$options"
+# LLVM configuration options database.
+# This script is generated by "options" and included into library.sh
+LLVM_TOP="$LLVM_TOP"
+PREFIX="$PREFIX"
+DESTDIR="$DESTDIR"
+VERBOSE="$VERBOSE"
+TOOL_VERBOSE="$TOOL_VERBOSE"
+SHARED_LIBS="$SHARED_LIBS"
+ARCHIVE_LIBS="$ARCHIVE_LIBS"
+OPTIMIZED="$OPTIMIZED"
+DEBUG="$DEBUG"
+ASSERTS="$ASSERTS"
+EXPENSIVE="$EXPENSIVE"
+PROFILING="$PROFILING"
+USEOBJDIR="$USEOBJDIR"
+STRIP="$STRIP"
+OPTFORSIZE="$OPTFORSIZE"
+__EOF__
+
+# If there were no arguments, just print the options for the user
+msg 3 "Printing options"
+if test "$#" -eq 0 ; then
+ cat "$options" | grep "="
+fi
+
Propchange: llvm-top/trunk/options
------------------------------------------------------------------------------
svn:executable = *
More information about the llvm-commits
mailing list