mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
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>
This commit is contained in:
parent
14a3318b4a
commit
b74710eaff
1 changed files with 7 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue