cpupower: fix building cpufreq-bench with STATIC=true and O=
PATCH 1/1 cpupower: fix building cpufreq-bench with STATIC=true and O=
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 <[email protected]>
--- tools/power/cpupower/bench/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/power/cpupower/bench/Makefile +2 -1
@@ -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
Signature · 1 line
2.53.0