2002-09-15 16:33:32 +00:00
|
|
|
#!/bin/csh -f
|
|
|
|
|
2002-09-19 14:54:53 +00:00
|
|
|
set pstatus = 0
|
|
|
|
onintr cleanup
|
2003-07-22 12:35:28 +00:00
|
|
|
alias usage 'echo "USAGE: $0:t [-h] [-n] [gmake-flag...] [VAR=...] [toolname (default: opt)]"; set pstatus = 1; goto cleanup'
|
2002-09-19 14:54:53 +00:00
|
|
|
|
2002-09-15 16:33:32 +00:00
|
|
|
set EXEC = opt
|
2002-09-19 14:54:53 +00:00
|
|
|
set GMAKE_OPTS = ""
|
|
|
|
|
|
|
|
set doit = 1
|
|
|
|
unset options_done
|
|
|
|
while ( !( $?options_done ) && ($#argv > 0))
|
|
|
|
switch ($argv[1])
|
|
|
|
case -h :
|
|
|
|
usage
|
2003-07-22 12:35:28 +00:00
|
|
|
case -f :
|
|
|
|
if ($#argv < 2) usage
|
|
|
|
shift argv; set MFILE = $argv[1]; shift argv; breaksw
|
2002-09-19 14:54:53 +00:00
|
|
|
case -n :
|
|
|
|
set doit = 0; shift argv; breaksw
|
|
|
|
case -* :
|
|
|
|
set GMAKE_OPTS = ( $GMAKE_OPTS $argv[1] ); shift argv; breaksw
|
|
|
|
default :
|
2003-07-22 12:35:28 +00:00
|
|
|
set optarg = `echo -n $argv[1] | sed 's/^[^=]*$//'`
|
|
|
|
if ($#optarg) then
|
|
|
|
set GMAKE_OPTS = ( $GMAKE_OPTS $optarg )
|
|
|
|
shift argv
|
|
|
|
else
|
|
|
|
set options_done
|
|
|
|
endif
|
|
|
|
breaksw
|
2002-09-19 14:54:53 +00:00
|
|
|
endsw
|
|
|
|
end
|
2002-09-15 16:33:32 +00:00
|
|
|
|
2003-07-22 12:35:28 +00:00
|
|
|
if ($#argv > 1) then
|
|
|
|
echo 'ERROR: More than one tool is not supported by "makellvm"'
|
|
|
|
usage
|
|
|
|
endif
|
2002-09-15 16:33:32 +00:00
|
|
|
if ($#argv > 0) then
|
2002-09-15 18:22:47 +00:00
|
|
|
set EXEC = $argv[1]
|
2002-09-15 16:33:32 +00:00
|
|
|
endif
|
|
|
|
|
2003-07-22 12:35:28 +00:00
|
|
|
## Compute LLVMDIR: the root of the current LLVM tree.
|
|
|
|
## It is recorded in the variable LEVEL in Makefile, to compute it
|
|
|
|
##
|
|
|
|
if (! $?MFILE) then
|
|
|
|
if (-f GNUmakefile) then
|
|
|
|
set MFILE = GNUmakefile
|
|
|
|
else if (-f makefile) then
|
|
|
|
set MFILE = makefile
|
|
|
|
else
|
|
|
|
set MFILE = Makefile
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
if (! -f $MFILE) then
|
|
|
|
echo "Missing or invalid makefile: $MFILE"
|
|
|
|
exit 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
set LLVMDIR = `awk '/LEVEL[ ]*=/ {print $NF}' $MFILE`
|
|
|
|
|
|
|
|
if ($?LLVMDIR == 0 || ! -d $LLVMDIR) then
|
|
|
|
echo "Unable to find LEVEL or LEVEL is invalid ($LEVEL)"
|
|
|
|
exit 1
|
|
|
|
endif
|
|
|
|
|
2002-09-19 14:54:53 +00:00
|
|
|
set CMD = "gmake $GMAKE_OPTS && (cd $LLVMDIR/tools/$EXEC && gmake $GMAKE_OPTS)"
|
|
|
|
|
|
|
|
if ($doit == 1) then
|
|
|
|
csh -f -c "$CMD"
|
|
|
|
else
|
|
|
|
echo '(NOT EXECUTING) COMMAND:'
|
|
|
|
echo " $CMD"
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
#=========================================================
|
|
|
|
# CODE TO BE EXECUTED IF INTERRUPT IS RECEIVED
|
|
|
|
#=========================================================
|
|
|
|
cleanup:
|
|
|
|
exit($pstatus)
|