# garnet-after-compile # by David S. Kosbie, Garnet Project, CMU # This file contains a "csh" shell script to be invoked *after* you have # compiled Garnet from Lisp. This script will create the bin directories, # move all the compiled files there, copy all appropriate loader files there, # and remove all ".err" files if you prefer. The following variables should # be set by the user, unless default actions are preferred... ######################### User-Settable Variables ######################## #set GarnetDir # Home directory for Garnet (only # needed if this is not run from # your top-level garnet directory) #set GarnetSrcDir # Set this only if it is different # from $GarnetDir/src #set GarnetBinDir # Set this only if it is different # from $GarnetDir/bin #set CompilerExtension # The script will try to figure this # out, but if it's not ".fasl" nor # ".lbin", you must enter it here. set RemoveErrFiles # "unset" this here if you do not # want the ".err" files removed set Verbose # "set" this here if you want (very) # verbose output from this script ####################### End User-Settable Variables ####################### echo "*** Beginning garnet-after-compile ***" if ( (! $?GarnetDir) && ( $cwd:t == "garnet") ) set GarnetDir = "." if ( (! $?GarnetDir) && ((! $?GarnetSrcDir) || (! $?GarnetBinDir)) ) then echo " **** You must first set the GarnetDir variable in the shell script," echo " **** or run this from the default top-level Garnet directory." echo " **** Garnet-After-Compile ABORTED..." exit(1) endif if (! $?GarnetSrcDir) set GarnetSrcDir = "$GarnetDir/src" if (! $?GarnetBinDir) set GarnetBinDir = "$GarnetDir/bin" set SrcDirs = (kr opal inter aggregadgets gadgets debug demos gilt) set DirCnt = $#SrcDirs set ThisDir = 0 if !($?CompilerExtension) then if (-e $GarnetSrcDir/kr/kr.fasl) then set CompilerExtension = ".fasl" else if (-e $GarnetSrcDir/kr/kr.lbin) then set CompilerExtension = ".lbin" else if (-e $GarnetSrcDir/kr/kr.sbin) then set CompilerExtension = ".sbin" else echo " *** Could not determine Compiler Extension ***" echo " *** Please set the CompilerExtension variable in the" echo " garnet-after-compile shell script ***" echo " Garnet-After-Compile ABORTED" exit(1) endif endif if !(-d $GarnetBinDir) then if ($?Verbose) echo " Creating bin directory $GarnetBinDir" mkdir $GarnetBinDir if !(-d $GarnetBinDir) then echo " **** mkdir $GarnetBinDir FAILED. ABORTING CLEANUP ****" exit(1) endif endif foreach dir ( $SrcDirs ) set SubDir = $dir:t @ ThisDir++ if ($?Verbose) echo " Sub-Directory: $SubDir [ $ThisDir of $DirCnt ]" set SubDir = $GarnetBinDir/$SubDir if !(-d $SubDir) then if ($?Verbose) echo " Creating $SubDir" mkdir $SubDir if !(-d $SubDir) then echo " **** mkdir $SubDir FAILED. ABORTING CLEANUP ****" exit(1) endif else if ($?Verbose) echo " Bin subdirectory already created." endif if ($?Verbose) echo " Moving $CompilerExtension files from src to bin" mv $GarnetSrcDir/$dir/*$CompilerExtension $SubDir if ($?RemoveErrFiles) then if ($?Verbose) then echo " Removing .err files from src (ignore 'No Match', if printed)" endif rm $GarnetSrcDir/$dir/*.err endif if ($?Verbose) echo " Copying loader files from src to bin" cp $GarnetSrcDir/$dir/*-loader.lisp $SubDir end if ($?Verbose) echo " Copying top-level loader file from src into bin" cp $GarnetSrcDir/garnet-loader.lisp $GarnetBinDir unset SrcDirs DirCnt ThisDir SubDir CompilerExtension RemoveErrFiles unset GarnetDir GarnetSrcDir GarnetBinDir Verbose echo "*** garnet-after-compile completed ***"