From 4f035f338e298496096f152bfa1fd94f3bad8d34 Mon Sep 17 00:00:00 2001 From: Riza Sulistyo Date: Tue, 4 Feb 2020 11:14:21 +0000 Subject: [PATCH] Close #2105: Add option to specify SWIG bindings. git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@6156 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/swig/Makefile | 39 ++++++++++++----------------- pjsip-apps/src/swig/csharp/Makefile | 7 ++++++ pjsip-apps/src/swig/java/Makefile | 8 ++++++ pjsip-apps/src/swig/python/Makefile | 8 ++++++ 4 files changed, 39 insertions(+), 23 deletions(-) diff --git a/pjsip-apps/src/swig/Makefile b/pjsip-apps/src/swig/Makefile index ef8d0c9f1..abb317b7c 100644 --- a/pjsip-apps/src/swig/Makefile +++ b/pjsip-apps/src/swig/Makefile @@ -2,42 +2,35 @@ include ../../../build.mak ifneq ($(findstring android,$(TARGET_NAME)),) # no python for android - DIRS = java csharp + LANG = java csharp else ifneq ($(findstring ios,$(TARGET_NAME)),) - DIRS = csharp + LANG = csharp else - DIRS = python java + LANG = python java endif endif -export SWIG_FLAGS=-I../../../../pjlib/include \ - -I../../../../pjlib-util/include \ - -I../../../../pjmedia/include \ - -I../../../../pjsip/include \ - -I../../../../pjnath/include -c++ -export SRC_DIR=../../../../pjsip/include -export SRCS=$(SRC_DIR)/pjsua2/endpoint.hpp $(SRC_DIR)/pjsua2/types.hpp +CMD_is_java := $(findstring java, $(MAKECMDGOALS)) +CMD_is_python := $(findstring python, $(MAKECMDGOALS)) +CMD_is_csharp := $(findstring csharp, $(MAKECMDGOALS)) +CMD_is_lang := $(or $(CMD_is_java), $(CMD_is_python), $(CMD_is_csharp)) -.PHONY: all clean dep depend distclean print realclean install uninstall +.PHONY: all clean dep depend distclean print realclean install uninstall csharp java python all: symbols.i + +all clean dep depend distclean print realclean install uninstall: $(LANG) -all clean dep depend distclean print realclean install uninstall: - for dir in $(DIRS); do \ - if $(MAKE) $(MAKE_FLAGS) -C $$dir $@; then \ - true; \ - else \ - exit 1; \ - fi; \ - done - -csharp: - $(MAKE) $(MAKE_FLAGS) -C csharp $@ +java python csharp: +ifeq ($(CMD_is_lang),) + $(MAKE) $(MAKE_FLAGS) -C $@ $(MAKECMDGOALS) +else + $(MAKE) $(MAKE_FLAGS) -C $@ +endif symbols.i: symbols.lst @echo warning: file symbols.i is out of date. Run 'make symbol'. symbol symbols: python importsym.py - diff --git a/pjsip-apps/src/swig/csharp/Makefile b/pjsip-apps/src/swig/csharp/Makefile index b2ced29e1..b0e05e7f9 100644 --- a/pjsip-apps/src/swig/csharp/Makefile +++ b/pjsip-apps/src/swig/csharp/Makefile @@ -8,6 +8,13 @@ else OS=ios endif endif +SWIG_FLAGS=-I../../../../pjlib/include \ + -I../../../../pjlib-util/include \ + -I../../../../pjmedia/include \ + -I../../../../pjsip/include \ + -I../../../../pjnath/include -c++ +SRC_DIR=../../../../pjsip/include +SRCS=$(SRC_DIR)/pjsua2/endpoint.hpp $(SRC_DIR)/pjsua2/types.hpp SWIG_FLAGS += -w312 diff --git a/pjsip-apps/src/swig/java/Makefile b/pjsip-apps/src/swig/java/Makefile index 10ad7406e..4972fafec 100644 --- a/pjsip-apps/src/swig/java/Makefile +++ b/pjsip-apps/src/swig/java/Makefile @@ -1,6 +1,14 @@ include ../../../../build.mak include ../../../../build/common.mak +SWIG_FLAGS=-I../../../../pjlib/include \ + -I../../../../pjlib-util/include \ + -I../../../../pjmedia/include \ + -I../../../../pjsip/include \ + -I../../../../pjnath/include -c++ +SRC_DIR=../../../../pjsip/include +SRCS=$(SRC_DIR)/pjsua2/endpoint.hpp $(SRC_DIR)/pjsua2/types.hpp + ifneq ($(findstring android,$(TARGET_NAME)),) OS=android ifeq ("$(JAVA_HOME)","") diff --git a/pjsip-apps/src/swig/python/Makefile b/pjsip-apps/src/swig/python/Makefile index 1888e45a8..ddc6fcb43 100644 --- a/pjsip-apps/src/swig/python/Makefile +++ b/pjsip-apps/src/swig/python/Makefile @@ -18,6 +18,14 @@ else GCC_EXE= endif +SWIG_FLAGS=-I../../../../pjlib/include \ + -I../../../../pjlib-util/include \ + -I../../../../pjmedia/include \ + -I../../../../pjsip/include \ + -I../../../../pjnath/include -c++ +SRC_DIR=../../../../pjsip/include +SRCS=$(SRC_DIR)/pjsua2/endpoint.hpp $(SRC_DIR)/pjsua2/types.hpp + #USE_THREADS = -threads -DSWIG_NO_EXPORT_ITERATOR_METHODS SWIG_FLAGS += -w312 $(USE_THREADS)