Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

Commit

Permalink
yosys: move Makefile.conf generation to a function
Browse files Browse the repository at this point in the history
  • Loading branch information
umarcor committed Jan 4, 2021
1 parent b576fd1 commit 4ca5258
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions scripts/compile_yosys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ then

mkdir -p frontends/ghdl
cp -R ../$dir_name_gyp/src/* frontends/ghdl
MAKEFILE_CONF_GHDL=$'ENABLE_GHDL := 1\n'
MAKEFILE_CONF_GHDL+="GHDL_PREFIX := $PACKAGE_DIR/$NAME"

if [ $ARCH == "darwin" ]; then
GHDL_LDLIBS="$PACKAGE_DIR/$NAME/lib/libghdl.a $(tr -s '\n' ' ' < $PACKAGE_DIR/$NAME/lib/libghdl.link)"
Expand All @@ -41,12 +39,20 @@ then
fi
fi

_ghdl_conf() {
if [ $COMPILE_GHDL == "1" ]
then
echo 'ENABLE_GHDL := 1' >> Makefile.conf
echo "GHDL_PREFIX := $PACKAGE_DIR/$NAME" >> Makefile.conf
fi
}

# -- Compile it
if [ $ARCH == "darwin" ]; then
OLDPATH=$PATH
export PATH="/usr/local/opt/bison/bin:/usr/local/opt/flex/bin:$PATH"
$MAKE config-clang
echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf
_ghdl_conf
gsed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile
sed -i "" "s/-Wall -Wextra -ggdb/-w/;" Makefile
CXXFLAGS="-std=c++11 $CXXFLAGS" make \
Expand All @@ -59,7 +65,7 @@ if [ $ARCH == "darwin" ]; then
export PATH=$OLDPATH
elif [ ${ARCH:0:7} == "windows" ]; then
$MAKE config-msys2-64
echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf
_ghdl_conf
sed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile
$MAKE -j$J GIT_REV="${GIT_REV}" PRETTY=0 \
LDLIBS="-static -lstdc++ -lm $GHDL_LDLIBS" \
Expand All @@ -74,7 +80,7 @@ elif [ ${ARCH:0:7} == "windows" ]; then
test_bin yosys-smtbmc$EXE
else
$MAKE config-gcc
echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf
_ghdl_conf
sed -i "s/-Wall -Wextra -ggdb/-w/;" Makefile
sed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile
# sed -i "s/LD = gcc$/LD = $CC/;" Makefile
Expand Down

0 comments on commit 4ca5258

Please sign in to comment.