diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-08-11 21:53:27 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-08-11 21:53:27 +0000 |
commit | 1e75b7b01502c0660c419ea6cadb92d86cac354d (patch) | |
tree | 9c4256668683612918f662e1cd208a6ed8c8ae78 /utils/llvmdo | |
parent | b43ce5a148b0816fac693d74f8a69de0b6ca8f0d (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29630 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/llvmdo')
-rwxr-xr-x | utils/llvmdo | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/utils/llvmdo b/utils/llvmdo index 9b1179b44e..02013ba8b0 100755 --- a/utils/llvmdo +++ b/utils/llvmdo @@ -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 @@ if test "$1" = "-dirs" ; then 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 |