[llvm-commits] CVS: llvm/utils/llvmdo llvmgrep

Reid Spencer reid at x10sys.com
Fri Aug 11 14:53:41 PDT 2006



Changes in directory llvm/utils:

llvmdo updated: 1.13 -> 1.14
llvmgrep updated: 1.9 -> 1.10
---
Log message:

Make llvmdo and llvmgrep invulnerable to where they are run from by getting
the llvm source root from the llvm-config command. The dependency now is 
that the correct llvm-config command is in the path. For most developers
this is the case.


---
Diffs of the changes:  (+11 -5)

 llvmdo   |   13 ++++++++++---
 llvmgrep |    3 +--
 2 files changed, 11 insertions(+), 5 deletions(-)


Index: llvm/utils/llvmdo
diff -u llvm/utils/llvmdo:1.13 llvm/utils/llvmdo:1.14
--- llvm/utils/llvmdo:1.13	Thu Apr 20 13:43:59 2006
+++ llvm/utils/llvmdo	Fri Aug 11 16:53:27 2006
@@ -27,8 +27,8 @@
 ##===----------------------------------------------------------------------===##
 
 if test $# -lt 1 ; then
-  echo "Usage: llvmdo [-dirs "DIRNAMES..."] PROGRAM ARGS...";
-  exit 1;
+  echo "Usage: llvmdo [-dirs "DIRNAMES..."] PROGRAM ARGS..."
+  exit 1
 fi
 
 if test "$1" = "-dirs" ; then
@@ -37,13 +37,20 @@
 elif test -z "$LLVMDO_DIRS" ; then
   LLVMDO_DIRS="include lib tools utils runtime autoconf docs test examples projects"
 fi
+if test "$1" = "" ; then
+  echo "Missing program name to run"
+  exit 1
+fi
+
 PROGRAM=`which $1`
 if test ! -x "$PROGRAM" ; then
   echo "Can't execute $1"
   exit 1
 fi
 shift;
-TOPDIR=`pwd | sed -e 's#\(.*/llvm[0-9]*\).*#\1#'`
+
+TOPDIR=`llvm-config --src-root`
+
 if test -d "$TOPDIR" ; then
   cd $TOPDIR
   case `uname -s` in


Index: llvm/utils/llvmgrep
diff -u llvm/utils/llvmgrep:1.9 llvm/utils/llvmgrep:1.10
--- llvm/utils/llvmgrep:1.9	Tue Mar 14 00:08:05 2006
+++ llvm/utils/llvmgrep	Fri Aug 11 16:53:27 2006
@@ -18,8 +18,7 @@
 # details.
 ##===----------------------------------------------------------------------===##
 
-TOPDIR=`pwd | sed -e 's#\(.*/llvm[0-9]*\).*#\1#'`
-echo $TOPDIR
+TOPDIR=`llvm-config --src-root`
 if test -d "$TOPDIR" ; then
   cd $TOPDIR
   case `uname -s` in






More information about the llvm-commits mailing list