Update
[anarch.git] / make.sh
blob2088cada9bcc0b6a4d2e5eb8331aafae0b3ab386
1 #!/bin/sh
3 # Optional helper build script for Anarch.
4 # by drummyfish, released under CC0 1.0, public domain
6 # usage:
8 # ./make.sh platform [compiler]
10 if [ $# -lt 1 ]; then
11 echo "need a parameter (sdl, pokitto, gb, emscripten, ...)"
12 exit 0
15 clear; clear;
17 C_FLAGS="-std=c99 -Wall -Wextra -pedantic -O3 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -o anarch"
19 COMPILER='g++'
21 if [ $# -eq 2 ]; then
22 COMPILER=$2
24 if [ $2 = "tcc" ]; then # you'll probably want to modify this
25 C_FLAGS="${C_FLAGS} -L/usr/lib/x86_64-linux-gnu/pulseaudio/
26 -I/home/tastyfish/git/tcc/tcc-0.9.27/include
27 -I/usr/lib/gcc/x86_64-linux-gnu/8/include/"
31 echo "compiling"
33 if [ $1 = "sdl" ]; then
34 # PC SDL build, requires:
35 # - g++
36 # - SDL2 (dev) package
38 SDL_FLAGS=`sdl2-config --cflags --libs --static-libs`
39 COMMAND="${COMPILER} ${C_FLAGS} main_sdl.c -I/usr/local/include ${SDL_FLAGS}"
41 echo ${COMMAND}
43 ${COMMAND}
44 elif [ $1 = "ncurses" ]; then
45 # ncurses build, requires:
46 # - libncurses-dev
48 COMMAND="${COMPILER} ${C_FLAGS} -lncurses main_ncurses.c"
50 echo ${COMMAND}
52 ${COMMAND}
53 elif [ $1 = "saf" ]; then
54 # SAF build using SDL, requires:
55 # - saf.h
56 # - SDL2 (dev) package
58 SDL_FLAGS=`sdl2-config --cflags --libs --static-libs`
59 COMMAND="${COMPILER} ${C_FLAGS} main_saf.c -I/usr/local/include ${SDL_FLAGS}"
61 echo ${COMMAND}
63 ${COMMAND}
64 elif [ $1 = "terminal" ]; then
65 # PC terminal build, requires:
66 # - g++
68 COMMAND="${COMPILER} ${C_FLAGS} main_terminal.c"
70 echo ${COMMAND}
72 ${COMMAND}
73 elif [ $1 = "csfml" ]; then
74 # csfml build, requires:
75 # - csfml
77 COMMAND="${COMPILER} ${C_FLAGS} main_csfml.c -lcsfml-graphics -lcsfml-window -lcsfml-system -lcsfml-audio"
79 echo ${COMMAND}
81 ${COMMAND}
82 elif [ $1 = "test" ]; then
83 # test build, requires:
84 # - g++
86 COMMAND="${COMPILER} ${C_FLAGS} main_test.c"
88 echo ${COMMAND}
90 ${COMMAND}
91 elif [ $1 = "pokitto" ]; then
92 # Pokitto build, requires:
93 # - PokittoLib, in this folder create a symlink named "PokittoLib" to the
94 # "Pokitto" subfolder of PokittoLib
95 # - Pokitto Makefile
96 # - GNU embedded toolchain, in this folder create a symlink named "gtc" to the
97 # "bin" subfolder
98 # - files like My_settings.h required by Pokitto
100 make
101 ./PokittoEmu BUILD/firmware.bin
102 elif [ $1 = "emscripten" ]; then
103 # emscripten (browser Javascript) build, requires:
104 # - emscripten
106 ../emsdk/upstream/emscripten/emcc ./main_sdl.c -s USE_SDL=2 -O3 -lopenal --shell-file HTMLshell.html -o anarch.html -s EXPORTED_FUNCTIONS='["_main","_webButton"]' -s EXPORTED_RUNTIME_METHODS='["ccall","cwrap"]'
107 else
108 echo "unknown parameter: $1"