if [ -n "$BASH_VERSION" ]; then command -v xargs > /dev/null || { echo >&2 "ERROR: xargs program not available."; } if [ "`uname`" = "Darwin" ]; then export TGC_HAMMER_HOME=`dirname ${BASH_SOURCE[0]} | xargs cd | pwd` else command -v realpath > /dev/null || command -v readlink > /dev/null || { echo "ERROR: neither realpath nor readlink programs are available."; } command -v xargs > /dev/null && command -v realpath > /dev/null && export TGC_HAMMER_HOME=`dirname ${BASH_SOURCE[0]} | xargs realpath` command -v xargs > /dev/null && command -v readlink > /dev/null && export TGC_HAMMER_HOME=`dirname ${BASH_SOURCE[0]} | xargs readlink -f` fi elif [ -n "$ZSH_VERSION" ]; then command -v realpath > /dev/null || command -v readlink > /dev/null || { echo "ERROR: neither realpath nor readlink programs are available."; } command -v xargs > /dev/null && command -v realpath > /dev/null && export TGC_HAMMER_HOME=`dirname ${(%):-%x} | xargs realpath` command -v xargs > /dev/null && command -v readlink > /dev/null && export TGC_HAMMER_HOME=`dirname ${(%):-%x} | xargs readlink -f` else echo "ERROR: unknown shell" exit fi if [ -f "source.sh" ]; then echo "Directory already seems to be workspace." elif [ -f "init-workspace.sh" ]; then echo "Cannot create workspace in TGC-Hammer directly, use different directory." else echo "Creating workspace ..." echo "export TGC_HAMMER_HOME=\"${TGC_HAMMER_HOME}\"" > source.sh echo "export TGC_HAMMER_WORKDIR=\"$PWD\"" >> source.sh echo "export PATH=\"${TGC_HAMMER_HOME}/toolflow/target/universal/stage/bin:$PATH\"" >> source.sh cp -r ${TGC_HAMMER_HOME}/wsTemplate/. $PWD mkdir -p output fi