-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
53 lines (44 loc) · 1.18 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Makefile for building and running WASM projects
# General settings
WASM_DIR := crates/lora-inspector-wasm
OUT_DIR := pkg
# TARGET := --target bundler
TARGET := --target web
# RELEASE := --release
RELEASE :=
# WEAK_REFS := --weak-refs
WEAK_REFS :=
# Default target
.PHONY: all
all: test build-wasm build-frontend
# Run tests for the whole workspace
.PHONY: test
test:
cargo test --workspace && \
make wasm-bindgen-test && \
yarn --cwd $(WASM_DIR) test && \
yarn --cwd $(WASM_DIR) e2e-test
# Build WASM for production (optimized)
.PHONY: build-wasm
build-wasm:
wasm-pack build $(TARGET) --out-dir $(OUT_DIR) $(WASM_DIR) $(RELEASE) $(WEAK_REFS)
.PHONY: build-frontend
build-frontend:
yarn --cwd $(WASM_DIR) build
# Start a local HTTP server for serving the WASM package (simple)
.PHONY: dev-wasm
dev-wasm:
make build-wasm && \
cd $(WASM_DIR) && \
yarn vite
# Start a custom server (e.g., with CORS enabled) for development
.PHONY: dev-wasm-cors
dev-wasm-cors:
cd $(WASM_DIR) && python simple-cors-server.py
.PHONY:
wasm-bindgen-test:
wasm-pack test --headless --firefox crates/lora-inspector-wasm
# Clean build artifacts (optional)
.PHONY: clean
clean:
rm -rf $(OUT_DIR)/*