Add support for passing in arbitrary flags to gmake (except -n and -h
[oota-llvm.git] / utils / makellvm
1 #!/bin/csh -f
2
3 set pstatus = 0
4 onintr cleanup
5 alias usage 'echo "USAGE: $0:t [-h] [-n] [gmake-flag...] [toolname]"; set pstatus = 1; goto cleanup'
6
7         ## LLVMDIR is simply the directory where this script resides!
8 set thisExec = $0               ## cannot use :h on $0 for some reason
9 set LLVMDIR = `echo {$thisExec:h} | sed 's/\/utils$//'`
10 set EXEC = opt
11 set GMAKE_OPTS = ""
12
13 set doit = 1
14 unset options_done
15 while ( !( $?options_done ) && ($#argv > 0))
16     switch ($argv[1])
17         case -h :
18             usage
19         case -n :
20             set doit = 0; shift argv; breaksw
21         case -* :
22             set GMAKE_OPTS = ( $GMAKE_OPTS $argv[1] ); shift argv; breaksw
23         default :
24             set options_done; breaksw
25     endsw
26 end
27
28 if ($#argv > 0) then
29     set EXEC = $argv[1]
30 endif
31
32 set CMD = "gmake $GMAKE_OPTS && (cd $LLVMDIR/tools/$EXEC && gmake $GMAKE_OPTS)"
33
34 if ($doit == 1) then
35     csh -f -c "$CMD"
36 else
37     echo '(NOT EXECUTING) COMMAND:'
38     echo "  $CMD"
39 endif
40
41
42 #=========================================================
43 # CODE TO BE EXECUTED IF INTERRUPT IS RECEIVED
44 #=========================================================
45 cleanup:
46     exit($pstatus)