woweb-poc/Makefile

42 lines
925 B
Makefile
Raw Normal View History

2023-03-09 09:36:11 +00:00
WASM_PKG_DIR = dist_text_js/pkg
ASSET_DIR = woweb/assets
WASM_JS = dist_text_js.js
WASM_BG = dist_text_js_bg.wasm
WASM_JS_PKG = $(WASM_PKG_DIR)/$(WASM_JS)
WASM_BG_PKG = $(WASM_PKG_DIR)/$(WASM_BG)
WASM_JS_ASSET = $(ASSET_DIR)/$(WASM_JS)
WASM_BG_ASSET = $(ASSET_DIR)/$(WASM_BG)
DIST_DIR = dist
2023-03-09 09:57:25 +00:00
.PHONY: default all check wasm serve clean
2023-03-09 09:36:11 +00:00
default: all
all: wasm
wasm: $(WASM_JS_ASSET) $(WASM_BG_ASSET)
$(WASM_JS_ASSET) $(WASM_BG_ASSET): dist_text_js/src/lib.rs
cd dist_text_js; \
wasm-pack build --target web --release --no-typescript
cp $(WASM_JS_PKG) $(WASM_JS_ASSET)
cp $(WASM_BG_PKG) $(WASM_BG_ASSET)
2023-03-09 09:57:25 +00:00
check:
cargo deny check
2023-03-09 09:36:11 +00:00
serve: wasm
cargo run --package woweb
release: $(DIST_DIR) wasm
cargo build --package woweb --release
cp target/release/woweb $(DIST_DIR)
cp -r $(ASSET_DIR) $(DIST_DIR)
$(DIST_DIR):
mkdir -p $(DIST_DIR)
clean:
cargo clean
rm -rf $(WASM_PKG_DIR)
rm -f $(ASSET_DIR)/dist_text*