go-html/Makefile
Claude 456adce73b
build: add Makefile with WASM build target and size check
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 00:15:08 +00:00

22 lines
501 B
Makefile

.PHONY: wasm test clean
WASM_OUT := dist/go-html.wasm
test:
go test ./...
wasm: $(WASM_OUT)
$(WASM_OUT):
@mkdir -p dist
GOOS=js GOARCH=wasm go build -ldflags="-s -w" -o $(WASM_OUT) ./cmd/wasm/
@ls -lh $(WASM_OUT)
@SIZE=$$(stat -c%s "$(WASM_OUT)" 2>/dev/null || stat -f%z "$(WASM_OUT)"); \
if [ "$$SIZE" -gt 2097152 ]; then \
echo "WARNING: WASM binary exceeds 2MB target ($${SIZE} bytes)"; \
else \
echo "OK: WASM binary within 2MB target ($${SIZE} bytes)"; \
fi
clean:
rm -rf dist/