forked from OSchip/llvm-project
				
			Update makellvm to work with the brave new world of separate obj-root trees.
With these changes, you can still run makellvm directly from your source tree as follows: % makellvm [toolname] ## looks for obj-root in default places (see below) or % makellvm -obj obj-root [toolname] ## specify obj-root explicitly. With the first from, `makellvm' checks the following places in order and uses the first one that contains the file `Makefile.config': (1) Your src-root directory (2) /localhome/$USER/llvm Other choices can be added to this list. llvm-svn: 8509
This commit is contained in:
		
							parent
							
								
									9aa8598450
								
							
						
					
					
						commit
						20c8c040f5
					
				| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set pstatus = 0
 | 
					set pstatus = 0
 | 
				
			||||||
onintr cleanup
 | 
					onintr cleanup
 | 
				
			||||||
alias usage 'echo "USAGE: $0:t [-h] [-n] [gmake-flag...] [VAR=...] [toolname (default: opt)]"; set pstatus = 1; goto cleanup'
 | 
					alias usage 'echo "USAGE: $0:t [-h] [-n] [-obj obj-root] [gmake-flags] [VAR=...] [toolname (default: opt)]"; set pstatus = 1; goto cleanup'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set EXEC = opt
 | 
					set EXEC = opt
 | 
				
			||||||
set GMAKE_OPTS = ""
 | 
					set GMAKE_OPTS = ""
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,8 @@ while ( !( $?options_done ) && ($#argv > 0))
 | 
				
			||||||
	    shift argv; set MFILE = $argv[1]; shift argv; breaksw
 | 
						    shift argv; set MFILE = $argv[1]; shift argv; breaksw
 | 
				
			||||||
	case -n :
 | 
						case -n :
 | 
				
			||||||
	    set doit = 0; shift argv; breaksw
 | 
						    set doit = 0; shift argv; breaksw
 | 
				
			||||||
 | 
						case -obj :
 | 
				
			||||||
 | 
						    set OBJROOT = $argv[1]; shift argv; shift argv; 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 -* :
 | 
				
			||||||
| 
						 | 
					@ -72,11 +74,30 @@ if ($DEBUG) then
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ($#LLVMDIR == 0 || ! -d "$LLVMDIR") then
 | 
					if ($#LLVMDIR == 0 || ! -d "$LLVMDIR") then
 | 
				
			||||||
    echo "Unable to find LLVM obj-root directory or directory is invalid."
 | 
					    echo "Unable to find LLVM src-root directory or directory is invalid."
 | 
				
			||||||
    echo "Are you within a valid LLVM directory for running gmake?"
 | 
					    echo "Are you within a valid LLVM directory for running gmake?"
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ($?OBJROOT == 0) then
 | 
				
			||||||
 | 
					    ## Check if source root is obj-root by looking for Makefile.config there
 | 
				
			||||||
 | 
					    if (-f ${LLVMDIR}/Makefile.config) then
 | 
				
			||||||
 | 
						set OBJROOT = ${LLVMDIR}
 | 
				
			||||||
 | 
						set BUILDROOT = .
 | 
				
			||||||
 | 
					    else ## Otherwise assume a default location for OBJROOT
 | 
				
			||||||
 | 
						set OBJROOT = "/localhome/$USER/llvm"
 | 
				
			||||||
 | 
						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
 | 
				
			||||||
 | 
					    echo "Using OBJ-ROOT = ${OBJROOT} (specify '-obj obj-root' to override)."
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					if ($DEBUG) then
 | 
				
			||||||
 | 
					    echo "DEBUG: BUILDROOT = $BUILDROOT"
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					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)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ($doit == 1) then
 | 
					if ($doit == 1) then
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue