-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (83 loc) · 2.86 KB
/
Makefile
File metadata and controls
104 lines (83 loc) · 2.86 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
.PHONY: all build build-wasm build-web dev run clean fmt lint cargo-check test check install help
# Directories
CORE_DIR := core
WEB_DIR := web
WASM_OUT := $(WEB_DIR)/public/wasm
## Default: build everything
all: build
## Build WASM + web
build: build-wasm build-web
## Compile Rust → WASM (release)
build-wasm:
cd $(CORE_DIR) && wasm-pack build --target web --out-dir ../$(WASM_OUT) --release
## Compile Rust → WASM (debug, faster incremental builds)
build-wasm-dev:
cd $(CORE_DIR) && wasm-pack build --target web --out-dir ../$(WASM_OUT) --dev
## Build Next.js for production
build-web:
cd $(WEB_DIR) && npm run build
## Start Next.js dev server (builds WASM in dev mode first)
dev: build-wasm-dev
cd $(WEB_DIR) && npm run dev
## Build optimized WASM then start dev server (best performance)
run: build-wasm
cd $(WEB_DIR) && npm run dev
## Install all dependencies
install:
cd $(WEB_DIR) && npm install
## Run Rust unit tests
test-core:
cd $(CORE_DIR) && cargo test
## Run Next.js tests (if configured)
test-web:
cd $(WEB_DIR) && npm test --if-present
## Run all tests
test: test-core test-web
## Format Rust code
fmt:
cd $(CORE_DIR) && cargo fmt
## Check Rust formatting without writing
fmt-check:
cd $(CORE_DIR) && cargo fmt -- --check
## Fast compile check for both native and WASM targets
cargo-check:
cd $(CORE_DIR) && cargo check
cd $(CORE_DIR) && cargo check --target wasm32-unknown-unknown
## Lint Rust code
lint:
cd $(CORE_DIR) && cargo clippy -- -D warnings
## Type-check TypeScript
typecheck:
cd $(WEB_DIR) && npx tsc --noEmit
## Run all checks (CI-friendly)
check: fmt-check cargo-check lint typecheck test-core
## Remove build artifacts
clean:
cd $(CORE_DIR) && cargo clean
rm -rf $(WASM_OUT)
cd $(WEB_DIR) && rm -rf .next out
## Full clean including node_modules
clean-all: clean
cd $(WEB_DIR) && rm -rf node_modules
help:
@echo "Usage: make <target>"
@echo ""
@echo " all Build WASM + web (default)"
@echo " build Same as all"
@echo " build-wasm Build Rust core → WASM (release)"
@echo " build-wasm-dev Build Rust core → WASM (debug)"
@echo " build-web Build Next.js production bundle"
@echo " dev Build WASM (debug) then start Next.js dev server"
@echo " run Build WASM (release + wasm-opt) then start dev server"
@echo " install Install npm dependencies"
@echo " test Run all tests"
@echo " test-core Run Rust unit tests"
@echo " test-web Run Next.js tests"
@echo " fmt Format Rust code"
@echo " fmt-check Check Rust formatting"
@echo " cargo-check Fast compile check (no codegen)"
@echo " lint Run cargo clippy"
@echo " typecheck TypeScript type check"
@echo " check Run all checks (CI)"
@echo " clean Remove build artifacts"
@echo " clean-all Remove build artifacts + node_modules"