|  | #!/bin/bash | 
|  |  | 
|  | export RUNSET_DIR=./V1.3.0/DRC/Calibre | 
|  | export LOG | 
|  | export JOB_NAME | 
|  | export JOB_HOME | 
|  |  | 
|  | #Sets the LOG variable and creates the log directory if it doesn't exist. | 
|  | if [ ! -d ./log ]; then | 
|  | mkdir log | 
|  | LOG=./log | 
|  | else | 
|  | LOG=./log | 
|  | fi | 
|  |  | 
|  | #Removes the outputs if the script is run again. Otherwise it creates the output directory and all of its subdirectories | 
|  | if [ ! -d "./output/" ]; then | 
|  | echo "Making output directory...." | 
|  | mkdir -p output/{summary,results,db,rdb} | 
|  | else | 
|  | echo "Building Directories...." | 
|  | mkdir -p output/{summary,results,db,rdb} | 
|  | fi | 
|  |  | 
|  |  | 
|  | #If the gds files weren't generated, this if statement extracts all of the gds files from the cells within the lib folder. | 
|  | if [ ! -d "../lib/gds" ]; then | 
|  | cd ../lib/magic | 
|  | ./extract_all | 
|  | cd - | 
|  | fi | 
|  |  | 
|  |  | 
|  | cd ../lib/gds | 
|  | JOB_HOME=$PWD | 
|  | cd - | 
|  |  | 
|  |  | 
|  | if [ ! -z "$1" ]; then | 
|  | export i=$(echo $1 | cut -f 1 -d '.') #i is used as the input variable | 
|  | else | 
|  | export i="$(basename -s .gds $(ls $JOB_HOME/*.gds))" #i is used s the input variable | 
|  | fi | 
|  |  | 
|  | #Loops through the input gds files. If no user input is supplied, all gds files are put through the DRC process. | 
|  | for JOB_NAME in $i ; do | 
|  |  | 
|  | #Checks to make sure the file supplied exists. If not, then it exits the bash script. | 
|  | if [ ! -e $JOB_HOME/$JOB_NAME.gds ]; then 	echo "Did not find '$JOB_HOME/$JOB_NAME.gds'" | 
|  | exit 1 | 
|  | fi | 
|  |  | 
|  | echo -e "\nexport JOB_HOME='$JOB_HOME'" | 
|  | echo -e "export JOB_NAME='$JOB_NAME'" | 
|  | echo -e "=====================================" | 
|  |  | 
|  | set -x #Turns on debugging | 
|  |  | 
|  | calibre -gui -drc -runset $RUNSET_DIR/s8_drc_runset     -batch > $LOG/s8_drc_runset.log     2>&1 | 
|  |  | 
|  | set +x #Turns off debugging | 
|  |  | 
|  | done #End of the loop | 
|  |  | 
|  | echo "Moving output files to ./output" | 
|  | mv -v *.results ./output/results/ | 
|  | mv -v *.summary ./output/summary/ | 
|  | mv -v *.rdb ./output/rdb/ | 
|  | mv -v *.db ./output/db/ | 
|  | mv -v *s8_* ./output/ | 
|  |  | 
|  | exit 0 |