Skip to content

Commit b74710e

Browse files
John B. Wyatt IVshuahkh
authored andcommitted
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>
1 parent 14a3318 commit b74710e

File tree

1 file changed

+7
-5
lines changed
  • tools/power/cpupower/bindings/python

1 file changed

+7
-5
lines changed

tools/power/cpupower/bindings/python/Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
# This Makefile expects you have already run `make install-lib` in the lib
55
# directory for the bindings to be created.
66

7-
CC := gcc
7+
CC ?= gcc
8+
# CFLAGS ?=
9+
LDFLAGS ?= -lcpupower
810
HAVE_SWIG := $(shell if which swig >/dev/null 2>&1; then echo 1; else echo 0; fi)
911
HAVE_PYCONFIG := $(shell if which python-config >/dev/null 2>&1; then echo 1; else echo 0; fi)
1012

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])")
1315

1416
all: _raw_pylibcpupower.so
1517

1618
_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
1820

1921
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
2123

2224
raw_pylibcpupower_wrap.c: raw_pylibcpupower.swg
2325
ifeq ($(HAVE_SWIG),0)

0 commit comments

Comments
 (0)