mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cpupower: fix building cpufreq-bench with STATIC=true and O=
@ 2026-10-11 22:33 Sasha Levin
  0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2026-10-11 22:33 UTC (permalink / raw)
  To: Thomas Renninger, Shuah Khan, John B. Wyatt IV, John Kacur,
	Rafael J. Wysocki
  Cc: Sasha Levin, linux-pm, linux-kernel

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-11 22:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-11 22:33 [PATCH] cpupower: fix building cpufreq-bench with STATIC=true and O= Sasha Levin

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®