linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpupower: Improve Python binding's Makefile
@ 2025-06-24 20:41 John B. Wyatt IV
  2025-07-01 17:11 ` Shuah Khan
  0 siblings, 1 reply; 2+ messages in thread
From: John B. Wyatt IV @ 2025-06-24 20:41 UTC (permalink / raw)
  To: Shuah Khan, Thomas Renninger
  Cc: John B. Wyatt IV, linux-pm, Shuah Khan, Rafael J. Wysocki,
	linux-kernel, John Kacur, John B. Wyatt IV, Thorsten Leemhuis

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@leemhuis.info>.

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cpupower: Improve Python binding's Makefile
  2025-06-24 20:41 [PATCH] cpupower: Improve Python binding's Makefile John B. Wyatt IV
@ 2025-07-01 17:11 ` Shuah Khan
  0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2025-07-01 17:11 UTC (permalink / raw)
  To: John B. Wyatt IV, Thomas Renninger
  Cc: linux-pm, Shuah Khan, Rafael J. Wysocki, linux-kernel, John Kacur,
	John B. Wyatt IV, Thorsten Leemhuis, Shuah Khan

On 6/24/25 14:41, John B. Wyatt IV wrote:
> 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@leemhuis.info>.
> 
> Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
> Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com>
> ---
>   tools/power/cpupower/bindings/python/Makefile | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
> 

Thank you. Applied to git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux cpupower

Will include this in my next PR to Rafael.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-01 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-24 20:41 [PATCH] cpupower: Improve Python binding's Makefile John B. Wyatt IV
2025-07-01 17:11 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).