heptagon/tools/heptc-c.sh

34 lines
553 B
Bash
Raw Normal View History

2010-06-21 12:11:06 +02:00
#!/bin/sh
# This small helper scripts automates the Heptagon -> C translation.
if [ $# -lt 1 ]
then
echo Usage: $0 file.ept
exit 1
fi
2010-11-10 15:44:28 +01:00
if `which heptc.native` 2>/dev/null; then
HEPTC=heptc.native
else
HEPTC=heptc.byte
fi
2010-06-21 12:11:06 +02:00
compile=1
if [ $# -gt 2 ];
then
nocompile=0
fi
F=$1
REP=`basename $F .ept`_c
shift
# Compile source file to VHDL, flattening node calls
if [ $compile -eq 1 ]; then
2011-05-30 10:23:03 +02:00
"$HEPTC" $@ -s main -target c $F $@ || exit 1
2010-06-21 12:11:06 +02:00
fi
# Compile it with GCC
2011-05-30 10:23:03 +02:00
cc -I "`$HEPTC -where`/c" -std=c99 $REP/*.c -o "`basename $F .ept`" || exit 1