1*338f490eSJohn B. Wyatt IV# SPDX-License-Identifier: GPL-2.0-only
2*338f490eSJohn B. Wyatt IV# Makefile for libcpupower's Python bindings
3*338f490eSJohn B. Wyatt IV#
4*338f490eSJohn B. Wyatt IV# This Makefile expects you have already run the makefile for cpupower to build
5*338f490eSJohn B. Wyatt IV# the .o files in the lib directory for the bindings to be created.
6*338f490eSJohn B. Wyatt IV
7*338f490eSJohn B. Wyatt IVCC=gcc
8*338f490eSJohn B. Wyatt IV
9*338f490eSJohn B. Wyatt IVLIB_DIR = ../../lib
10*338f490eSJohn B. Wyatt IVBIND_DIR = .
11*338f490eSJohn B. Wyatt IVPY_INCLUDE := $(firstword $(shell python-config --includes))
12*338f490eSJohn B. Wyatt IV#PY_INCLUDE = $(shell python-config --includes | awk '{ print $1 }')
13*338f490eSJohn B. Wyatt IV
14*338f490eSJohn B. Wyatt IVOBJECTS_LIB = $(wildcard $(LIB_DIR)/*.o)
15*338f490eSJohn B. Wyatt IVOBJECTS_BIND = $(wildcard $(BIND_DIR)/*.o)
16*338f490eSJohn B. Wyatt IV
17*338f490eSJohn B. Wyatt IVall: _raw_pylibcpupower.so
18*338f490eSJohn B. Wyatt IV
19*338f490eSJohn B. Wyatt IV_raw_pylibcpupower.so: raw_pylibcpupower_wrap.o
20*338f490eSJohn B. Wyatt IV	$(CC) -shared $(OBJECTS_LIB) raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so # raw_pylibcpupower_wrap.o
21*338f490eSJohn B. Wyatt IV#	$(CC) -shared $(OBJECTS_BIND) $(OBJECTS_LIB) -o _raw_pylibcpupower.so # raw_pylibcpupower_wrap.o
22*338f490eSJohn B. Wyatt IV
23*338f490eSJohn B. Wyatt IVraw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c
24*338f490eSJohn B. Wyatt IV	$(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE)
25*338f490eSJohn B. Wyatt IV
26*338f490eSJohn B. Wyatt IVraw_pylibcpupower_wrap.c: raw_pylibcpupower.i
27*338f490eSJohn B. Wyatt IV	swig -python raw_pylibcpupower.i
28*338f490eSJohn B. Wyatt IV
29*338f490eSJohn B. Wyatt IV# Will only clean the bindings folder; will not clean the actual cpupower folder
30*338f490eSJohn B. Wyatt IVclean:
31*338f490eSJohn B. Wyatt IV	rm -f raw_pylibcpupower.py raw_pylibcpupower_wrap.c raw_pylibcpupower_wrap.o _raw_pylibcpupower.so
32