From 064652034c988b5568196450330eeab97dd10280 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Tue, 18 Nov 2025 11:58:16 -0500 Subject: wasm: add build version/date --- Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 75f3d0d..1e34988 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ .PHONY: web test dist clean realclean -ASSETS_SRC = $(wildcard game/www/*) -ASSETS_DST = $(patsubst game/www/%,dist/%,$(ASSETS_SRC)) +ASSETS = $(wildcard game/www/*) TEST_PORT ?= 8000 @@ -13,7 +12,10 @@ EMCC_CFLAGS := -O3 \ -sGL_ENABLE_GET_PROC_ADDRESS=1 \ -sEXPORTED_RUNTIME_METHODS=HEAPF32,ccall,cwrap,callMain -web: dist $(ASSETS_DST) +BUILD_DATE := $(shell date) +BUILD_VERSION := $(shell cargo pkgid -p game | cut -d '#' -f2) + +web: dist test: web cd dist && python3 -m http.server $(TEST_PORT) @@ -26,9 +28,9 @@ dist: mkdir -p dist cp ./target/wasm32-unknown-emscripten/wasm/game.js dist/game.js cp ./target/wasm32-unknown-emscripten/wasm/game.wasm dist/game.wasm - -dist/%: game/www/% - cp -r $< $@ + cp $(ASSETS) dist/ + sed -i 's/BUILD_VERSION/$(BUILD_VERSION)/' dist/index.html + sed -i 's/BUILD_DATE/$(BUILD_DATE)/' dist/index.html clean: rm -rf dist -- cgit v1.2.3-freya