#!/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"