eb589335b051ba4c25ab8a5d39a3a082326679ca
[vpp.git] / vpp-api / python / Makefile.am
1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 AUTOMAKE_OPTIONS = foreign subdir-objects
15 ACLOCAL_AMFLAGS = -I m4
16 AM_CFLAGS = -Wall
17
18 BUILT_SOURCES =
19 bin_PROGRAMS =
20 CLEANFILES =
21 lib_LTLIBRARIES =
22 noinst_PROGRAMS = test_pneum
23 nobase_include_HEADERS = pneum/pneum.h
24
25 #
26 # Python / C extension
27 #
28 lib_LTLIBRARIES += vpp_api.la
29 vpp_api_la_SOURCES = pneum/pneum.c vpp_papi/pneum_wrap.c
30 vpp_api_la_LIBADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra -lpthread -lm -lrt
31 vpp_api_la_LDFLAGS = -module $(shell python-config --ldflags)
32 vpp_api_la_CPPFLAGS = $(shell python-config --includes)
33
34 # Kept around for setuptools based install.
35 lib_LTLIBRARIES += libpneum.la
36 libpneum_la_SOURCES = pneum/pneum.c setup.py
37 libpneum_la_LIBADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra -lpthread -lm -lrt
38 libpneum_la_LDFLAGS = -module
39 libpneum_la_CPPFLAGS =
40
41 #
42 # Core VPP API
43 #
44 BUILT_SOURCES +=                                        \
45         $(prefix)/../vpp/vpp-api/vpe.py                 \
46         $(prefix)/../vlib-api/vlibmemory/memclnt.py
47
48 %.py: %.api
49         $(info Creating Python binding for $@)
50         $(CC) $(CPPFLAGS) -E -P -C -x c $<      \
51         | vppapigen --input - --python -        \
52         | pyvppapigen.py --input - > $@
53
54 #
55 # TODO: Support both Python 2 and 3.
56 install-exec-local:
57         cd $(srcdir); \
58         mkdir -p $(prefix)/lib/python2.7/site-packages; \
59         PYTHONUSERBASE=$(prefix) python setup.py install --user
60
61 #
62 # Test client
63 #
64 noinst_PROGRAMS += test_pneum
65 test_pneum_SOURCES = pneum/pneum.c pneum/test_pneum.c
66 test_pneum_LDADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra -lpthread -lm -lrt