| 1 |
PYTHON_SO=_pjsua2.so |
| 2 |
|
| 3 |
USE_PYTHON3?=1 |
| 4 |
|
| 5 |
ifeq ($(USE_PYTHON3),1) |
| 6 |
PYTHON_EXE=python3 |
| 7 |
else |
| 8 |
PYTHON_EXE=python2 |
| 9 |
endif |
| 10 |
|
| 11 |
|
| 12 |
ifeq ($(OS),Windows_NT) |
| 13 |
PYTHON_PKG_DIR := $(shell $(PYTHON_EXE) -m site --user-site | sed 's/\\/\//g') |
| 14 |
PYTHON_SETUP_FLAGS += --compiler=mingw32 |
| 15 |
GCC_EXE=gcc.exe |
| 16 |
else |
| 17 |
PYTHON_PKG_DIR := $(shell $(PYTHON_EXE) -m site --user-site) |
| 18 |
GCC_EXE= |
| 19 |
endif |
| 20 |
|
| 21 |
SWIG_FLAGS=-I../../../../pjlib/include \ |
| 22 |
-I../../../../pjlib-util/include \ |
| 23 |
-I../../../../pjmedia/include \ |
| 24 |
-I../../../../pjsip/include \ |
| 25 |
-I../../../../pjnath/include -c++ |
| 26 |
SRC_DIR=../../../../pjsip/include |
| 27 |
SRCS=$(SRC_DIR)/pjsua2/endpoint.hpp $(SRC_DIR)/pjsua2/types.hpp |
| 28 |
|
| 29 |
GEN_DOC = -doxygen |
| 30 |
USE_THREADS = -threads |
| 31 |
|
| 32 |
|
| 33 |
SWIG_FLAGS += -w312 $(USE_THREADS) $(GEN_DOC) |
| 34 |
|
| 35 |
.PHONY: all install uninstall |
| 36 |
|
| 37 |
all: $(PYTHON_SO) |
| 38 |
|
| 39 |
wheel: pjsua2_wrap.cpp setup.py $(GCC_EXE) |
| 40 |
$(PYTHON_EXE) setup.py bdist_wheel $(PYTHON_SETUP_FLAGS) |
| 41 |
|
| 42 |
$(PYTHON_SO): pjsua2_wrap.cpp setup.py $(GCC_EXE) |
| 43 |
$(PYTHON_EXE) setup.py build $(PYTHON_SETUP_FLAGS) |
| 44 |
|
| 45 |
gcc.exe: cc_mingw.c |
| 46 |
gcc -o gcc.exe cc_mingw.c |
| 47 |
cp gcc.exe g++.exe |
| 48 |
|
| 49 |
pjsua2_wrap.cpp: ../pjsua2.i ../symbols.i Makefile $(SRCS) |
| 50 |
swig $(SWIG_FLAGS) -python -o pjsua2_wrap.cpp ../pjsua2.i |
| 51 |
|
| 52 |
clean distclean realclean: |
| 53 |
rm -rf $(PYTHON_SO) pjsua2_wrap.cpp pjsua2_wrap.h pjsua2.py build *.pyc |
| 54 |
rm -f gcc.exe g++.exe |
| 55 |
|
| 56 |
install: |
| 57 |
$(PYTHON_EXE) setup.py install --user |
| 58 |
|
| 59 |
uninstall: |
| 60 |
rm -f $(PYTHON_PKG_DIR)/pjsua2* |
| 61 |
rm -f $(PYTHON_PKG_DIR)/_pjsua2* |