mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Thomas Renninger <trenn@suse.com>, Shuah Khan <shuah@kernel.org>,
	"John B. Wyatt IV" <jwyatt@redhat.com>,
	John Kacur <jkacur@redhat.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Sasha Levin <sashal@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] cpupower: fix building cpufreq-bench with STATIC=true and O=
Date: Sun, 11 Oct 2026 18:33:30 -0400	[thread overview]
Message-ID: <20261011223358.2327625-2-sashal@kernel.org> (raw)

With STATIC=true, cpufreq-bench links lib/cpufreq.o and lib/cpupower.o,
which it expects in $(OUTPUT)../lib/. That is where the parent Makefile
builds them when bench's OUTPUT is the bench directory, but with O=,
bench gets the parent's output directory and the objects are in
$(OUTPUT)lib/. bench then tries to build them itself, outside the output
directory, and fails:

  Fatal error: can't create <O>//../lib/cpufreq.o: No such file or directory

Use the objects in lib/ under the parent's output directory, which is
one level up from bench when it is a relative path.

Fixes: e51207f003047 ("cpupower: Provide STATIC variable in Makefile for debug builds")
Assisted-by: LLM
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/power/cpupower/bench/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/power/cpupower/bench/Makefile b/tools/power/cpupower/bench/Makefile
index 34e5894476eba..ea74ef4d01b64 100644
--- a/tools/power/cpupower/bench/Makefile
+++ b/tools/power/cpupower/bench/Makefile
@@ -10,11 +10,12 @@ ifneq ($(O),)
 	OUTPUT := $(O)/
 endif
 endif
+LIBOUTPUT := $(if $(filter /%,$(OUTPUT)),,../)$(OUTPUT)
 
 ifeq ($(strip $(STATIC)),true)
 LIBS = -L../ -L$(OUTPUT) -lm
 OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \
-       $(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/cpupower.o
+       $(LIBOUTPUT)lib/cpufreq.o $(LIBOUTPUT)lib/cpupower.o
 else
 LIBS = -L../ -L$(OUTPUT) -lm -lcpupower
 OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o
-- 
2.53.0


                 reply	other threads:[~2026-10-11 22:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261011223358.2327625-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=jkacur@redhat.com \
    --cc=jwyatt@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=shuah@kernel.org \
    --cc=trenn@suse.com \
    /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®