39 lines
893 B
Makefile
39 lines
893 B
Makefile
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*
|