aboutsummaryrefslogtreecommitdiff
path: root/tools/power/cpupower/bindings/python/Makefile
blob: d0418f9027956517f162910facb334965747d523 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# SPDX-License-Identifier: GPL-2.0-only
# Makefile for libcpupower's Python bindings
#
# This Makefile expects you have already run the makefile for cpupower to build
# the .o files in the lib directory for the bindings to be created.

CC=gcc

LIB_DIR = ../../lib
BIND_DIR = .
PY_INCLUDE := $(firstword $(shell python-config --includes))
#PY_INCLUDE = $(shell python-config --includes | awk '{ print $1 }')

OBJECTS_LIB = $(wildcard $(LIB_DIR)/*.o)
OBJECTS_BIND = $(wildcard $(BIND_DIR)/*.o)

all: _raw_pylibcpupower.so

_raw_pylibcpupower.so: raw_pylibcpupower_wrap.o
	$(CC) -shared $(OBJECTS_LIB) raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so # raw_pylibcpupower_wrap.o
#	$(CC) -shared $(OBJECTS_BIND) $(OBJECTS_LIB) -o _raw_pylibcpupower.so # raw_pylibcpupower_wrap.o

raw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c
	$(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE)

raw_pylibcpupower_wrap.c: raw_pylibcpupower.i
	swig -python raw_pylibcpupower.i

# Will only clean the bindings folder; will not clean the actual cpupower folder
clean:
	rm -f raw_pylibcpupower.py raw_pylibcpupower_wrap.c raw_pylibcpupower_wrap.o _raw_pylibcpupower.so