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

Commit 4ca5258

Browse files
committed
yosys: move Makefile.conf generation to a function
1 parent b576fd1 commit 4ca5258

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

scripts/compile_yosys.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ then
2929

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

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

42+
_ghdl_conf() {
43+
if [ $COMPILE_GHDL == "1" ]
44+
then
45+
echo 'ENABLE_GHDL := 1' >> Makefile.conf
46+
echo "GHDL_PREFIX := $PACKAGE_DIR/$NAME" >> Makefile.conf
47+
fi
48+
}
49+
4450
# -- Compile it
4551
if [ $ARCH == "darwin" ]; then
4652
OLDPATH=$PATH
4753
export PATH="/usr/local/opt/bison/bin:/usr/local/opt/flex/bin:$PATH"
4854
$MAKE config-clang
49-
echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf
55+
_ghdl_conf
5056
gsed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile
5157
sed -i "" "s/-Wall -Wextra -ggdb/-w/;" Makefile
5258
CXXFLAGS="-std=c++11 $CXXFLAGS" make \
@@ -59,7 +65,7 @@ if [ $ARCH == "darwin" ]; then
5965
export PATH=$OLDPATH
6066
elif [ ${ARCH:0:7} == "windows" ]; then
6167
$MAKE config-msys2-64
62-
echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf
68+
_ghdl_conf
6369
sed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile
6470
$MAKE -j$J GIT_REV="${GIT_REV}" PRETTY=0 \
6571
LDLIBS="-static -lstdc++ -lm $GHDL_LDLIBS" \
@@ -74,7 +80,7 @@ elif [ ${ARCH:0:7} == "windows" ]; then
7480
test_bin yosys-smtbmc$EXE
7581
else
7682
$MAKE config-gcc
77-
echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf
83+
_ghdl_conf
7884
sed -i "s/-Wall -Wextra -ggdb/-w/;" Makefile
7985
sed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile
8086
# sed -i "s/LD = gcc$/LD = $CC/;" Makefile

0 commit comments

Comments
 (0)