5 alias usage
'echo "USAGE: $0:t [-h] [-n] [-obj obj-root] [gmake-flags] [VAR=...] [toolname (default: opt)]"; set pstatus = 1; goto cleanup'
11 ## Search path for automatically finding the obj-root to use.
12 ## Note: The src root directory ${LLVMDIR} will be prepended to this path later.
14 set OBJROOTDIRLIST
= ( )
18 while ( !( $?options_done
) && ($#argv > 0))
24 shift argv
; set MFILE
= $argv[1]; shift argv
; breaksw
26 set doit
= 0; shift argv
; breaksw
28 set OBJROOT
= $argv[2]; shift argv
; shift argv
29 if (! -d "$OBJROOT") then
30 echo "FATAL: Illegal obj-root directory ${OBJROOT}"
35 set doit
= 0; set DEBUG
= 1; shift argv
; breaksw
37 set GMAKE_OPTS
= ( $GMAKE_OPTS $argv[1] ); shift argv
; breaksw
39 set optarg
= `echo -n $argv[1] | sed 's/^[^=]*$//'`
41 set GMAKE_OPTS
= ( $GMAKE_OPTS $optarg )
51 echo 'ERROR: More than one tool is not supported by "makellvm"'
58 echo "DEBUG: EXEC = $EXEC"
61 ## Compute LLVMDIR: the root of the current LLVM tree.
62 ## It is recorded in the variable LEVEL in Makefile, to compute it
65 if (-f GNUmakefile
) then
66 set MFILE
= GNUmakefile
67 else if (-f makefile
) then
74 echo "DEBUG: MFILE = $MFILE"
77 echo "Missing or invalid makefile: $MFILE"
81 set LLVMDIR
= `awk '/LEVEL[ ]*=/ {print $NF}' $MFILE`
83 echo "DEBUG: LLVMDIR = $LLVMDIR"
86 if ($#LLVMDIR == 0 ||
! -d "$LLVMDIR") then
87 echo "Unable to find LLVM src-root directory or directory is invalid."
88 echo "Are you within a valid LLVM directory for running gmake?"
92 ## Try to determine the obj-root directory automatically if not specified
94 set OBJROOTDIRLIST
= ( ${LLVMDIR} $OBJROOTDIRLIST ) ## add src dir
95 if ($?OBJROOT
== 0) then
96 ## Try to determine object root directory by looking for Makefile.config
97 foreach objdir
( $OBJROOTDIRLIST )
98 if (-f "${objdir}/Makefile.config") then
99 set OBJROOT
= ${objdir}
103 if ($?OBJROOT
== 0) then
104 echo "FATAL: Could not choose an obj-root directory from these choices:"
105 echo " ${OBJROOTDIRLIST}."
106 echo " You can specify it explicitly using '-obj obj-root'."
109 echo "Using OBJ-ROOT = ${OBJROOT} (specify '-obj obj-root' to override)."
111 if (${OBJROOT} == ${LLVMDIR}) then
112 # run make in the source directory itself
115 # run make in the in the obj-root tree, in the directory for $cwd
116 set SRCROOT
= `sh -c "cd $LLVMDIR; pwd | sed 's/\//\\\//g'"`
117 set CURSRCDIR
= `echo $cwd | sed -e "s/${SRCROOT}//"`
118 set BUILDROOT
= ${OBJROOT}/${CURSRCDIR}
119 unset SRCROOT CURSRCDIR
122 echo "DEBUG: BUILDROOT = $BUILDROOT"
124 if (! -d $BUILDROOT) then
125 echo "FATAL: Invalid build directory: ${BUILDROOT}"
130 set CMD
= "make $GMAKE_OPTS && (cd $LLVMDIR/tools/$EXEC && make $GMAKE_OPTS)"
136 echo '(NOT EXECUTING) COMMAND:'
141 #=========================================================
142 # CODE TO BE EXECUTED IF INTERRUPT IS RECEIVED
143 #=========================================================