ai-code-battle/wasm/Makefile
jedarden 6715c4b04b feat(wasm): add Go WASM engine build per plan §11.2, §13.1
- Create wasm/engine/ with main_wasm.go exporting loadState, step, runMatch,
  getReplay, getBots, getEnergy, getConfig, getState functions for browser
  sandbox use
- Add engine/wasm.go with Match type providing WASM-friendly interface
- Add wasm/engine/build.sh for GOOS=js GOARCH=wasm compilation
- Update wasm/Makefile to include engine target
- Successfully builds engine.wasm (~5.6 MB) with valid WASM magic number

The engine WASM enables production-accurate match execution in the browser
sandbox per plan §13.1. Build artifacts (.wasm files) are gitignored and
generated on-demand.

Closes: bf-1wew

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 17:31:25 -04:00

50 lines
1.5 KiB
Makefile

# Makefile for building all WASM artifacts per plan §11.2
# Builds: engine.wasm, gatherer.wasm, rusher.wasm, swarm.wasm, random.wasm, guardian.wasm, hunter.wasm
.PHONY: all clean engine gatherer rusher swarm random guardian hunter
all: engine gatherer rusher swarm random guardian hunter
@echo "All WASM artifacts built successfully"
@ls -lh dist/
engine:
@echo "Building engine.wasm..."
cd engine && bash build.sh
gatherer:
@echo "Building gatherer.wasm..."
cd bots/gatherer && ./build.sh
rusher:
@echo "Building rusher.wasm..."
cd bots/rusher && wasm-pack build --target web --out-dir ../../dist/rusher
cp dist/rusher/rusher_wasm_bg.wasm dist/rusher.wasm 2>/dev/null || true
# Try alternate output paths
@if [ -f dist/rusher/rusher_wasm_bg.wasm ]; then \
cp dist/rusher/rusher_wasm_bg.wasm dist/rusher.wasm; \
elif [ -f dist/rusher/rusher_wasm.wasm ]; then \
cp dist/rusher/rusher_wasm.wasm dist/rusher.wasm; \
elif [ -f target/wasm32-unknown-unknown/release/rusher_wasm.wasm ]; then \
cp target/wasm32-unknown-unknown/release/rusher_wasm.wasm dist/rusher.wasm; \
fi
swarm:
@echo "Building swarm.wasm..."
cd bots/swarm && ./build.sh
random:
@echo "Building random.wasm..."
cd bots/random && ./build.sh
guardian:
@echo "Building guardian.wasm..."
cd bots/guardian && ./build.sh
hunter:
@echo "Building hunter.wasm..."
cd bots/hunter && ./build.sh
clean:
@echo "Cleaning WASM build artifacts..."
rm -rf dist/rusher dist/swarm
rm -f dist/*.wasm