From 1b9e028e75af390085d11e7b007c865bb458a554 Mon Sep 17 00:00:00 2001 From: mrtuxa_openbsd Date: Thu, 10 Aug 2023 19:47:28 +0200 Subject: [PATCH] added run but better --- run | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) mode change 100755 => 100644 run diff --git a/run b/run old mode 100755 new mode 100644 index 211a56d..e36a811 --- a/run +++ b/run @@ -1,5 +1,33 @@ #!/usr/bin/env bash set -e -./lua_translate -gcc -std=gnu89 src/main.c -g -lSDL2 -llua5.3 -lm -o engine -O3 -Werror -Wall + +if [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +target_os=$(echo "$1") + +printf "$target_os\n" + +case "$target_os" in + linux) + echo "compiling linux" + ./lua_translate + gcc -std=gnu89 src/main.c -g -lSDL2 -llua5.3 -lm -o engine -O3 -Werror -Wall + ;; + openbsd) + echo "compiling openbsd" + sed -i 's/lua5\.3/lua-5.3/g' lua_translate + ./lua_translate + egcc -std=gnu89 src/main.c -g -lSDL2 -llua5.3 -lm -o engine -O3 -Werror -Wall -I /usr/local/include + ;; + *) + echo "Unsupported OS, only linux and openbsd work" + exit 1 + ;; +esac + +printf "\n\tengine is running" + exec ./engine -- 2.45.2