summaryrefslogtreecommitdiffhomepage
path: root/examples/make.sh
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-01-11 20:51:50 +0100
committerTyge Løvset <[email protected]>2022-01-11 20:51:50 +0100
commitd85a4e9e396688b6b5b29c0ffb07de7ce9013b74 (patch)
tree47b60c3014cedd703b1db850c9a7a111e00b3b7c /examples/make.sh
parentaf1b2068b39deebfbf723532a2eddc49da61894a (diff)
downloadSTC-modified-d85a4e9e396688b6b5b29c0ffb07de7ce9013b74.tar.gz
STC-modified-d85a4e9e396688b6b5b29c0ffb07de7ce9013b74.zip
Added tinycthread: include/threads.h, src/threads.c. Ex: sptr_threads.c - emulates standard C11 threads library for compilers not supporting C11 threads.h.
Fixed and cleanup of CMake build.
Diffstat (limited to 'examples/make.sh')
-rw-r--r--examples/make.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/examples/make.sh b/examples/make.sh
new file mode 100644
index 00000000..ccce036f
--- /dev/null
+++ b/examples/make.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+cc='gcc -O2 -Wall -std=c99 -pedantic'
+#cc='clang'
+#cc='clang -c -DSTC_HEADER'
+#cc='cl -nologo'
+#cc='cl -nologo -TP'
+#cc='cl -nologo -std:c11'
+libs=''
+run=0
+if [ -z "$OS" ]; then
+ libs='-lm -pthread'
+fi
+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 $libs
+ $cc -I../include $i $libs
+ done
+else
+ for i in *.c ; do
+ echo $cc -I../include $i $libs
+ $cc -I../include $i $libs
+ 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