Skip to content

Commit 80e67f1

Browse files
John B. Wyatt IVshuahkh
authored andcommitted
pm:cpupower: Add error warning when SWIG is not installed
Add error message to better explain to the user when SWIG and python-config is missing from the path. Makefile was cleaned up and unneeded elements were removed. Suggested-by: Shuah Khan <skhan@linuxfoundation.org> 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 757eebc commit 80e67f1

File tree

1 file changed

+11
-9
lines changed
  • tools/power/cpupower/bindings/python

1 file changed

+11
-9
lines changed

tools/power/cpupower/bindings/python/Makefile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,28 @@
44
# This Makefile expects you have already run the makefile for cpupower to build
55
# the .o files in the lib directory for the bindings to be created.
66

7-
CC=gcc
8-
9-
LIB_DIR = ../../lib
10-
BIND_DIR = .
11-
PY_INCLUDE := $(firstword $(shell python-config --includes))
12-
#PY_INCLUDE = $(shell python-config --includes | awk '{ print $1 }')
7+
CC := gcc
8+
HAVE_SWIG := $(shell if which swig >/dev/null 2>&1; then echo 1; else echo 0; fi)
9+
HAVE_PYCONFIG := $(shell if which python-config >/dev/null 2>&1; then echo 1; else echo 0; fi)
1310

11+
LIB_DIR := ../../lib
12+
PY_INCLUDE = $(firstword $(shell python-config --includes))
1413
OBJECTS_LIB = $(wildcard $(LIB_DIR)/*.o)
15-
OBJECTS_BIND = $(wildcard $(BIND_DIR)/*.o)
1614

1715
all: _raw_pylibcpupower.so
1816

1917
_raw_pylibcpupower.so: raw_pylibcpupower_wrap.o
20-
$(CC) -shared $(OBJECTS_LIB) raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so # raw_pylibcpupower_wrap.o
21-
# $(CC) -shared $(OBJECTS_BIND) $(OBJECTS_LIB) -o _raw_pylibcpupower.so # raw_pylibcpupower_wrap.o
18+
$(CC) -shared $(OBJECTS_LIB) raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so
2219

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

2623
raw_pylibcpupower_wrap.c: raw_pylibcpupower.i
24+
ifeq ($(HAVE_SWIG),0)
25+
$(error "swig was not found. Make sure you have it installed and in the PATH to generate the bindings.")
26+
else ifeq ($(HAVE_PYCONFIG),0)
27+
$(error "python-config was not found. Make sure you have it installed and in the PATH to generate the bindings.")
28+
endif
2729
swig -python raw_pylibcpupower.i
2830

2931
# Will only clean the bindings folder; will not clean the actual cpupower folder

0 commit comments

Comments
 (0)