Skip to content

Commit d886199

Browse files
dannywillemsclaude
andcommitted
refactor(Makefile): move .PHONY before each target
Move each .PHONY declaration to immediately precede its corresponding target for better readability and maintainability. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent dc7fbf2 commit d886199

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

Makefile

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,13 @@ WORKSPACE_FEATURES = \
6262
poly-commitment/ocaml_types
6363

6464
# Default target
65+
.PHONY: all
6566
all: release
6667

68+
.PHONY: setup
6769
setup: setup-git setup-wasm-toolchain
6870

71+
.PHONY: setup-git
6972
setup-git:
7073
@echo ""
7174
@echo "Syncing the Git submodules."
@@ -75,6 +78,7 @@ setup-git:
7578
@echo ""
7679
@echo "Git submodules synced."
7780

81+
.PHONY: setup-wasm-toolchain
7882
setup-wasm-toolchain:
7983
@ARCH=$$(uname -m); \
8084
OS=$$(uname -s | tr A-Z a-z); \
@@ -96,6 +100,7 @@ setup-wasm-toolchain:
96100
# https://nexte.st/book/pre-built-binaries.html#using-nextest-in-github-actions
97101
# FIXME: update to 0.9.68 when we get rid of 1.71 and 1.72.
98102
# FIXME: latest 0.8.19+ requires rustc 1.74+
103+
.PHONY: install-test-deps
99104
install-test-deps: ## Install test dependencies
100105
@echo ""
101106
@echo "Installing the test dependencies."
@@ -107,90 +112,100 @@ install-test-deps: ## Install test dependencies
107112
@echo "Test dependencies installed."
108113
@echo ""
109114

110-
115+
.PHONY: clean
111116
clean: ## Clean the project
112117
@cargo clean
113118
@rm -rf $(O1VM_RISCV32IM_BIN_FILES)
114119
@rm -rf $(O1VM_MIPS_BIN_DIR)
115120

116-
121+
.PHONY: build
117122
build: ## Build the project
118123
cargo build --all-targets --features "$(WORKSPACE_FEATURES)" --workspace \
119124
--exclude plonk_wasm --exclude plonk_wasm --exclude xtask
120125

121-
126+
.PHONY: release
122127
release: ## Build the project in release mode
123128
cargo build --release --all-targets --features "$(WORKSPACE_FEATURES)" \
124129
--workspace --exclude plonk_neon --exclude plonk_wasm --exclude xtask
125130

126-
131+
.PHONY: test-doc
127132
test-doc: ## Test the project's docs comments
128133
cargo test --features "$(WORKSPACE_FEATURES)" --release --doc
129134

135+
.PHONY: test-doc-with-coverage
130136
test-doc-with-coverage:
131137
$(COVERAGE_ENV) $(MAKE) test-doc
132138

133-
139+
.PHONY: test
134140
test: ## Test the project with non-heavy tests and using native cargo test runner
135141
cargo test --features "$(WORKSPACE_FEATURES)" --release $(CARGO_EXTRA_ARGS) \
136142
-- --nocapture --skip heavy $(BIN_EXTRA_ARGS)
137143

144+
.PHONY: test-with-coverage
138145
test-with-coverage:
139146
$(COVERAGE_ENV) CARGO_EXTRA_ARGS="$(CARGO_EXTRA_ARGS)" BIN_EXTRA_ARGS="$(BIN_EXTRA_ARGS)" $(MAKE) test
140147

141-
148+
.PHONY: test-heavy
142149
test-heavy: ## Test the project with heavy tests and using native cargo test runner
143150
cargo test --features "$(WORKSPACE_FEATURES)" --release $(CARGO_EXTRA_ARGS) \
144151
-- --nocapture heavy $(BIN_EXTRA_ARGS)
145152

153+
.PHONY: test-heavy-with-coverage
146154
test-heavy-with-coverage:
147155
$(COVERAGE_ENV) CARGO_EXTRA_ARGS="$(CARGO_EXTRA_ARGS)" BIN_EXTRA_ARGS="$(BIN_EXTRA_ARGS)" $(MAKE) test-heavy
148156

149-
157+
.PHONY: test-all
150158
test-all: ## Test the project with all tests and using native cargo test runner
151159
cargo test --features "$(WORKSPACE_FEATURES)" --release $(CARGO_EXTRA_ARGS) \
152160
-- --nocapture $(BIN_EXTRA_ARGS)
153161

162+
.PHONY: test-all-with-coverage
154163
test-all-with-coverage:
155164
$(COVERAGE_ENV) CARGO_EXTRA_ARGS="$(CARGO_EXTRA_ARGS)" BIN_EXTRA_ARGS="$(BIN_EXTRA_ARGS)" $(MAKE) test-all
156165

157-
166+
.PHONY: nextest
158167
nextest: ## Test the project with non-heavy tests and using nextest test runner
159168
cargo nextest run --all --features "$(WORKSPACE_FEATURES)" --exclude xtask \
160169
--release $(CARGO_EXTRA_ARGS) --profile ci -E "not test(heavy)" $(BIN_EXTRA_ARGS)
161170

171+
.PHONY: nextest-with-coverage
162172
nextest-with-coverage:
163173
$(COVERAGE_ENV) CARGO_EXTRA_ARGS="$(CARGO_EXTRA_ARGS)" BIN_EXTRA_ARGS="$(BIN_EXTRA_ARGS)" $(MAKE) nextest
164174

165-
175+
.PHONY: nextest-heavy
166176
nextest-heavy: ## Test the project with heavy tests and using nextest test runner
167177
cargo nextest run --features "$(WORKSPACE_FEATURES)" --release $(CARGO_EXTRA_ARGS) \
168178
--profile ci -E "test(heavy)" $(BIN_EXTRA_ARGS)
169179

180+
.PHONY: nextest-heavy-with-coverage
170181
nextest-heavy-with-coverage:
171182
$(COVERAGE_ENV) CARGO_EXTRA_ARGS="$(CARGO_EXTRA_ARGS)" BIN_EXTRA_ARGS="$(BIN_EXTRA_ARGS)" $(MAKE) nextest-heavy
172183

173-
184+
.PHONY: nextest-all
174185
nextest-all: ## Test the project with all tests and using nextest test runner
175186
cargo nextest run --features "$(WORKSPACE_FEATURES)" --release $(CARGO_EXTRA_ARGS) \
176187
--profile ci $(BIN_EXTRA_ARGS)
177188

189+
.PHONY: nextest-all-with-coverage
178190
nextest-all-with-coverage:
179191
$(COVERAGE_ENV) CARGO_EXTRA_ARGS="$(CARGO_EXTRA_ARGS)" BIN_EXTRA_ARGS="$(BIN_EXTRA_ARGS)" $(MAKE) nextest-all
180192

181-
193+
.PHONY: check-format
182194
check-format: ## Check the code formatting
183195
cargo +nightly fmt -- --check
184196
taplo fmt --check
185197

198+
.PHONY: format
186199
format: ## Format the code
187200
cargo +nightly fmt
188201
taplo fmt
189202

203+
.PHONY: lint
190204
lint: ## Lint the code
191205
cargo clippy --all --features "$(WORKSPACE_FEATURES)" --all-targets --tests \
192206
$(CARGO_EXTRA_ARGS) -- -W clippy::all -D warnings
193207

208+
.PHONY: generate-test-coverage-report
194209
generate-test-coverage-report: ## Generate the code coverage report
195210
@echo ""
196211
@echo "Generating the test coverage report."
@@ -205,6 +220,7 @@ generate-test-coverage-report: ## Generate the code coverage report
205220
@echo "The test coverage report is available at: ./target/coverage"
206221
@echo ""
207222

223+
.PHONY: generate-doc
208224
generate-doc: ## Generate the Rust documentation
209225
@echo ""
210226
@echo "Generating the documentation."
@@ -215,6 +231,7 @@ generate-doc: ## Generate the Rust documentation
215231
@echo "The documentation is available at: ./target/doc"
216232
@echo ""
217233

234+
.PHONY: generate-doc-index
218235
generate-doc-index: ## Generate Rust docs with index page (requires nightly)
219236
@echo ""
220237
@echo "Generating the documentation with index page."
@@ -226,10 +243,11 @@ generate-doc-index: ## Generate Rust docs with index page (requires nightly)
226243
@echo "The documentation is available at: ./target/doc"
227244
@echo ""
228245

246+
.PHONY: help
229247
help: ## Ask for help!
230248
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
231249

232-
250+
.PHONY: setup-riscv32-toolchain
233251
setup-riscv32-toolchain: ## Download and compile the RISC-V 32bits toolchain
234252
@echo ""
235253
@echo "Setting up the RISC-V 32-bit toolchain"
@@ -243,6 +261,7 @@ setup-riscv32-toolchain: ## Download and compile the RISC-V 32bits toolchain
243261
@echo "RISC-V 32-bits toolchain is ready in ${RISCV32_TOOLCHAIN_PATH}/build"
244262
@echo ""
245263

264+
.PHONY: build-riscv32-programs
246265
build-riscv32-programs: setup-riscv32-toolchain ${O1VM_RISCV32IM_BIN_FILES} ## Build all RISC-V 32 bits programs written for the o1vm
247266

248267
${O1VM_RISCV32IM_BIN_DIR}/%.o: ${O1VM_RISCV32IM_SOURCE_DIR}/%.S
@@ -254,6 +273,7 @@ ${O1VM_RISCV32IM_BIN_DIR}/%.o: ${O1VM_RISCV32IM_SOURCE_DIR}/%.S
254273
${RISCV32_TOOLCHAIN_PATH}/build/bin/riscv32-unknown-elf-ld -s -o $(basename $@) $@
255274
@echo ""
256275

276+
.PHONY: build-mips-programs
257277
build-mips-programs: ${O1VM_MIPS_SOURCE_FILES} ${O1VM_MIPS_BIN_FILES} ## Build all MIPS programs written for the o1vm
258278

259279
${O1VM_MIPS_SOURCE_DIR}/%.asm: ${OPTIMISM_MIPS_SOURCE_DIR}/%.asm
@@ -278,6 +298,7 @@ ${O1VM_MIPS_BIN_DIR}/%.o: ${O1VM_MIPS_SOURCE_DIR}/%.asm
278298
@${MIPS_AS} -defsym big_endian=1 -march=mips32r2 -o $@ $<
279299
@${MIPS_LD} -s -o $(basename $@) $@
280300

301+
.PHONY: fclean
281302
fclean: clean ## Clean the tooling artefacts in addition to running clean
282303
rm -rf ${RISCV32_TOOLCHAIN_PATH}
283304

@@ -294,5 +315,3 @@ build-web: ## Compile the Kimchi library into WebAssembly to be used in the brow
294315
--target web \
295316
--out-dir ${PLONK_WASM_WEB_OUTDIR} \
296317
--rust-version $(NIGHTLY_RUST_VERSION)
297-
298-
.PHONY: all setup install-test-deps clean build release test-doc test-doc-with-coverage test test-with-coverage test-heavy test-heavy-with-coverage test-all test-all-with-coverage nextest nextest-with-coverage nextest-heavy nextest-heavy-with-coverage nextest-all nextest-all-with-coverage format lint generate-test-coverage-report generate-doc generate-doc-index setup-riscv32-toolchain help fclean build-riscv32-programs build-mips-programs check-format

0 commit comments

Comments
 (0)