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

Commit 247113d

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

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

scripts/compile_yosys.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@ fi
2121

2222
cd $BUILD_DIR/$dir_name
2323

24-
MAKEFILE_CONF_GHDL=
2524
GHDL_LDLIBS=
2625
if [ $COMPILE_GHDL == "1" ]
2726
then
2827
patch < $WORK_DIR/scripts/yosys_ghdl.diff
2928

3029
mkdir -p frontends/ghdl
3130
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"
3431

3532
if [ $ARCH == "darwin" ]; then
3633
GHDL_LDLIBS="$PACKAGE_DIR/$NAME/lib/libghdl.a $(tr -s '\n' ' ' < $PACKAGE_DIR/$NAME/lib/libghdl.link)"
@@ -41,12 +38,20 @@ then
4138
fi
4239
fi
4340

41+
_ghdl_conf() {
42+
if [ $COMPILE_GHDL == "1" ]
43+
then
44+
echo 'ENABLE_GHDL := 1' >> Makefile.conf
45+
echo "GHDL_PREFIX := $PACKAGE_DIR/$NAME" >> Makefile.conf
46+
fi
47+
}
48+
4449
# -- Compile it
4550
if [ $ARCH == "darwin" ]; then
4651
OLDPATH=$PATH
4752
export PATH="/usr/local/opt/bison/bin:/usr/local/opt/flex/bin:$PATH"
4853
$MAKE config-clang
49-
echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf
54+
_ghdl_conf
5055
gsed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile
5156
sed -i "" "s/-Wall -Wextra -ggdb/-w/;" Makefile
5257
CXXFLAGS="-std=c++11 $CXXFLAGS" make \
@@ -59,7 +64,7 @@ if [ $ARCH == "darwin" ]; then
5964
export PATH=$OLDPATH
6065
elif [ ${ARCH:0:7} == "windows" ]; then
6166
$MAKE config-msys2-64
62-
echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf
67+
_ghdl_conf
6368
sed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile
6469
$MAKE -j$J GIT_REV="${GIT_REV}" PRETTY=0 \
6570
LDLIBS="-static -lstdc++ -lm $GHDL_LDLIBS" \
@@ -74,7 +79,7 @@ elif [ ${ARCH:0:7} == "windows" ]; then
7479
test_bin yosys-smtbmc$EXE
7580
else
7681
$MAKE config-gcc
77-
echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf
82+
_ghdl_conf
7883
sed -i "s/-Wall -Wextra -ggdb/-w/;" Makefile
7984
sed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile
8085
# sed -i "s/LD = gcc$/LD = $CC/;" Makefile

0 commit comments

Comments
 (0)