diff --git a/set_env.sh b/set_env.sh index c23b7529dc1f61437a1e962ac0ae2134beb4ebce..9c06f622e32ded100d95fe919f16c829b2aa1362 100644 --- a/set_env.sh +++ b/set_env.sh @@ -10,34 +10,40 @@ #----------------------------------------------------------------------------- #!/bin/bash -# Get Root Location of Repository +# Get Root Location of Design Structure if [ -z $DESIGN_ROOT ]; then # If $DESIGN_ROOT hasn't been set yet DESIGN_ROOT=`git rev-parse --show-superproject-working-tree` + if [ -z $DESIGN_ROOT ]; then - # If not in a submodule + # If not in a submodule - at root DESIGN_ROOT=`git rev-parse --show-toplevel` fi -fi -# Set Environment Variable for this Repository -export NANOSOC_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" + # Source Top-Level Sourceme + source $DESIGN_ROOT/set_env.sh +else + # Set Environment Variable for this Repository + export NANOSOC_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" -# If this Repo is root of workspace -if [ $NANOSOC_DIR = $DESIGN_ROOT ]; then - echo "Design Workspace: $NANOSOC_DIR" - export DESIGN_ROOT -fi + # If this Repo is root of workspace + if [ $NANOSOC_DIR = $DESIGN_ROOT ]; then + echo "Design Workspace: $DESIGN_ROOT" + export DESIGN_ROOT + # Set Default Simulator + export SIMULATOR="ivlog" + fi -# Source environment variables for all submodules -for d in $NANOSOC_DIR/* ; do - if [ -f "$d/.git" ]; then - if [ -f "$d/set_env.sh" ]; then - # If .git file exists - submodule - source $d/set_env.sh + # Source environment variables for all submodules + for d in $NANOSOC_DIR/* ; do + if [ -f "$d/.git" ]; then + if [ -f "$d/set_env.sh" ]; then + # If .git file exists - submodule + source $d/set_env.sh + fi fi - fi -done + done -# Add Flow directory to Path -export PATH="$PATH:/$NANOSOC_DIR/flow" \ No newline at end of file + # Add Scripts to Path + export PATH="$PATH:/$NANOSOC_DIR/flow" +fi \ No newline at end of file