summaryrefslogtreecommitdiff
path: root/bindings/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/Makefile')
-rw-r--r--bindings/Makefile63
1 files changed, 52 insertions, 11 deletions
diff --git a/bindings/Makefile b/bindings/Makefile
index 9cdb6a3..1726d81 100644
--- a/bindings/Makefile
+++ b/bindings/Makefile
@@ -1,15 +1,29 @@
CC=g++
-QTFLAGS := $(shell pkg-config QtCore --cflags)
-QTLIBS := $(shell pkg-config QtCore --libs)
-PYTHONFLAGS := $(shell pkg-config python2 --cflags)
+#---------------------------------
+# Package versions for pkg-config
+
+# QT=QtCore # Qt4
+QT=Qt5Core # Qt5
+LUA=lua
+
+#---------------------------------
+# Flags
+
+QTFLAGS := $(shell pkg-config $(QT) --cflags)
+QTLIBS := $(shell pkg-config $(QT) --libs)
+PYTHON2FLAGS := $(shell pkg-config python2 --cflags)
+PYTHON3FLAGS := $(shell pkg-config python3 --cflags)
PHPFLAGS := $(shell php-config --includes)
PHPLIBS := $(shell php-config --libs)
-LUAFLAGS := $(shell pkg-config lua5.1 --cflags)
+LUAFLAGS := $(shell pkg-config $(LUA) --cflags)
INCLUDES=-I..
QUACKLELIBS=../lib/release/libquackle.a ../quackleio/lib/release/libquackleio.a
+#---------------------------------
+# PHP
+
php/quackle_wrap.cxx:
@test -d php || mkdir php
swig -c++ -o $@ $(INCLUDES) $(QTFLAGS) -php quackle.i
@@ -20,20 +34,43 @@ php/quackle_wrap.o: php/quackle_wrap.cxx
php: php/quackle_wrap.o
$(CC) -std=c++11 -shared -Wl,--whole-archive $(QUACKLELIBS) -Wl,--no-whole-archive $(QTLIBS) $< -o php/quackle.so
-python/quackle_wrap.cxx:
- @test -d python || mkdir python
+#---------------------------------
+# Python2
+
+python2/quackle_wrap.cxx:
+ @test -d python2 || mkdir python2
swig -c++ -o $@ $(INCLUDES) $(QTFLAGS) -python quackle.i
-python/quackle_wrap.o: python/quackle_wrap.cxx
- $(CC) -std=c++11 -fPIC $(QTFLAGS) $(PYTHONFLAGS) $(INCLUDES) -c $< -o $@
+python2/quackle_wrap.o: python2/quackle_wrap.cxx
+ $(CC) -std=c++11 -fPIC $(QTFLAGS) $(PYTHON2FLAGS) $(INCLUDES) -c $< -o $@
+
+python2: python2/quackle_wrap.o
+ $(CC) -std=c++11 -shared -Wl,--whole-archive $(QUACKLELIBS) -Wl,--no-whole-archive $(QTLIBS) $< -o python2/_quackle.so
+
+#---------------------------------
+# Python3
-python: python/quackle_wrap.o
- $(CC) -std=c++11 -shared -Wl,--whole-archive $(QUACKLELIBS) -Wl,--no-whole-archive $(QTLIBS) $< -o python/_quackle.so
+python3/quackle_wrap.cxx:
+ @test -d python3 || mkdir python3
+ swig -c++ -o $@ $(INCLUDES) $(QTFLAGS) -python -py3 quackle.i
+
+python3/quackle_wrap.o: python3/quackle_wrap.cxx
+ $(CC) -std=c++11 -fPIC $(QTFLAGS) $(PYTHON3FLAGS) $(INCLUDES) -c $< -o $@
+
+python3: python3/quackle_wrap.o
+ $(CC) -std=c++11 -shared -Wl,--whole-archive $(QUACKLELIBS) -Wl,--no-whole-archive $(QTLIBS) $< -o python3/_quackle.so
+
+#---------------------------------
+# Go
go:
ln -sf ../quackle.i go/quackle.swigcxx
go build ./go/...
+
+#---------------------------------
+# Lua
+
lua/quackle_wrap.cxx:
@test -d lua || mkdir lua
swig -c++ -o $@ $(INCLUDES) $(QTFLAGS) -lua quackle.i
@@ -44,10 +81,14 @@ lua/quackle_wrap.o: lua/quackle_wrap.cxx
lua: lua/quackle_wrap.o
$(CC) -std=c++11 -shared $(LUAFLAGS) -Wl,--whole-archive $(QUACKLELIBS) -Wl,--no-whole-archive $(QTLIBS) $< -o lua/quackle.so
+#---------------------------------
+
.PHONY: clean go
clean:
- -rm -rf python/quackle.py
+ -rm -rf python2/quackle.py
+ -rm -rf python3/quackle.py
+ -rm -rf python3/__pycache__
-rm -rf php/*php*
-rm -rf */*_wrap.cxx
-rm -rf */*.o