shithub: moonfish

Download patch

ref: 719f2caa37eaecaa233fe45fcb4ac990d1d9126f
parent: b4db6e43dc42ebaaa5e5c01a9f6aa8cc578ece60
author: zamfofex <zamfofex@twdb.moe>
date: Sun Jan 28 17:10:37 EST 2024

also compile to Wasm

--- a/.build.yml
+++ b/.build.yml
@@ -12,11 +12,15 @@
   - mingw-w64-gcc
   - curl
   - cjson-dev
+  - wasi-sdk
+  - clang
+  - lld
 tasks:
   - build: |
       cd moonfish
       make LDFLAGS=-static
       make LDFLAGS=-static CC=x86_64-w64-mingw32-gcc moonfish.exe
+      make LDFLAGS=-static CC='clang --target=wasm32-wasi-threads --sysroot=/usr/share/wasi-sysroot' moonfish.wasm
       ./minify.sh
   - deploy: |
       set +x
@@ -30,14 +34,14 @@
           -F analyse=@analyse \
           -F moonfish.sh=@moonfish.sh \
           -F moonfish.exe=@moonfish.exe \
+          -F moonfish.wasm=@moonfish.wasm \
           https://neocities.org/api/upload
       fi
 artifacts:
   - moonfish/moonfish
+  - moonfish/moonfish.sh
+  - moonfish/moonfish.exe
+  - moonfish/moonfish.wasm
   - moonfish/play
   - moonfish/lichess
   - moonfish/analyse
-  - moonfish/moonfish.sh
-  - moonfish/moonfish.exe
-  - moonfish/ugi-uci
-  - moonfish/uci-ugi
--- a/makefile
+++ b/makefile
@@ -17,17 +17,17 @@
 
 all: moonfish play lichess analyse uci-ugi ugi-uci
 
-moonfish moonfish.exe: moonfish.h chess.c search.c main.c
-	$(moonfish_cc) -o $@ $^
+moonfish moonfish.exe moonfish.wasm: moonfish.h chess.c search.c main.c
+	$(moonfish_cc) -o $@ $(filter %.c,$^)
 
 %: moonfish.h tools/tools.h tools/%.c tools/utils.c chess.c
-	$(or $($(@)_cc),$(tools_cc)) -o $@ $^ $($(@)_libs)
+	$(or $($(@)_cc),$(tools_cc)) -o $@ $(filter %.c,$^) $($(@)_libs)
 
 ugi-uci: moonfish.h tools/tools.h tools/ugi.h tools/utils.c tools/ugi.c tools/ugi-uci.c chess.c
-	$(tools_cc) -o $@ $^
+	$(tools_cc) -o $@ $(filter %.c,$^)
 
 uci-ugi: tools/tools.h tools/ugi.h tools/utils.c tools/ugi.c tools/uci-ugi.c
-	$(tools_cc) -o $@ $^
+	$(tools_cc) -o $@ $(filter %.c,$^)
 
 clean:
 	git clean -fdx
--