summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-09-19 11:44:23 +0200
committerTyge Løvset <[email protected]>2021-09-19 11:44:23 +0200
commit003c02756f0095ed56cc2c6117cc4ec92c6f0145 (patch)
treea74d52b1f0efe1ae8880d09f95b55d2946546ff6 /examples
parent12e9d8ad86394cb11e78433518ee3818d75510a9 (diff)
downloadSTC-modified-003c02756f0095ed56cc2c6117cc4ec92c6f0145.tar.gz
STC-modified-003c02756f0095ed56cc2c6117cc4ec92c6f0145.zip
Added runall.sh script in examples.
Diffstat (limited to 'examples')
-rw-r--r--examples/runall.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/examples/runall.sh b/examples/runall.sh
new file mode 100644
index 00000000..c476c6e1
--- /dev/null
+++ b/examples/runall.sh
@@ -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