-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (45 loc) · 1.65 KB
/
Makefile
File metadata and controls
53 lines (45 loc) · 1.65 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
# Output directory for trunk build artifacts; override with DIST_DIR=<path> to
# change where serve, build, and clean write/read compiled assets.
DIST_DIR ?= dist
BUILD_TESTS ?=
RELEASE ?=
.PHONY: release
release: RELEASE := 1
release: build
.PHONY: serve
serve: build
# --dist $(DIST_DIR) overrides the dist_dir set in the trunk.toml
# it's useful for generating a different serving path
unset NO_COLOR && trunk serve --dist $(DIST_DIR)
.PHONY: build
build: install circuits-build wasm-witness
@echo "Building frontend with trunk..."
unset NO_COLOR && trunk build --dist $(DIST_DIR) $(if $(RELEASE),--release)
.PHONY: wasm-witness
wasm-witness: install
@echo "Building witness WASM module..."
@mkdir -p target/wasm-witness
wasm-pack build app/crates/witness \
--target web \
--out-name witness \
--out-dir ../../../target/wasm-witness \
--release
@rm -f target/wasm-witness/.gitignore target/wasm-witness/package.json 2>/dev/null || true
.PHONY: circuits-build
circuits-build:
@echo "Building circuits (this may take a while)..."
$(if $(BUILD_TESTS),BUILD_TESTS=$(BUILD_TESTS)) cargo build -p circuits $(if $(RELEASE),--release)
.PHONY: install
install:
@echo "Installing frontend dependencies..."
@npm install --prefix app
@rustup target add wasm32v1-none
@command -v trunk >/dev/null 2>&1 || cargo install trunk --locked
@command -v wasm-pack >/dev/null 2>&1 || cargo install wasm-pack --locked
.PHONY: clean
clean:
trunk clean --dist $(DIST_DIR)
cargo clean
.PHONY: doc
doc:
cp -r assets docs/src/assets && mdbook build docs/ && rm -rf docs/src/assets && cargo doc --no-deps --workspace && cp -r target/doc docs/book/api && open docs/book/index.html