summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 30 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..02714d0
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,30 @@
+.PHONY: web test dist clean realclean
+
+ASSETS_SRC = $(wildcard game/www/*)
+ASSETS_DST = $(patsubst game/www/%,dist/%,$(ASSETS_SRC))
+
+TEST_PORT ?= 8000
+
+IMAGE := dungeon_crawl_builder
+
+web: dist $(ASSETS_DST)
+
+test: web
+ cd dist && python3 -m http.server $(TEST_PORT)
+
+image:
+ docker build -t $(IMAGE) .
+
+dist:
+ docker run --rm -it -v .:/data -v ~/.cargo:/home/builder/.cargo $(IMAGE)
+ mkdir -p dist
+ cp ./target/wasm32-unknown-emscripten/release/game.{js,wasm} dist
+
+dist/%: game/www/%
+ cp -r $< $@
+
+clean:
+ rm -rf dist
+
+realclean: clean
+ cargo clean