[PATCH 1/3] perf build: Build the Python extension before pylint consumers
From: Leo Yan
Date: Wed Sep 30 2026 - 05:07:13 EST
Pylint checks for tests and standalone Python scripts can run before the
perf Python extension is available. On a clean parallel build, an import
error can stop make before the extension is built.
When pylint is enabled, make the perf and perf-test sub-makes wait for the
enabled language bindings using an order-only dependency. The extension
does not depend on either consumer, so this does not introduce a cycle.
Fixes: 8a54784e708b ("perf build: Add pylint build tests")
Reported-by: Aishwarya TCV <aishwarya.tcv@xxxxxxx>
Assisted-by: Codex:gpt-6
Signed-off-by: Leo Yan <leo.yan@xxxxxxx>
---
tools/perf/Makefile.perf | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 0102c3468a0b79fb22966d8cbd8fa8525d2ff3ae..d350d085542c64fc6d0bed4c5d7d1daac51efa8b 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -578,6 +578,12 @@ strip: $(PROGRAMS) $(OUTPUT)perf
$(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
PERF_IN := $(OUTPUT)perf-in.o
+
+ifdef PYLINT
+# Build the Python extension before starting sub-makes that lint its users.
+$(PERF_IN) $(LIBPERF_TEST_IN): | $(LANG_BINDINGS)
+endif
+
export NO_JEVENTS
build := -f $(srctree)/tools/build/Makefile.build dir=. obj
--
2.34.1