blob: 29c4aabd12b65f307469d52b2d499e3ed81ebf08 [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001# Copyright (c) 2015 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
14AUTOMAKE_OPTIONS = foreign subdir-objects
15ACLOCAL_AMFLAGS = -I m4
16AM_CFLAGS = -Wall
17
18noinst_PROGRAMS =
19BUILT_SOURCES =
20bin_PROGRAMS =
21CLEANFILES =
22lib_LTLIBRARIES =
23
Dave Wallacebf8c15e2015-12-17 20:54:54 -050024nobase_include_HEADERS = \
25 japi/org_openvpp_vppjapi_vppApi.h \
Ed Warnickecb9cada2015-12-08 15:45:58 -070026 japi/org_openvpp_vppjapi_vppConn.h
27
28lib_LTLIBRARIES += libvppjni.la
29
Robert Varga81d99ac2016-01-30 18:30:36 +010030libvppjni_la_SOURCES = japi/vppjni.c japi/vppapi.c japi/vppjni_env.h japi/vppjni_env.c
Ed Warnickecb9cada2015-12-08 15:45:58 -070031libvppjni_la_LIBADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra \
32 -lpthread -lm -lrt
33libvppjni_la_LDFLAGS = -module
Robert Varga31424302016-01-30 18:37:58 +010034libvppjni_la_CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
Ed Warnickecb9cada2015-12-08 15:45:58 -070035
36jarfile = vppjapi-$(PACKAGE_VERSION).jar
37packagedir = org/openvpp/vppjapi
38JAVAROOT = .
39
40$(jarfile): libvppjni.la
41 cd .libs ; $(JAR) cf $(JARFLAGS) ../$@ libvppjni.so.0.0.0 ../$(packagedir)/*.class ; cd ..
42
43BUILT_SOURCES += japi/org_openvpp_vppjapi_vppConn.h japi/vppapi.c
44
Dave Wallacebf8c15e2015-12-17 20:54:54 -050045japi/org_openvpp_vppjapi_vppConn.h: \
46 japi/org/openvpp/vppjapi/vppVersion.java \
47 japi/org/openvpp/vppjapi/vppInterfaceDetails.java \
48 japi/org/openvpp/vppjapi/vppInterfaceCounters.java \
49 japi/org/openvpp/vppjapi/vppBridgeDomainDetails.java \
50 japi/org/openvpp/vppjapi/vppBridgeDomainInterfaceDetails.java \
51 japi/org/openvpp/vppjapi/vppL2Fib.java \
52 japi/org/openvpp/vppjapi/vppIPv4Address.java \
53 japi/org/openvpp/vppjapi/vppIPv6Address.java \
54 japi/org/openvpp/vppjapi/vppVxlanTunnelDetails.java \
55 japi/org/openvpp/vppjapi/vppConn.java \
56 japi/org/openvpp/vppjapi/vppApiCallbacks.java \
Ole Troan6855f6c2016-04-09 03:16:30 +020057 ../../vpp/api/vpe.api.h
Dave Wallacebf8c15e2015-12-17 20:54:54 -050058 $(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppVersion.java ; \
59 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppVersion ; \
60 $(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppInterfaceDetails.java ; \
61 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppInterfaceDetails ; \
62 $(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppInterfaceCounters.java ; \
Ed Warnickecb9cada2015-12-08 15:45:58 -070063 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppInterfaceCounters ; \
Dave Wallacebf8c15e2015-12-17 20:54:54 -050064 $(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppBridgeDomainInterfaceDetails.java ; \
65 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppBridgeDomainInterfaceDetails ; \
66 $(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppBridgeDomainDetails.java ; \
Ed Warnickecb9cada2015-12-08 15:45:58 -070067 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppBridgeDomainDetails ; \
Dave Wallacebf8c15e2015-12-17 20:54:54 -050068 $(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppL2Fib.java ; \
69 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppL2Fib ; \
70 $(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppIPv4Address.java ; \
71 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppIPv4Address ; \
72 $(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppIPv6Address.java ; \
73 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppIPv6Address ; \
74 $(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppVxlanTunnelDetails.java ; \
75 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppVxlanTunnelDetails ; \
76 $(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppConn.java ; \
Ed Warnickecb9cada2015-12-08 15:45:58 -070077 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppConn ;
78
Dave Wallacebf8c15e2015-12-17 20:54:54 -050079japi/vppapi.c: japi/org_openvpp_vppjapi_vppConn.h
80 pushd .. ; dir=`pwd` ; popd ; \
81 instdir=`echo $${dir} | sed -e 's:build-root/build:build-root/install:'` ; \
Ole Troan6855f6c2016-04-09 03:16:30 +020082 vppapigen --input $${instdir}/../vpp/api/vpe.api --jni japi/vppapi.c --app vpe ; \
83 vppapigen --input $${instdir}/../vpp/api/vpe.api --java japi/vppApi.java --app vpe ; \
Ed Warnickecb9cada2015-12-08 15:45:58 -070084 $(JAVAC) -classpath . -d . japi/vppApi.java ; \
Dave Wallacebf8c15e2015-12-17 20:54:54 -050085 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppApi ; \
Ed Warnickecb9cada2015-12-08 15:45:58 -070086 $(JAVAC) -classpath . -d . @srcdir@/japi/org/openvpp/vppjapi/vppApiCallbacks.java ; \
87 $(JAVAH) -classpath . -d japi org.openvpp.vppjapi.vppApiCallbacks ;
88
89demo = japi/test/demo.class
90$(demo): $(jarfile)
91 $(JAVAC) -cp $(jarfile) -d $(JAVAROOT) @srcdir@/japi/test/demo.java
92
Marek Gradzkid85036f2016-04-26 12:09:05 +020093#
94# jVpp binding
95#
96
97nobase_include_HEADERS += \
98 jvpp/org_openvpp_jvpp_VppJNIConnection.h
99
100lib_LTLIBRARIES += libjvpp.la
101
102libjvpp_la_SOURCES = jvpp/jvpp.c
103libjvpp_la_LIBADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra \
104 -lpthread -lm -lrt
105libjvpp_la_LDFLAGS = -module
106libjvpp_la_CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
107
108# todo make two jars api jar and impl jar
109jarfile_jvpp = jvpp-$(PACKAGE_VERSION).jar
110packagedir_jvpp = org/openvpp/jvpp
111JAVAROOT = .
112
113BUILT_SOURCES += jvpp/org_openvpp_jvpp_VppJNIConnection.h jvpp/jvpp.c
114
115jvpp/org_openvpp_jvpp_VppJNIConnection.h: $(prefix)/../vpp/api/vpe.api
116 @echo " jVpp API"; \
Maros Marsalek0e0c99f2016-05-12 10:31:35 +0200117 cp -rf @srcdir@/jvpp/* -t jvpp/; \
118 mkdir -p jvpp/gen/target/org/openvpp/jvpp; \
119 cp -rf jvpp/org/openvpp/jvpp/* -t jvpp/gen/target/org/openvpp/jvpp/; \
Marek Gradzkid85036f2016-04-26 12:09:05 +0200120 $(CC) $(CPPFLAGS) -E -P -C -x c $< \
121 | vppapigen --input - --python defs_vpp_papi.py; \
Maros Marsalek0e0c99f2016-05-12 10:31:35 +0200122 mkdir -p dto future callfacade callback; \
123 ./jvpp/gen/jvpp_gen.py -i defs_vpp_papi.py; \
124 cp -rf dto future callfacade callback *.java -t jvpp/gen/target/org/openvpp/jvpp/; \
125 cp -rf jvpp_gen.h -t jvpp/gen/target; \
126 rm -rf dto future callfacade callback *.java jvpp_gen.h; \
127 $(JAVAC) -classpath . -d . jvpp/gen/target/org/openvpp/jvpp/*.java \
128 jvpp/gen/target/org/openvpp/jvpp/dto/*.java \
129 jvpp/gen/target/org/openvpp/jvpp/callback/*.java \
130 jvpp/gen/target/org/openvpp/jvpp/callfacade/*.java \
131 jvpp/gen/target/org/openvpp/jvpp/future/*.java \
132 jvpp/gen/target/org/openvpp/jvpp/test/*.java \
133 || (echo "JVpp compilation failed: $$?"; exit 1); \
134 $(JAVAH) -classpath . -d jvpp org.openvpp.jvpp.VppJNIConnection ; \
Marek Gradzkid85036f2016-04-26 12:09:05 +0200135 $(JAVAH) -classpath . -d jvpp org.openvpp.jvpp.JVppImpl ;
136
137$(jarfile_jvpp): libjvpp.la
Maros Marsalek0e0c99f2016-05-12 10:31:35 +0200138 cd .libs ; $(JAR) cf $(JARFLAGS) ../$@ libjvpp.so.0.0.0 ../$(packagedir_jvpp)/* ; cd ..;
Marek Gradzkid85036f2016-04-26 12:09:05 +0200139
140all-local: $(jarfile) $(jarfile_jvpp) $(demo)