Skip to content
Snippets Groups Projects
Commit 5ba0b13a authored by Pawel Szostek's avatar Pawel Szostek
Browse files

Added automatic conversion from relative to absolute paths

parent c323c631
Branches
Tags
No related merge requests found
#!/bin/bash #!/bin/bash
#script should be run by make #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 ##$1 is expected to be project path
if [ $# -lt 1 ]; then if [ $# -ne 2 ]; then
echo "$0"': Argument expected' echo "$0"': Exactly two arguments expected'
echo "Usage: $0 project_path hdl_path" usage
exit 1 exit 1
fi fi
if [ ! -d $1 ]; then if [ ! -d $1 -o ! -d $2 ]; then
echo "$0"':'"$1"'is not a directory' echo "$0: $1 or $2 is not a directory"
echo "Usage: $0 project_path hdl_path" usage
exit 1 exit 1
fi fi
hdl_path=$1
scripts_path=$2 hdl_path=$(abs_path $1)
scripts_path=$(abs_path $2)
##modules file is obligatory for each simulation ##modules file is obligatory for each simulation
if [ ! -f $(pwd)/modules ]; then if [ ! -f $(pwd)/modules ]; then
echo "$0: Modules file does not exist" echo "$0: Modules file does not exist"
......
...@@ -4,6 +4,15 @@ ...@@ -4,6 +4,15 @@
function usage() { function usage() {
echo "Usage: $0 hdl_path scripts_path" 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 ##$1 is expected to be project path
if [ $# -ne 2 ]; then if [ $# -ne 2 ]; then
echo "$0"': two arguments expected' echo "$0"': two arguments expected'
...@@ -16,8 +25,8 @@ if [ ! -d $1 ]; then ...@@ -16,8 +25,8 @@ if [ ! -d $1 ]; then
usage usage
exit 1 exit 1
fi fi
hdl_path=$1 hdl_path=$(abs_path $1)
scripts_path=$2 scripts_path=$(abs_path $2)
##modules file is obligatory for each simulation ##modules file is obligatory for each simulation
if [ ! -f $(pwd)/modules ]; then if [ ! -f $(pwd)/modules ]; then
......
#!/bin/bash #!/bin/bash
#script should be run by make #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 ##associative array declaration
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
echo "$0"': Argument expected' echo "$0"': Argument expected'
...@@ -14,7 +22,7 @@ if [ ! -d "$1" ]; then ...@@ -14,7 +22,7 @@ if [ ! -d "$1" ]; then
exit 1 exit 1
fi fi
scripts_path=$1 scripts_path=$(abs_path $1)
vhd_comp=$2 vhd_comp=$2
number=0 number=0
...@@ -67,9 +75,9 @@ for i in $(seq 0 $(($number-1))); do ##for each source file ...@@ -67,9 +75,9 @@ for i in $(seq 0 $(($number-1))); do ##for each source file
fi fi
done done
uniq_libs=$(echo $all_libs | tr " " "\n" | sort -u | tr "\n" " ") uniq_libs=$(echo $all_libs | tr " " "\n" | sort -u | tr "\n" " ")
for lib in $uniq_libs; do #for lib in $uniq_libs; do
uniq_libs_long="$uniq_libs_long $(pwd)/$lib" # uniq_libs_long="$uniq_libs_long $(pwd)/$lib"
done #done
echo '' echo ''
echo 'VHDL_OBJ:='"$obj" echo 'VHDL_OBJ:='"$obj"
echo '' echo ''
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment