diff mbox series

[2/2] rt-tests: Handle -lcpupower flag outside LDFLAGS

Message ID 20241204154004.560615-3-tglozar@redhat.com
State New
Headers show
Series rt-tests: libcpupower feature detection fixes | expand

Commit Message

Tomas Glozar Dec. 4, 2024, 3:40 p.m. UTC
From: Tomas Glozar <tglozar@redhat.com>

The rt-tests Makefile adds -lcpupower to LDFLAGS if libcpupower support
is detected on the system. However, this does not work when LDFLAGS is
overwritten by an external source.

Add separate variable LIBCPUPOWER to contain the flag and pass it to the
cyclictest linking phase. This also avoids unnecessarily passing the
flag to the linking of other rt-tests binaries which do not use
libcpupower.

Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index f656e34..0fa0928 100644
--- a/Makefile
+++ b/Makefile
@@ -43,7 +43,7 @@  PYLIB ?= $(shell python3 -m get_pylib)
 ifneq ($(no_libcpupower), 1)
 ifeq ($(call test-feature,libcpupower), 0)
 CPPFLAGS += -DHAVE_LIBCPUPOWER_SUPPORT
-LDFLAGS += -lcpupower
+LIBCPUPOWER += -lcpupower
 else
 $(warning libcpupower is missing, building without --deepest-idle-state support.)
 $(warning Please install libcpupower-dev/kernel-tools-libs-devel)
@@ -135,7 +135,7 @@  $(OBJDIR):
 -include $(addprefix $(OBJDIR)/,$(sources:.c=.d))
 
 cyclictest: $(OBJDIR)/cyclictest.o $(OBJDIR)/librttest.a $(OBJDIR)/librttestnuma.a
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(RTTESTNUMA) $(LIBCPUPOWER)
 
 cyclicdeadline: $(OBJDIR)/cyclicdeadline.o $(OBJDIR)/librttest.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)