remove deadlock in build system

This commit is contained in:
Sebastian Hugentobler 2023-03-09 10:36:11 +01:00
parent 939201fedb
commit 9c5cd5f4da
Signed by: shu
GPG key ID: BB32CF3CA052C2F0
16 changed files with 84 additions and 102 deletions

38
Makefile Normal file
View file

@ -0,0 +1,38 @@
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
.PHONY: default all wasm serve clean
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)
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*