mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: irogers@google.com, acme@kernel.org, leo.yan@arm.com,
	namhyung@kernel.org
Cc: adrian.hunter@intel.com, james.clark@linaro.org,
	jolsa@kernel.org,  linux-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org,  mingo@redhat.com,
	peterz@infradead.org
Subject: [PATCH v2 4/4] perf build: Fix clean and install target dependencies
Date: Wed, 30 Sep 2026 22:41:20 -0700	[thread overview]
Message-ID: <20261001054120.1570943-5-irogers@google.com> (raw)
In-Reply-To: <20261001054120.1570943-1-irogers@google.com>

Fix several missing dependencies and ordering issues for clean and
install targets:

1. In tools/perf/Makefile, order 'install*' goals (excluding
   'install-build-deps', which is ordered before build/install goals)
   after 'all' when both are passed on the command line (e.g.
   'make -j clean all install') so two concurrent Makefile.perf
   sub-makes do not race in the same build directory, and mark 'all' and
   'clean' as .PHONY.

2. In tools/perf/Makefile.perf, when 'clean' is passed alongside build
   or install goals (e.g. 'make -f Makefile.perf clean install'), run
   'clean' sequentially before 'fixdep' and 'sub-make' rather than
   running 'clean' in parallel with the build inside 'sub-make'.

3. Ensure '$(OUTPUT)python' is created inside the recipe for
   '$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX)' rather than only at
   Makefile parse time, in case 'clean' removed the directory.

4. Add '$(LANG_BINDINGS)' as a prerequisite of 'install-python_ext' so
   the Python C extension is built with the proper compiler/linker flags
   and perf libraries before 'setup.py install' runs.

5. Add 'install-bin', 'install-tools', 'install-tests',
   'install-python_ext', '$(DOC_TARGETS)', and '$(INSTALL_DOC_TARGETS)'
   to .PHONY in Makefile.perf.

6. Prefix targets emitted by Documentation/build-docdep.perl with
   '$(OUTPUT)' so '$(OUTPUT)doc.dep' matches out-of-tree documentation
   targets when 'O=' is specified.

Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/Documentation/build-docdep.perl |  2 +-
 tools/perf/Makefile                        | 16 +++++++++++++++-
 tools/perf/Makefile.perf                   | 19 +++++++++++++++----
 3 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/tools/perf/Documentation/build-docdep.perl b/tools/perf/Documentation/build-docdep.perl
index ba4205e0302a..f19f5107fe0f 100755
--- a/tools/perf/Documentation/build-docdep.perl
+++ b/tools/perf/Documentation/build-docdep.perl
@@ -41,6 +41,6 @@ while ($changed) {
 while (my ($text, $included) = each %include) {
     if (! exists $included{$text} &&
 	(my $base = $text) =~ s/\.txt$//) {
-	print "$base.html $base.xml : ", join(" ", keys %$included), "\n";
+	print "\$(OUTPUT)$base.html \$(OUTPUT)$base.xml : ", join(" ", keys %$included), "\n";
     }
 }
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index b8d38728306a..c1818bd5f287 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -93,6 +93,20 @@ ifeq ($(has_clean),1)
 $(rest): clean
   endif # rest
 endif # has_clean
+
+ifneq ($(filter install-build-deps,$(MAKECMDGOALS)),)
+  after_deps := $(filter-out clean install-build-deps,$(MAKECMDGOALS))
+  ifneq ($(after_deps),)
+$(after_deps): install-build-deps
+  endif
+endif
+
+ifneq ($(filter all,$(MAKECMDGOALS)),)
+  install_goals := $(filter-out install-build-deps,$(filter install%,$(MAKECMDGOALS)))
+  ifneq ($(install_goals),)
+$(install_goals): all
+  endif
+endif
 endif # MAKECMDGOALS
 
 #
@@ -130,4 +144,4 @@ check-headers:
 	$(print_msg)
 	$(make)
 
-.PHONY: tags TAGS FORCE Makefile build-test build-test-tarball check-headers
+.PHONY: all clean tags TAGS FORCE Makefile build-test build-test-tarball check-headers
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 836225b08649..d90bdd319c72 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -327,9 +327,17 @@ export HOSTCC HOSTLD HOSTAR HOSTCFLAGS SHELLCHECK MYPY PYLINT CONFIG_PERF_BPF_SK
 include $(srctree)/tools/build/Makefile.include
 
 ifeq ($(force_fixdep),1)
-goals := $(filter-out all sub-make, $(MAKECMDGOALS))
+goals := $(filter-out all sub-make clean, $(MAKECMDGOALS))
 
-$(goals) all: sub-make
+ifneq ($(filter clean,$(MAKECMDGOALS)),)
+clean-make:
+	$(Q)$(MAKE) -f Makefile.perf -j1 clean
+
+fixdep: clean-make
+.PHONY: clean-make
+endif
+
+$(goals) all clean: sub-make
 
 sub-make: fixdep
 	$(Q)$(MAKE) FIXDEP_BUILT=1 -f Makefile.perf $(goals)
@@ -565,6 +573,7 @@ $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.py pyth
         CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBS_PY)' \
 	  $(PYTHON_WORD) util/setup.py \
 	  $(python_setup_quiet) build_ext; \
+	$(MKDIR) -p $(OUTPUT)python; \
 	cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/; \
 	if [ "$(abspath python/perf.pyi)" != "$(abspath $(OUTPUT)python/perf.pyi)" ]; then \
 		cp python/perf.pyi $(OUTPUT)python/; \
@@ -994,7 +1003,7 @@ install: install-bin try-install-man
 install-build-deps:
 	$(Q)$(SHELL) $(srctree)/tools/perf/scripts/install-build-deps.sh $(INSTALL_BUILD_DEPS_ARGS)
 
-install-python_ext:
+install-python_ext: $(LANG_BINDINGS)
 	$(PYTHON_WORD) util/setup.py $(python_setup_quiet) \
 		$(if $(OUTPUT),egg_info --egg-base $(OUTPUT)) \
 		install --root='/$(DESTDIR_SQ)'
@@ -1070,7 +1079,9 @@ endif
 
 FORCE:
 
-.PHONY: all install install-build-deps clean config-clean strip install-gtk
+.PHONY: all install install-bin install-tools install-tests install-build-deps
+.PHONY: install-gtk install-python_ext $(DOC_TARGETS) $(INSTALL_DOC_TARGETS)
+.PHONY: clean config-clean strip
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
 .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope FORCE prepare bpf-skel-prepare
 .PHONY: python_perf_target
-- 
2.56.0.rc1.315.gc6ed9934b7-goog


  parent reply	other threads:[~2026-10-01  5:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01  2:34 [PATCH 0/4] perf build: Linter parallelism and clean/install dependency fixes Ian Rogers
2026-10-01  2:34 ` [PATCH 1/4] perf test: Update attr.py to use argparse Ian Rogers
2026-10-01  2:34 ` [PATCH 2/4] perf build: Run shellcheck, mypy, and remaining pylint checks in parallel Ian Rogers
2026-10-01  2:34 ` [PATCH 3/4] perf build: Clear GTK4 instead of setting unused NO_GTK4 when gtk4 is missing Ian Rogers
2026-10-01  2:34 ` [PATCH 4/4] perf build: Fix clean and install target dependencies Ian Rogers
2026-10-01  5:41 ` [PATCH v2 0/4] perf build: Linter parallelism and clean/install dependency fixes Ian Rogers
2026-10-01  5:41   ` [PATCH v2 1/4] perf test: Update attr.py to use argparse Ian Rogers
2026-10-01  5:41   ` [PATCH v2 2/4] perf build: Run shellcheck, mypy, and remaining pylint checks in parallel Ian Rogers
2026-10-01  5:41   ` [PATCH v2 3/4] perf build: Clear GTK4 instead of setting unused NO_GTK4 when gtk4 is missing Ian Rogers
2026-10-01  5:41   ` Ian Rogers [this message]
2026-10-01 15:54   ` [PATCH v2 0/4] perf build: Linter parallelism and clean/install dependency fixes Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261001054120.1570943-5-irogers@google.com \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®