anarch/make.sh

55 lines
1.3 KiB
Bash
Raw Normal View History

2020-09-11 14:24:41 -04:00
# Build script for Anarch.
# by drummyfish, released under CC0 1.0, public domain
2020-10-08 13:26:45 -04:00
#
# usage:
#
# ./make.sh platform [compiler]
2020-09-11 14:24:41 -04:00
2019-10-02 14:31:27 -04:00
#!/bin/bash
2020-10-08 13:26:45 -04:00
if [ $# -lt 1 ]; then
2020-09-26 19:24:41 -04:00
echo "need a parameter (sdl, pokitto, gb, emscripten, ...)"
2020-09-11 14:24:41 -04:00
exit 0
fi
clear; clear;
2020-10-05 14:15:04 -04:00
C_FLAGS='-x c -Wall -Wextra -fmax-errors=5 -pedantic -O3 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -o game'
2020-09-11 14:24:41 -04:00
2020-10-08 13:26:45 -04:00
COMPILER='g++'
if [ $# -eq 2 ]; then
COMPILER=$2
fi
2020-10-05 14:15:04 -04:00
if [ $1 == "sdl" ]; then
2020-09-11 14:24:41 -04:00
# PC SDL build, requires:
2020-09-26 19:24:41 -04:00
# - g++
2020-09-11 14:24:41 -04:00
# - SDL2 (dev) package
2020-10-08 13:26:45 -04:00
${COMPILER} ${C_FLAGS} main_sdl.c -lSDL2 2>&1 >/dev/null && ./game
2020-10-05 14:15:04 -04:00
elif [ $1 == "terminal" ]; then
# PC terminal build, requires:
# - g++
2020-09-11 14:24:41 -04:00
2020-10-08 13:26:45 -04:00
${COMPILER} ${C_FLAGS} main_terminal.c 2>&1 >/dev/null && ./game
2020-10-05 14:15:04 -04:00
elif [ $1 == "pokitto" ]; then
2020-09-11 14:24:41 -04:00
# Pokitto build, requires:
# - PokittoLib, in this folder create a symlink named "PokittoLib" to the
# "Pokitto" subfolder of PokittoLib
# - Pokitto Makefile
# - GNU embedded toolchain, in this folder create a symlink named "gtc" to the
# "bin" subfolder
# - files like My_settings.h required by Pokitto
make
./PokittoEmu BUILD/firmware.bin
2020-09-26 19:24:41 -04:00
elif [ $1 == "emscripten" ]; then
# emscripten (browser Javascript) build, requires:
# - emscripten
emcc ./main_sdl.c -s USE_SDL=2 -O3 -lopenal --shell-file HTMLshell.html -o game.html
2020-09-11 14:24:41 -04:00
else
echo "unknown parameter: $1"
fi