aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/vendors/compile-lattice.sh
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/vendors/compile-lattice.sh')
-rwxr-xr-xlibraries/vendors/compile-lattice.sh29
1 files changed, 16 insertions, 13 deletions
diff --git a/libraries/vendors/compile-lattice.sh b/libraries/vendors/compile-lattice.sh
index 860024d6c..57d7f883a 100755
--- a/libraries/vendors/compile-lattice.sh
+++ b/libraries/vendors/compile-lattice.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
# EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
# vim: tabstop=2:shiftwidth=2:noexpandtab
# kate: tab-width 2; replace-tabs off; indent-width 2;
@@ -36,10 +36,13 @@
# ==============================================================================
# ---------------------------------------------
+# work around for Darwin (Mac OS)
+READLINK=readlink; if [[ $(uname) == "Darwin" ]]; then READLINK=greadlink; fi
+
# save working directory
WorkingDir=$(pwd)
ScriptDir="$(dirname $0)"
-ScriptDir="$(readlink -f $ScriptDir)"
+ScriptDir="$($READLINK -f $ScriptDir)"
DeviceList="ec ecp ecp2 ecp3 ecp5u lptm lptm2 machxo machxo2 machxo3l sc scm xp xp2"
@@ -90,9 +93,9 @@ while [[ $# > 0 ]]; do
;;
--vhdl2008)
VHDLStandard=2008
- echo 1>&2 -e "${COLORED_ERROR} VHDL-2008 is not yet supported by Lattice.${ANSI_RESET}"
- # echo 1>&2 -e "${ANSI_YELLOW}Possible workaround: ${ANSI_RESET}"
- # echo 1>&2 -e "${ANSI_YELLOW} Compile 'std_logic_arith' and 'std_logic_unsigned' into library IEEE.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} VHDL-2008 is not yet supported by Lattice.${ANSI_NOCOLOR}"
+ # echo 1>&2 -e "${ANSI_YELLOW}Possible workaround: ${ANSI_NOCOLOR}"
+ # echo 1>&2 -e "${ANSI_YELLOW} Compile 'std_logic_arith' and 'std_logic_unsigned' into library IEEE.${ANSI_NOCOLOR}"
exit -1
;;
--ghdl)
@@ -108,7 +111,7 @@ while [[ $# > 0 ]]; do
shift # skip argument
;;
*) # unknown option
- echo 1>&2 -e "${COLORED_ERROR} Unknown command line option.${ANSI_RESET}"
+ echo 1>&2 -e "${COLORED_ERROR} Unknown command line option '$key'.${ANSI_NOCOLOR}"
exit -1
;;
esac
@@ -159,14 +162,14 @@ fi
DefaultDirectories=("/usr/local/diamond" "/opt/Diamond" "/opt/diamond")
if [ ! -z $LSC_DIAMOND ]; then
- EnvSourceDir=$FOUNDRY/../cae_library/simulation/vhdl
+ EnvSourceDir=$FOUNDRY/../${SourceDirectories[LatticeDiamond]}
else
for DefaultDir in ${DefaultDirectories[@]}; do
for Major in 3; do
for Minor in 8 7 6 5; do
Dir=$DefaultDir/${Major}.${Minor}_x64
if [ -d $Dir ]; then
- EnvSourceDir=$Dir/cae_library/simulation/vhdl
+ EnvSourceDir=$Dir/${SourceDirectories[LatticeDiamond]}
break 3
fi
done
@@ -208,7 +211,7 @@ GHDL_OPTIONS=(-fexplicit -frelaxed-rules --no-vital-checks --warn-binding --mb-c
GHDL_PARAMS=(${GHDL_OPTIONS[@]})
-GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard -P$DestinationDirectory)
+GHDL_PARAMS+=(--ieee=$VHDLFlavor --std=$VHDLStandard)
STOPCOMPILING=0
@@ -219,7 +222,7 @@ ERRORCOUNT=0
if [ "$CLEAN" == "TRUE" ]; then
echo 1>&2 -e "${COLORED_ERROR} '--clean' is not implemented!"
exit -1
- echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Cleaning up vendor directory ...${ANSI_NOCOLOR}"
rm *.o 2> /dev/null
rm *.cf 2> /dev/null
fi
@@ -248,7 +251,7 @@ for device in $DeviceList; do
LibraryDirectory=$DestinationDirectory/$Library/$VHDLVersion
mkdir -p $LibraryDirectory
cd $LibraryDirectory
- echo -e "${ANSI_YELLOW}Compiling library '$Library'...${ANSI_RESET}"
+ echo -e "${ANSI_YELLOW}Compiling library '$Library'...${ANSI_NOCOLOR}"
DeviceSourceDirectory="$SourceDirectory/$device/src"
for File in ${FileLists[$device]}; do
@@ -256,9 +259,9 @@ for device in $DeviceList; do
FileName=$(basename "$File")
FileName="${device}_$FileName"
if [ $SKIP_EXISTING_FILES -eq 1 ] && [ -e "${FileName%.*}.o" ]; then
- echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_RESET}"
+ echo -e "${ANSI_CYAN}Skipping file '$File'${ANSI_NOCOLOR}"
else
- echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_RESET}"
+ echo -e "${ANSI_CYAN}Analyzing file '$File'${ANSI_NOCOLOR}"
$GHDLBinary -a ${GHDL_PARAMS[@]} --work=$Library "$File" 2>&1 | $GRC_COMMAND
if [ $? -ne 0 ]; then
let ERRORCOUNT++