diff options
| author | Raymaekers Luca <luca@spacehb.net> | 2025-10-01 16:53:49 +0200 |
|---|---|---|
| committer | Raymaekers Luca <luca@spacehb.net> | 2025-10-01 16:53:49 +0200 |
| commit | aadff4d1cf17cc23f6f38ab0da51baabfeb9f9d1 (patch) | |
| tree | f2755f80c5067ae97b667b4c5607d4502805d078 /code/build.sh | |
| parent | 4ea5261f32ec8acd4cdad7c364f57e6ebc86866a (diff) | |
checkpoint
Diffstat (limited to 'code/build.sh')
| -rwxr-xr-x | code/build.sh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/code/build.sh b/code/build.sh new file mode 100755 index 0000000..be1cbc2 --- /dev/null +++ b/code/build.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +ThisDir="$(dirname "$(readlink -f "$0")")" +cd "$ThisDir" + +mkdir -p ../build + +Mode="$1" +if [ "$Mode" != "release" ] +then + Mode="debug" +fi +>&2 printf 'Mode: %s\n' "$Mode" + +CompilerFlags=" +-fdiagnostics-absolute-paths +--target=wasm32 +-nostdlib +" + +WarningFlags=" +-Wall +-Wextra +-Wno-unused-variable +-Wno-unused-but-set-variable +-Wno-write-strings +-Wno-pointer-arith +-Wno-unused-parameter +-Wno-unused-function +" + +LinkerFlags=" +-Wl,--allow-undefined +-Wl,--no-entry +-Wl,--export-all +-Wl,--export=LogMessage +" + +if [ "$Mode" = "debug" ] +then + CompilerFlags="$CompilerFlags + -O0 + -g -g3 -ggdb + " +elif [ "$Mode" = "release" ] +then + CompilerFlags="$CompilerFlags + -O2 + " +fi + +printf 'game.c\n' +clang \ + $CompilerFlags \ + $WarningFlags \ + $LinkerFlags \ + -o ../build/game.wasm \ + game.c +printf 'index.html platform.js\n' +cp index.html platform.js ../build |
