Make engine dep-free/standalone and add Wasm target

This commit is contained in:
2025-12-19 04:01:32 +01:00
parent 509f58a379
commit 02b1ca4cfe
10 changed files with 1264 additions and 392 deletions

View File

@@ -2,13 +2,17 @@
BUILD ?= debug
CC := clang
CFLAGS.gcc.release := -O3
CFLAGS.gcc.debug := -ggdb -O0 -fsanitize=address
CFLAGS.gcc := -std=c23 -Wall -Wextra -Wconversion -Wno-unused-function
CFLAGS.gcc.release := -Ofast
CFLAGS.gcc.debug := -ggdb -O0 -fsanitize=address
CFLAGS.clang.release := -O3
CFLAGS.clang.debug := -ggdb -O0 -fsanitize=address
CFLAGS.clang := -std=c23 -Wall -Wextra -Wconversion -Wno-unused-function -Wimplicit-int-conversion
CFLAGS.clang.release := -Ofast
CFLAGS.clang.debug := -ggdb -O0 -fsanitize=address
CFLAGS.clang.wasm := \
--target=wasm32-unknown-unknown -O3 -nostdlib \
-Wl,--export-all \
-Wl,--no-entry
CFLAGS := $(CFLAGS.$(CC)) $(CFLAGS.$(CC).$(BUILD))
@@ -17,6 +21,9 @@ all: tests
codegen: codegen.c
$(CC) -o $@ $(CFLAGS) $^
wasm: wasm-compat.c
$(CC) -DWASM -o chess.wasm wasm-compat.c $(CFLAGS.$(CC)) $(CFLAGS.$(CC).wasm)
mbb_rook.h: codegen
./codegen