From c61ecdf1cb936a0e236e23144c69c0a8cbc2797b Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flow@cs.fau.de>
Date: Fri, 20 Aug 2021 14:06:14 +0200
Subject: [PATCH] [Makefile] Make static-analysis depend on iwyu

The ninja 'iwyu' target does not depend nor generates
compile_commands_wo_subprojects/compile_commands.json. Hence iwyu
would fail if the database is not yet generated or run with an
outdated compile_commands.json.

Instead of iwyu being added to STATIC_ANALYSIS_NINJA_TARGETS, we now
have the static-analysis make target depend on iwyu. This ensures that
compile_commands_wo_subprojects/compile_commands.json is generated or
updated (if required) before iwyu is run.p
---
 Makefile | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index f3e0357d..14cd8430 100644
--- a/Makefile
+++ b/Makefile
@@ -34,8 +34,6 @@ debug:
 	rm -f build
 	$(MAKE) build BUILDTYPE=$@
 
-STATIC_ANALYSIS_NINJA_TARGETS += iwyu
-
 # Meson >= 0.52 will automatically generate a clang-tidy target if a
 # .clang-tidy file is found.
 # Source version check: https://stackoverflow.com/a/3732456/194894
@@ -49,7 +47,7 @@ endif
 fast-static-analysis: all check-format check-license doc
 
 .PHONY: static-analysis
-static-analysis: fast-static-analysis
+static-analysis: fast-static-analysis iwyu
 	$(NINJA) -C build $(STATIC_ANALYSIS_NINJA_TARGETS)
 
 .PHONY: smoke-test-suite
-- 
GitLab