Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

https://lore.kernel.org/r/20250624204105.457971-1-jwyatt@redhat.com
Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

John B. Wyatt IV and committed by
Shuah Khan
b74710ea 14a3318b

+7 -5
+7 -5
tools/power/cpupower/bindings/python/Makefile
··· 4 4 # This Makefile expects you have already run `make install-lib` in the lib 5 5 # directory for the bindings to be created. 6 6 7 - CC := gcc 7 + CC ?= gcc 8 + # CFLAGS ?= 9 + LDFLAGS ?= -lcpupower 8 10 HAVE_SWIG := $(shell if which swig >/dev/null 2>&1; then echo 1; else echo 0; fi) 9 11 HAVE_PYCONFIG := $(shell if which python-config >/dev/null 2>&1; then echo 1; else echo 0; fi) 10 12 11 - PY_INCLUDE = $(firstword $(shell python-config --includes)) 12 - INSTALL_DIR = $(shell python3 -c "import site; print(site.getsitepackages()[0])") 13 + PY_INCLUDE ?= $(firstword $(shell python-config --includes)) 14 + INSTALL_DIR ?= $(shell python3 -c "import site; print(site.getsitepackages()[0])") 13 15 14 16 all: _raw_pylibcpupower.so 15 17 16 18 _raw_pylibcpupower.so: raw_pylibcpupower_wrap.o 17 - $(CC) -shared -lcpupower raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so 19 + $(CC) -shared $(LDFLAGS) raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so 18 20 19 21 raw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c 20 - $(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE) 22 + $(CC) $(CFLAGS) $(PY_INCLUDE) -fPIC -c raw_pylibcpupower_wrap.c 21 23 22 24 raw_pylibcpupower_wrap.c: raw_pylibcpupower.swg 23 25 ifeq ($(HAVE_SWIG),0)