miden-crypto/Makefile
MakefileRaw
1.DEFAULT_GOAL := help
2
3.PHONY: help
4help:
5 @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
6
7# -- variables --------------------------------------------------------------------------------------
8
9WARNINGS=RUSTDOCFLAGS="-D warnings"
10DEBUG_OVERFLOW_INFO=RUSTFLAGS="-C debug-assertions -C overflow-checks -C debuginfo=2"
11
12# -- linting --------------------------------------------------------------------------------------
13
14.PHONY: clippy
15clippy: ## Run Clippy with configs
16 $(WARNINGS) cargo +nightly clippy --workspace --all-targets --all-features
17
18
19.PHONY: fix
20fix: ## Run Fix with configs
21 cargo +nightly fix --allow-staged --allow-dirty --all-targets --all-features
22
23
24.PHONY: format
25format: ## Run Format using nightly toolchain
26 cargo +nightly fmt --all
27
28
29.PHONY: format-check
30format-check: ## Run Format using nightly toolchain but only in check mode
31 cargo +nightly fmt --all --check
32
33
34.PHONY: lint
35lint: format fix clippy ## Run all linting tasks at once (Clippy, fixing, formatting)
36
37# --- docs ----------------------------------------------------------------------------------------
38
39.PHONY: doc
40doc: ## Generate and check documentation
41 $(WARNINGS) cargo doc --all-features --keep-going --release
42
43# --- testing -------------------------------------------------------------------------------------
44
45.PHONY: test-default
46test-default: ## Run tests with default features
47 $(DEBUG_OVERFLOW_INFO) cargo nextest run --profile default --release --all-features
48
49.PHONY: test-smt-hashmaps
50test-smt-hashmaps: ## Run tests with `smt_hashmaps` feature enabled
51 $(DEBUG_OVERFLOW_INFO) cargo nextest run --profile default --release --features smt_hashmaps
52
53.PHONY: test-no-std
54test-no-std: ## Run tests with `no-default-features` (std)
55 $(DEBUG_OVERFLOW_INFO) cargo nextest run --profile default --release --no-default-features
56
57
58.PHONY: test
59test: test-default test-smt-hashmaps test-no-std ## Run all tests
60
61# --- checking ------------------------------------------------------------------------------------
62
63.PHONY: check
64check: ## Check all targets and features for errors without code generation
65 cargo check --all-targets --all-features
66
67# --- building ------------------------------------------------------------------------------------
68
69.PHONY: build
70build: ## Build with default features enabled
71 cargo build --release
72
73.PHONY: build-no-std
74build-no-std: ## Build without the standard library
75 cargo build --release --no-default-features --target wasm32-unknown-unknown
76
77.PHONY: build-avx2
78build-avx2: ## Build with avx2 support
79 RUSTFLAGS="-C target-feature=+avx2" cargo build --release
80
81.PHONY: build-sve
82build-sve: ## Build with sve support
83 RUSTFLAGS="-C target-feature=+sve" cargo build --release
84
85# --- benchmarking --------------------------------------------------------------------------------
86
87.PHONY: bench
88bench: ## Run crypto benchmarks
89 cargo bench --features concurrent
90
91.PHONY: bench-smt-concurrent
92bench-smt-concurrent: ## Run SMT benchmarks with concurrent feature
93 cargo run --release --features concurrent,executable -- --size 1000000