diff options
Diffstat (limited to 'examples/b')
| -rwxr-xr-x | examples/b | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/examples/b b/examples/b new file mode 100755 index 0000000..9c29028 --- /dev/null +++ b/examples/b @@ -0,0 +1,53 @@ +#!/bin/sh + +echorun() +{ + echo $1 + $1 +} + +compile() +{ + echorun "$cc $cflags $include $lflags -o $dir/$1 $dir/$1.c $libs" +} + +cur=`pwd` +dir=`realpath $0` +dir=`dirname $dir` + +echorun "cd $dir" + +if [ "$1" = 'clean' ] ; then + echorun "rm -f $dir/macros \ + $dir/macros.exe \ + $dir/arena \ + $dir/arena.exe \ + $dir/sys \ + $dir/sys.exe \ + $dir/string \ + $dir/string.exe" + echorun "cd $cur" + exit +fi + +cc='tcc' +if [ "$1" = 'windows' ] ; then + cc='x86_64-w64-mingw32-gcc' +fi + +prbdir="$dir/.." +if [ ! -e "$prbdir/libprb.a" ] ; then + $prbdir/build.sh +fi + +cflags='-g -Wall -std=c99' +include="-I$prbdir" +lflags="-L$prbdir" +libs='-lprb -lm' + +compile macros +compile arena +compile sys +compile string + +echorun "cd $cur" |
