Skip to content

Commit

Permalink
Added runall.sh script in examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
tylov committed Sep 19, 2021
1 parent 12e9d8a commit 003c027
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions examples/runall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh
cc=gcc
#cc=clang
#cc='clang -c -DSTC_HEADER'
#cc='cl -nologo'
#cc='cl -nologo -TP'
#cc='cl -nologo -std:c11'
run=0
if [ "$1" == '-h' -o "$1" == '--help' ]; then
echo usage: runall.sh [-run] [compiler + options]
exit
fi
if [ "$1" == '-run' ]; then
run=1
shift
fi
if [ ! -z "$1" ] ; then
cc=$@
fi
if [ $run = 0 ] ; then
for i in *.c ; do
echo $cc -I../include $i
$cc -I../include $i
done
else
for i in *.c ; do
echo $cc -I../include $i
$cc -I../include $i
if [ -f $(basename -s .c $i).exe ]; then ./$(basename -s .c $i).exe; fi
if [ -f ./a.exe ]; then ./a.exe; fi
if [ -f ./a.out ]; then ./a.out; fi
done
fi

rm -f a.out *.o *.obj *.exe

0 comments on commit 003c027

Please sign in to comment.