aboutsummaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authoriceyrazor <iceyrazor@mailfence.com>2026-05-28 18:49:05 -0500
committericeyrazor <iceyrazor@mailfence.com>2026-05-28 18:49:05 -0500
commit53664714b9a693391054d1c0c601b285f2b1a577 (patch)
tree0a9f9e6d6dcf61f9f8d13f1e8c45e8ab6b361a9c /build.sh
init
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..e005808
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+DEBUG=""
+LIB="-Ilib/ -lSDL2_gfx -lSDL2_ttf"
+
+while getopts "d" opt; do
+ case "$opt" in
+ d) DEBUG="-Wall -fsanitize=address -g"
+ ;;
+ esac
+done
+
+shift $((OPTIND-1))
+[ "${1:-}" = "--" ] && shift
+
+if [ "$1" ]; then
+ printf -- "\n\nmaking src %s\n" "$1"
+ file="src/$1"
+ clang -o bin/$(basename $file | sed 's/.c$//') $file $LIB `sdl2-config --cflags --libs` -lm $DEBUG
+else
+ for file in src/*; do
+ if [ -f "$file" ]; then
+ if [ "$file" != ".clangd" ]; then
+ printf -- "\n\nmaking %s\n" "$file"
+ clang -o bin/$(basename $file | sed 's/.c$//') $file $LIB `sdl2-config --cflags --libs` -lm $DEBUG
+ fi
+ fi
+ done
+fi