From 744d6df27d6003346e7f1553d3712cc25e907933 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 16 Mar 2026 16:46:25 +1100 Subject: Makefile: Use $^ to avoid duplication in static checker rules Currently we duplicate the list of sources / headers to check in the dependency list for the clang-tidy and cppcheck rules, then again in the command itself. Since we already require GNU make, we can avoid this by using the special $^ symbol which expands to the full list of dependencies. Since clang-tidy only needs the .c files, not the headers listed, we remove the headers from the dependency list to make this work. Since these are phony targets that will always be rebuilt, that shouldn't have any side effects. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 91e037b..fe016f3 100644 --- a/Makefile +++ b/Makefile @@ -172,8 +172,8 @@ docs: README.md done < README.md; \ ) > README.plain.md -clang-tidy: $(PASST_SRCS) $(HEADERS) - clang-tidy $(PASST_SRCS) -- $(filter-out -pie,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) \ +clang-tidy: $(PASST_SRCS) + clang-tidy $^ -- $(filter-out -pie,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) \ -DCLANG_TIDY_58992 cppcheck: $(PASST_SRCS) $(HEADERS) @@ -189,4 +189,4 @@ cppcheck: $(PASST_SRCS) $(HEADERS) --suppress=missingIncludeSystem \ --suppress=unusedStructMember \ $(filter -D%,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) -D CPPCHECK_6936 \ - $(PASST_SRCS) $(HEADERS) + $^ -- cgit v1.2.3