Use much better method to find the llvmbase directory.
[oota-llvm.git] / utils / makellvm
1 #!/bin/csh -f
2
3         ## LLVMDIR is simply the directory where this script resides!
4 set THISEXEC = $0               ## cannot use :h on $0 for some reason
5 set LLVMDIR = $THISEXEC:h
6 set EXEC = opt
7
8 if ($#argv > 0) then
9     if (&& $argv[1] == "-h") then
10         echo 'USAGE: makellvm [toolname]   (toolname defaults to "opt").'
11         exit 0
12     endif
13
14     set EXEC = NO_SUCH_TOOL
15     set TOOLS = `grep DIRS ${LLVMDIR}/tools/Makefile | sed 's/DIRS[     ]*=[    ]*//'`
16     foreach T ( $TOOLS )
17         if ($argv[1] == "$T") then
18             set EXEC = $T
19             shift argv
20             break
21         endif
22     end
23 endif
24
25 gnumake && (cd $LLVMDIR/tools/$EXEC && gnumake)