diff --git a/simulation/sources-lib.sh b/simulation/sources-lib.sh index 8b19894f1bae9991e26ae8970587b68cb0d705be..31fb01c589e37a3bb5a126094cc1b524d8df0b13 100755 --- a/simulation/sources-lib.sh +++ b/simulation/sources-lib.sh @@ -1,20 +1,33 @@ #!/bin/bash #script should be run by make +function usage() { + echo "Usage: $0 hdl_path scripts_path" +} + +function abs_path() { + local cur_dir=$(pwd) + local D=$(dirname $1) + local B=$(basename $1) + (cd $D && echo $(pwd)"/$B") || exit 1 + cd $cur_dir +} + ##$1 is expected to be project path -if [ $# -lt 1 ]; then - echo "$0"': Argument expected' - echo "Usage: $0 project_path hdl_path" +if [ $# -ne 2 ]; then + echo "$0"': Exactly two arguments expected' + usage exit 1 fi -if [ ! -d $1 ]; then - echo "$0"':'"$1"'is not a directory' - echo "Usage: $0 project_path hdl_path" +if [ ! -d $1 -o ! -d $2 ]; then + echo "$0: $1 or $2 is not a directory" + usage exit 1 fi -hdl_path=$1 -scripts_path=$2 + +hdl_path=$(abs_path $1) +scripts_path=$(abs_path $2) ##modules file is obligatory for each simulation if [ ! -f $(pwd)/modules ]; then echo "$0: Modules file does not exist" diff --git a/simulation/sources.sh b/simulation/sources.sh index 947a14d50d7e0b8f2979d1570eea1446cecbc722..010415b6855f4b05992846b41421e21c54865ea4 100755 --- a/simulation/sources.sh +++ b/simulation/sources.sh @@ -4,6 +4,15 @@ function usage() { echo "Usage: $0 hdl_path scripts_path" } + +function abs_path() { + local cur_dir=$(pwd) + local D=$(dirname $1) + local B=$(basename $1) + (cd $D && echo $(pwd)"/$B") || exit 1 + cd $cur_dir +} + ##$1 is expected to be project path if [ $# -ne 2 ]; then echo "$0"': two arguments expected' @@ -16,8 +25,8 @@ if [ ! -d $1 ]; then usage exit 1 fi -hdl_path=$1 -scripts_path=$2 +hdl_path=$(abs_path $1) +scripts_path=$(abs_path $2) ##modules file is obligatory for each simulation if [ ! -f $(pwd)/modules ]; then diff --git a/simulation/vhdldep.sh b/simulation/vhdldep.sh index e2a15c5aee4695e3be2aadc6d69a5445102e5c7f..f72600e79effe2ae32276e7969ce29c12ccc8cb9 100755 --- a/simulation/vhdldep.sh +++ b/simulation/vhdldep.sh @@ -1,6 +1,14 @@ #!/bin/bash #script should be run by make +function abs_path() { + local cur_dir=$(pwd) + local D=$(dirname $1) + local B=$(basename $1) + (cd $D && echo $(pwd)"/$B") || exit 1 + cd $cur_dir +} + ##associative array declaration if [ $# -lt 2 ]; then echo "$0"': Argument expected' @@ -14,7 +22,7 @@ if [ ! -d "$1" ]; then exit 1 fi -scripts_path=$1 +scripts_path=$(abs_path $1) vhd_comp=$2 number=0 @@ -67,9 +75,9 @@ for i in $(seq 0 $(($number-1))); do ##for each source file fi done uniq_libs=$(echo $all_libs | tr " " "\n" | sort -u | tr "\n" " ") -for lib in $uniq_libs; do - uniq_libs_long="$uniq_libs_long $(pwd)/$lib" -done +#for lib in $uniq_libs; do +# uniq_libs_long="$uniq_libs_long $(pwd)/$lib" +#done echo '' echo 'VHDL_OBJ:='"$obj" echo ''