summaryrefslogtreecommitdiffstats
path: root/vpp-api/python/Makefile.am
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2016-08-01 04:59:13 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2016-08-25 00:29:40 +0000
commit5f9dcff39d5e25c6bef30d569e405635633f3c69 (patch)
treeec14d5fdb45a9d82cf5703d63e0bcafcc40d4da0 /vpp-api/python/Makefile.am
parent151fb725636f192da8a04d0f74dc3455b58dd61c (diff)
VPP Python language binding - plugin support
- Moved Python generator tool to tools directory - Added build-vpp-api Makefile target - Generator now only creates a Python representation of the .api the rest of the framework is in the vpp_papi script - Each plugin has its own namespace. - Plugin Python files are installed in vpp_papi_plugins for easy use inside the build tree. Change-Id: I272c83bb7e5d5e416bdbd8a790a3cc35c5a04e38 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'vpp-api/python/Makefile.am')
-rw-r--r--vpp-api/python/Makefile.am45
1 files changed, 31 insertions, 14 deletions
diff --git a/vpp-api/python/Makefile.am b/vpp-api/python/Makefile.am
index 4d2d221d231..eb589335b05 100644
--- a/vpp-api/python/Makefile.am
+++ b/vpp-api/python/Makefile.am
@@ -13,33 +13,50 @@
AUTOMAKE_OPTIONS = foreign subdir-objects
ACLOCAL_AMFLAGS = -I m4
-AM_CFLAGS = -Wall
+AM_CFLAGS = -Wall
BUILT_SOURCES =
-bin_PROGRAMS =
-CLEANFILES =
-lib_LTLIBRARIES =
+bin_PROGRAMS =
+CLEANFILES =
+lib_LTLIBRARIES =
noinst_PROGRAMS = test_pneum
nobase_include_HEADERS = pneum/pneum.h
#
-# Python binding
+# Python / C extension
#
+lib_LTLIBRARIES += vpp_api.la
+vpp_api_la_SOURCES = pneum/pneum.c vpp_papi/pneum_wrap.c
+vpp_api_la_LIBADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra -lpthread -lm -lrt
+vpp_api_la_LDFLAGS = -module $(shell python-config --ldflags)
+vpp_api_la_CPPFLAGS = $(shell python-config --includes)
+
+# Kept around for setuptools based install.
lib_LTLIBRARIES += libpneum.la
-libpneum_la_SOURCES = pneum/pneum.c
+libpneum_la_SOURCES = pneum/pneum.c setup.py
libpneum_la_LIBADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra -lpthread -lm -lrt
libpneum_la_LDFLAGS = -module
libpneum_la_CPPFLAGS =
-BUILT_SOURCES += vpp_papi.py
+#
+# Core VPP API
+#
+BUILT_SOURCES += \
+ $(prefix)/../vpp/vpp-api/vpe.py \
+ $(prefix)/../vlib-api/vlibmemory/memclnt.py
-vpp_papi.py: $(prefix)/../vpp/vpp-api/vpe.api pneum/api-gen.py
- @echo " PYTHON API"; \
- $(CC) $(CPPFLAGS) -E -P -C -x c $< \
- | vppapigen --input - --python defs_$@; \
- echo "#include <vpp-api/vpe_msg_enum.h>" \
- | $(CC) $(CPPFLAGS) -E -P -x c - | grep VL_API \
- | @srcdir@/pneum/api-gen.py -i defs_$@ > @srcdir@/vpp_papi/$@
+%.py: %.api
+ $(info Creating Python binding for $@)
+ $(CC) $(CPPFLAGS) -E -P -C -x c $< \
+ | vppapigen --input - --python - \
+ | pyvppapigen.py --input - > $@
+
+#
+# TODO: Support both Python 2 and 3.
+install-exec-local:
+ cd $(srcdir); \
+ mkdir -p $(prefix)/lib/python2.7/site-packages; \
+ PYTHONUSERBASE=$(prefix) python setup.py install --user
#
# Test client