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
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 91e037b8..fe016f30 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)
+ $^
--
2.53.0