From 39c36e868d2dd0071f209a71374d08c3b440af09 Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Thu, 19 Sep 2002 14:54:53 +0000 Subject: [PATCH] Add support for passing in arbitrary flags to gmake (except -n and -h which are interpreted by this script). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3818 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/makellvm | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/utils/makellvm b/utils/makellvm index f7ee7de1500..9c8eab486d6 100755 --- a/utils/makellvm +++ b/utils/makellvm @@ -1,16 +1,46 @@ #!/bin/csh -f +set pstatus = 0 +onintr cleanup +alias usage 'echo "USAGE: $0:t [-h] [-n] [gmake-flag...] [toolname]"; set pstatus = 1; goto cleanup' + ## LLVMDIR is simply the directory where this script resides! set thisExec = $0 ## cannot use :h on $0 for some reason set LLVMDIR = `echo {$thisExec:h} | sed 's/\/utils$//'` set EXEC = opt +set GMAKE_OPTS = "" + +set doit = 1 +unset options_done +while ( !( $?options_done ) && ($#argv > 0)) + switch ($argv[1]) + case -h : + usage + case -n : + set doit = 0; shift argv; breaksw + case -* : + set GMAKE_OPTS = ( $GMAKE_OPTS $argv[1] ); shift argv; breaksw + default : + set options_done; breaksw + endsw +end if ($#argv > 0) then - if ($argv[1] == "-h") then - echo 'USAGE: makellvm [toolname] (toolname defaults to "opt").' - exit 0 - endif set EXEC = $argv[1] endif -gmake && (cd $LLVMDIR/tools/$EXEC && gmake) +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)