Really use a search path as described in the log message for the last

version (instead of 2 fixed choices).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8525 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve
2003-09-15 11:18:36 +00:00
parent 77b398cd5f
commit c69230d569

View File

@@ -8,6 +8,11 @@ set EXEC = opt
set GMAKE_OPTS = "" set GMAKE_OPTS = ""
set DEBUG = 0 set DEBUG = 0
## Search path for automatically finding the obj-root to use.
## Note: The src root directory ${LLVMDIR} will be prepended to this path later.
##
set OBJROOTDIRLIST = ( "/localhome/$USER/llvm" )
set doit = 1 set doit = 1
unset options_done unset options_done
while ( !( $?options_done ) && ($#argv > 0)) while ( !( $?options_done ) && ($#argv > 0))
@@ -20,7 +25,12 @@ while ( !( $?options_done ) && ($#argv > 0))
case -n : case -n :
set doit = 0; shift argv; breaksw set doit = 0; shift argv; breaksw
case -obj : case -obj :
set OBJROOT = $argv[1]; shift argv; shift argv; breaksw set OBJROOT = $argv[2]; shift argv; shift argv
if (! -d "$OBJROOT") then
echo "FATAL: Illegal obj-root directory ${OBJROOT}"
exit 1
endif
breaksw
case -d : case -d :
set doit = 0; set DEBUG = 1; shift argv; breaksw set doit = 0; set DEBUG = 1; shift argv; breaksw
case -* : case -* :
@@ -79,23 +89,42 @@ if ($#LLVMDIR == 0 || ! -d "$LLVMDIR") then
exit 1 exit 1
endif endif
## Try to determine the obj-root directory automatically if not specified
##
set OBJROOTDIRLIST = ( ${LLVMDIR} $OBJROOTDIRLIST ) ## add src dir
if ($?OBJROOT == 0) then if ($?OBJROOT == 0) then
## Check if source root is obj-root by looking for Makefile.config there ## Try to determine object root directory by looking for Makefile.config
if (-f ${LLVMDIR}/Makefile.config) then foreach objdir ( $OBJROOTDIRLIST )
set OBJROOT = ${LLVMDIR} if (-f "${objdir}/Makefile.config") then
set BUILDROOT = . set OBJROOT = ${objdir}
else ## Otherwise assume a default location for OBJROOT break
set OBJROOT = "/localhome/$USER/llvm" endif
set SRCROOT = `sh -c "cd $LLVMDIR; pwd | sed 's/\//\\\//g'"` end
set CURSRCDIR = `echo $cwd | sed -e "s/${SRCROOT}//"` if ($?OBJROOT == 0) then
set BUILDROOT = ${OBJROOT}/${CURSRCDIR} echo "FATAL: Could not choose an obj-root directory from these choices:"
unset SRCROOT CURSRCDIR echo " ${OBJROOTDIRLIST}."
echo " You can specify it explicitly using '-obj obj-root'."
exit 1
endif endif
echo "Using OBJ-ROOT = ${OBJROOT} (specify '-obj obj-root' to override)." echo "Using OBJ-ROOT = ${OBJROOT} (specify '-obj obj-root' to override)."
endif endif
if (${OBJROOT} == ${LLVMDIR}) then
# run make in the source directory itself
set BUILDROOT = .
else
# run make in the in the obj-root tree, in the directory for $cwd
set SRCROOT = `sh -c "cd $LLVMDIR; pwd | sed 's/\//\\\//g'"`
set CURSRCDIR = `echo $cwd | sed -e "s/${SRCROOT}//"`
set BUILDROOT = ${OBJROOT}/${CURSRCDIR}
unset SRCROOT CURSRCDIR
endif
if ($DEBUG) then if ($DEBUG) then
echo "DEBUG: BUILDROOT = $BUILDROOT" echo "DEBUG: BUILDROOT = $BUILDROOT"
endif endif
if (! -d $BUILDROOT) then
echo "FATAL: Invalid build directory: ${BUILDROOT}"
exit 1
endif
cd $BUILDROOT cd $BUILDROOT
set CMD = "gmake $GMAKE_OPTS && (cd $LLVMDIR/tools/$EXEC && gmake $GMAKE_OPTS)" set CMD = "gmake $GMAKE_OPTS && (cd $LLVMDIR/tools/$EXEC && gmake $GMAKE_OPTS)"