summaryrefslogtreecommitdiffstats
path: root/vpp-api/python/Makefile.am
diff options
context:
space:
mode:
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