Licar/make.sh

70 lines
2.1 KiB
Bash
Raw Normal View History

2025-06-09 20:57:17 +02:00
#!/bin/sh
2023-08-08 20:39:29 +02:00
2025-04-29 20:29:31 +02:00
# Make script for Licar, just help run the compile command. Usage:
#
# ./make.sh [platform [compiler]]
2023-08-08 20:39:29 +02:00
clear
clear
2025-04-29 20:29:31 +02:00
echo "making Licar"
2025-06-12 21:35:05 +02:00
OPTIM="-O3"
2025-06-20 18:25:04 +02:00
2025-04-29 20:29:31 +02:00
C_FLAGS="-std=c99 -Wall -Wextra -pedantic $OPTIM -Wno-unused-parameter -Wno-missing-field-initializers -o licar"
COMPILER="g++"
PLATFORM="sdl"
if [ $# -gt 0 ]; then
PLATFORM="$1"
if [ $# -gt 1 ]; then
COMPILER="$2"
2025-06-23 20:38:56 +02:00
if [ $COMPILER = "tcc" ]; then # you'll probably want to modify this
C_FLAGS="${C_FLAGS} -L/usr/lib/x86_64-linux-gnu/pulseaudio/ -DSDL_DISABLE_IMMINTRIN_H"
2025-04-29 20:29:31 +02:00
fi
fi
fi
if [ $PLATFORM = "sdl" ]; then
2025-05-29 22:27:28 +02:00
# PC SDL build, requires: SDL2 (dev) package
# preferred, should support all features
2025-04-29 20:29:31 +02:00
SDL_FLAGS=`sdl2-config --cflags --libs`
2025-05-18 23:04:17 +02:00
COMMAND="${COMPILER} ${C_FLAGS} frontend_sdl.c -I/usr/local/include ${SDL_FLAGS}"
elif [ $PLATFORM = "csfml" ]; then
2025-05-29 22:27:28 +02:00
# PC CMFML build, requires: csfml (dev) package
# similar to SDL, should support all features
2025-05-18 23:04:17 +02:00
COMMAND="${COMPILER} ${C_FLAGS} frontend_csfml.c -lcsfml-graphics -lcsfml-window -lcsfml-system -lcsfml-audio"
2025-05-19 18:40:36 +02:00
elif [ $PLATFORM = "saf" ]; then
2025-05-29 22:27:28 +02:00
# SAF build, requires: saf.h, backend libraries (SDL2 by default)
# limited by SAF (low resoulution, few colors, no files, simple sound, ...)
2025-05-19 18:40:36 +02:00
SDL_FLAGS=`sdl2-config --cflags --libs`
COMMAND="${COMPILER} ${C_FLAGS} frontend_saf.c -lcsfml-graphics -I/use/local/include ${SDL_FLAGS}"
2025-05-23 15:46:24 +02:00
elif [ $PLATFORM = "test" ]; then
# autotest build
2025-05-29 22:27:28 +02:00
# unplayable, only serves for development
2025-05-23 15:46:24 +02:00
COMMAND="${COMPILER} ${C_FLAGS} frontend_test.c"
2025-05-29 22:27:28 +02:00
elif [ $PLATFORM = "x11" ]; then
# X11 build, requires: xlib
# has no sound
2025-06-23 04:11:56 +02:00
COMMAND="${COMPILER} ${C_FLAGS} frontend_x11.c -lX11"
2025-05-04 18:08:28 +02:00
elif [ $PLATFORM = "emscripten" ]; then
2025-05-29 22:27:28 +02:00
# emscripten (browser Javascript) build, requires: emscripten
# limited, low quality, no files
2025-05-19 18:40:36 +02:00
COMMAND="../emsdk/upstream/emscripten/emcc ./frontend_sdl.c -s USE_SDL=2 -O3 -lopenal --shell-file HTMLshell.html -o licar.html -s EXPORTED_FUNCTIONS='[\"_main\"]' -s EXPORTED_RUNTIME_METHODS='[\"ccall\",\"cwrap\"]'"
2025-05-04 18:08:28 +02:00
else
echo "unknown frontend"
2025-04-29 20:29:31 +02:00
fi
2025-05-18 23:04:17 +02:00
echo ${COMMAND}
eval ${COMMAND}
2025-06-20 18:25:04 +02:00
return $?