[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250624204105.457971-1-jwyatt@redhat.com>
Date: Tue, 24 Jun 2025 16:41:04 -0400
From: "John B. Wyatt IV" <jwyatt@...hat.com>
To: Shuah Khan <skhan@...uxfoundation.org>,
Thomas Renninger <trenn@...e.com>
Cc: "John B. Wyatt IV" <jwyatt@...hat.com>,
linux-pm@...r.kernel.org,
Shuah Khan <shuah@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
linux-kernel@...r.kernel.org,
John Kacur <jkacur@...hat.com>,
"John B. Wyatt IV" <sageofredondo@...il.com>,
"Thorsten Leemhuis" <linux@...mhuis.info>
Subject: [PATCH] cpupower: Improve Python binding's Makefile
Add a few build variables to make it easier for distributions to
package the bindings. Allow current variables to be overwritten by
environment variables that are passed to make.
CCing Thorsten Leemhuis <linux@...mhuis.info>.
Signed-off-by: John B. Wyatt IV <jwyatt@...hat.com>
Signed-off-by: John B. Wyatt IV <sageofredondo@...il.com>
---
tools/power/cpupower/bindings/python/Makefile | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/power/cpupower/bindings/python/Makefile b/tools/power/cpupower/bindings/python/Makefile
index 81db39a03efb..4527cd732b42 100644
--- a/tools/power/cpupower/bindings/python/Makefile
+++ b/tools/power/cpupower/bindings/python/Makefile
@@ -4,20 +4,22 @@
# This Makefile expects you have already run `make install-lib` in the lib
# directory for the bindings to be created.
-CC := gcc
+CC ?= gcc
+# CFLAGS ?=
+LDFLAGS ?= -lcpupower
HAVE_SWIG := $(shell if which swig >/dev/null 2>&1; then echo 1; else echo 0; fi)
HAVE_PYCONFIG := $(shell if which python-config >/dev/null 2>&1; then echo 1; else echo 0; fi)
-PY_INCLUDE = $(firstword $(shell python-config --includes))
-INSTALL_DIR = $(shell python3 -c "import site; print(site.getsitepackages()[0])")
+PY_INCLUDE ?= $(firstword $(shell python-config --includes))
+INSTALL_DIR ?= $(shell python3 -c "import site; print(site.getsitepackages()[0])")
all: _raw_pylibcpupower.so
_raw_pylibcpupower.so: raw_pylibcpupower_wrap.o
- $(CC) -shared -lcpupower raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so
+ $(CC) -shared $(LDFLAGS) raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so
raw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c
- $(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE)
+ $(CC) $(CFLAGS) $(PY_INCLUDE) -fPIC -c raw_pylibcpupower_wrap.c
raw_pylibcpupower_wrap.c: raw_pylibcpupower.swg
ifeq ($(HAVE_SWIG),0)
--
2.49.0
Powered by blists - more mailing lists