llvm.org GIT mirror llvm / 1e75b7b
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 Reid Spencer 13 years ago
2 changed file(s) with 11 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
2626 ##===----------------------------------------------------------------------===##
2727
2828 if test $# -lt 1 ; then
29 echo "Usage: llvmdo [-dirs "DIRNAMES..."] PROGRAM ARGS...";
30 exit 1;
29 echo "Usage: llvmdo [-dirs "DIRNAMES..."] PROGRAM ARGS..."
30 exit 1
3131 fi
3232
3333 if test "$1" = "-dirs" ; then
3636 elif test -z "$LLVMDO_DIRS" ; then
3737 LLVMDO_DIRS="include lib tools utils runtime autoconf docs test examples projects"
3838 fi
39 if test "$1" = "" ; then
40 echo "Missing program name to run"
41 exit 1
42 fi
43
3944 PROGRAM=`which $1`
4045 if test ! -x "$PROGRAM" ; then
4146 echo "Can't execute $1"
4247 exit 1
4348 fi
4449 shift;
45 TOPDIR=`pwd | sed -e 's#\(.*/llvm[0-9]*\).*#\1#'`
50
51 TOPDIR=`llvm-config --src-root`
52
4653 if test -d "$TOPDIR" ; then
4754 cd $TOPDIR
4855 case `uname -s` in
1717 # details.
1818 ##===----------------------------------------------------------------------===##
1919
20 TOPDIR=`pwd | sed -e 's#\(.*/llvm[0-9]*\).*#\1#'`
21 echo $TOPDIR
20 TOPDIR=`llvm-config --src-root`
2221 if test -d "$TOPDIR" ; then
2322 cd $TOPDIR
2423 case `uname -s` in