me.fier.engine/compile

27 lines
672 B
Plaintext
Raw Normal View History

2023-05-14 10:21:03 +00:00
#!/usr/bin/env bash
set -e
export target_os="${target_os:=$1}"
2023-08-10 17:47:28 +00:00
if [ "$target_os" = "" ]; then
2023-08-10 18:01:05 +00:00
echo "Usage: $0 <linux/openbsd>"
2023-08-10 17:47:28 +00:00
exit 1
fi
2023-08-11 12:35:10 +00:00
if [ "$target_os" = "linux" ]; then
echo "* Compiling: linux ..."
2023-08-11 12:41:11 +00:00
CC="${CC:=gcc}"
2023-08-11 12:35:10 +00:00
./lua_translate
2023-08-12 04:23:49 +00:00
"$CC" -std=gnu89 src/main.c -g -lSDL2 -llua5.3 -lm -o engine -O3 -Werror -Wall $CFLAGS
2023-08-11 12:35:10 +00:00
exit
fi
if [ "$target_os" = "openbsd" ]; then
echo "* Compiling: openbsd ..."
2023-08-11 12:41:11 +00:00
CC="${CC:=egcc}"
2023-08-11 12:35:10 +00:00
./lua_translate
2023-08-12 04:23:49 +00:00
"$CC" -std=gnu89 src/main.c -g -lSDL2 -llua5.3 -lm -o engine -O3 -Werror -Wall -I /usr/local/include $CFLAGS
2023-08-11 12:35:10 +00:00
exit
fi
printf "Unsupported platform. These platforms are currently available:\n* linux\n* openbsd\n"
exit 1