forked from 0xMiden/p3-miden
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
118 lines (86 loc) · 4.02 KB
/
Makefile
File metadata and controls
118 lines (86 loc) · 4.02 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# -- variables --------------------------------------------------------------------------------------
WARNINGS=RUSTDOCFLAGS="-D warnings"
# -- linting --------------------------------------------------------------------------------------
.PHONY: clippy
clippy: ## Run Clippy with configs
cargo clippy --workspace --all-targets --all-features -- -D warnings
.PHONY: fix
fix: ## Run Fix with configs
cargo +nightly fix --allow-staged --allow-dirty --all-targets --all-features
.PHONY: format
format: ## Run Format using nightly toolchain
cargo +nightly fmt --all
.PHONY: format-check
format-check: ## Run Format using nightly toolchain but only in check mode
cargo +nightly fmt --all --check
.PHONY: machete
machete: ## Runs machete to find unused dependencies
cargo machete
.PHONY: toml
toml: ## Runs Format for all TOML files
taplo fmt
.PHONY: toml-check
toml-check: ## Runs Format for all TOML files but only in check mode
taplo fmt --check --verbose
.PHONY: typos-check
typos-check: ## Runs spellchecker
typos
.PHONY: lint
lint: format fix clippy toml typos-check ## Run all linting tasks at once
# --- docs ----------------------------------------------------------------------------------------
.PHONY: doc
doc: ## Generate and check documentation
$(WARNINGS) cargo doc --all-features --keep-going --release
# --- testing -------------------------------------------------------------------------------------
.PHONY: test
test: ## Run tests with default features
cargo test --workspace
.PHONY: test-parallel
test-parallel: ## Run tests with parallel feature
cargo test --workspace --features parallel
.PHONY: test-release
test-release: ## Run tests in release mode
cargo test --workspace --profile test-release
.PHONY: test-all
test-all: test test-parallel ## Run all test variants
# --- checking ------------------------------------------------------------------------------------
.PHONY: check
check: ## Check all targets and features for errors without code generation
cargo check --all-targets --all-features
# --- building ------------------------------------------------------------------------------------
.PHONY: build
build: ## Build with release profile
cargo build --release
.PHONY: build-no-std
build-no-std: ## Build without the standard library (for embedded targets)
cargo build --release --no-default-features --target wasm32-unknown-unknown
.PHONY: build-avx2
build-avx2: ## Build with avx2 support
RUSTFLAGS="-C target-feature=+avx2" cargo build --release
.PHONY: build-avx512
build-avx512: ## Build with avx512 support
RUSTFLAGS="-C target-feature=+avx512f,+avx512dq" cargo build --release
# --- benchmarking --------------------------------------------------------------------------------
.PHONY: bench
bench: ## Run benchmarks
cargo bench
# --- installing ----------------------------------------------------------------------------------
.PHONY: check-tools
check-tools: ## Checks if development tools are installed
@echo "Checking development tools..."
@command -v typos >/dev/null 2>&1 && echo "[OK] typos is installed" || echo "[MISSING] typos is not installed (run: make install-tools)"
@command -v cargo nextest >/dev/null 2>&1 && echo "[OK] nextest is installed" || echo "[MISSING] nextest is not installed (run: make install-tools)"
@command -v taplo >/dev/null 2>&1 && echo "[OK] taplo is installed" || echo "[MISSING] taplo is not installed (run: make install-tools)"
@command -v cargo machete >/dev/null 2>&1 && echo "[OK] machete is installed" || echo "[MISSING] machete is not installed (run: make install-tools)"
.PHONY: install-tools
install-tools: ## Installs development tools required by the Makefile
@echo "Installing development tools..."
cargo install typos-cli --locked
cargo install cargo-nextest --locked
cargo install taplo-cli --locked
cargo install cargo-machete --locked
@echo "Development tools installation complete!"