From 5275a760ffaa83aad9b8501ca2f33818a20db4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Szara=C5=84ski?= Date: Tue, 9 Apr 2024 14:10:13 +0200 Subject: [PATCH] Move .PHONY next to each target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's clearer to keep target and it's .PHONY together. When reading Makefile it's easier to see if target is phony or not (without jumping back to first line and reading all of .PHONY dependencies). It's also harder to forget remove/rename .PHONY dependency when target is changed when they are together. There is no official standard but make documentation[1] in .DEFAULT_GOAL use multiple .PHONY: > .PHONY: foo > foo: ; @echo $@ > > $(warning default goal is $(.DEFAULT_GOAL)) > > # Reset the default goal. > .DEFAULT_GOAL := > > .PHONY: bar > bar: ; @echo $@ PR: https://github.com/alicebob/miniredis/issues/371 [1]: https://www.gnu.org/software/make/manual/html_node/Special-Variables.html Signed-off-by: Wojciech SzaraƄski --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6aa91d6..2b5ec3e 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,26 @@ -.PHONY: test testrace int ci clean help +.PHONY: test test: ### Run unit tests go test ./... +.PHONY: testrace testrace: ### Run unit tests with race detector go test -race ./... +.PHONY: int int: ### Run integration tests (doesn't download redis server) ${MAKE} -C integration int +.PHONY: ci ci: ### Run full tests suite (including download and compilation of proper redis server) ${MAKE} test ${MAKE} -C integration redis_src/redis-server int ${MAKE} testrace +.PHONY: clean clean: ### Clean integration test files and remove compiled redis from integration/redis_src ${MAKE} -C integration clean +.PHONY: help help: ifeq ($(UNAME), Linux) @grep -P '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \