summaryrefslogtreecommitdiff
path: root/code/build.sh
diff options
context:
space:
mode:
authorRaymaekers Luca <luca@spacehb.net>2025-10-03 02:05:42 +0200
committerRaymaekers Luca <luca@spacehb.net>2025-10-03 02:05:42 +0200
commit732e6a47ded496cd224e1cfadc2106b04dcf6859 (patch)
tree3ff22b5a6808e0970f8b94b15d162df2054078d9 /code/build.sh
parent449514853850adca190d7eba679f386c024aa929 (diff)
checkpoint
Diffstat (limited to 'code/build.sh')
-rwxr-xr-xcode/build.sh25
1 files changed, 18 insertions, 7 deletions
diff --git a/code/build.sh b/code/build.sh
index ed819b6..dd02a94 100755
--- a/code/build.sh
+++ b/code/build.sh
@@ -28,11 +28,17 @@ WarningFlags="
-Wno-null-dereference
"
-LinkerFlags="
+WasmCompilerFlags="
+-nostdlib
+-mbulk-memory
+--target=wasm32
+"
+WasmLinkerFlags="
-Wl,--allow-undefined
-Wl,--no-entry
-Wl,--export-all
-Wl,--export=LogMessage
+-Wl,-z,stack-size=$((64 * 1024))
"
if [ "$Mode" = "debug" ]
@@ -44,21 +50,26 @@ then
elif [ "$Mode" = "release" ]
then
CompilerFlags="$CompilerFlags
- -O2
+ -O3
+ "
+ WasmCompilerFlags="$WasmCompilerFlags
+ -flto
+ "
+ WasmLinkerFlags="$WasmLinkerFlags
+ -Wl,--lto-O3
"
fi
printf 'game.c\n'
clang \
$CompilerFlags \
- -nostdlib \
- -mbulk-memory --target=wasm32 \
+ $WasmCompilerFlags $WasmLinkerFlags \
$WarningFlags \
- $LinkerFlags \
-o ../build/game.wasm \
game.c
-printf 'index.html platform.js\n'
+printf 'index.html platform.js favicon.ico\n'
ln -f index.html platform.js ../build
+cp ../data/favicon.ico ../build
if false
then
@@ -72,4 +83,4 @@ then
ws.c
fi
-printf '%s\n' "update" | websocat 'ws://localhost:1234/' \ No newline at end of file
+printf '%s\n' "update" | websocat 'ws://localhost:1234/'