d3f3c4f42491659fbd09e749b72faa1ac7755274
[vpp.git] / vpp-api / java / Makefile.am
1 # 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
14 AUTOMAKE_OPTIONS = foreign subdir-objects
15 ACLOCAL_AMFLAGS = -I m4
16 AM_CFLAGS = -Wall 
17
18 noinst_PROGRAMS = 
19 BUILT_SOURCES =
20 bin_PROGRAMS = 
21 CLEANFILES = 
22 lib_LTLIBRARIES = 
23
24 #
25 # jVpp binding
26 #
27
28 nobase_include_HEADERS =                \
29   jvpp/org_openvpp_jvpp_VppJNIConnection.h
30
31 lib_LTLIBRARIES += libjvpp.la
32
33 libjvpp_la_SOURCES = jvpp/jvpp.c
34 libjvpp_la_LIBADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra \
35                       -lpthread -lm -lrt
36 libjvpp_la_LDFLAGS = -module
37 libjvpp_la_CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
38
39 # todo make two jars api jar and impl jar
40 jarfile_jvpp = jvpp-$(PACKAGE_VERSION).jar
41 packagedir_jvpp = org/openvpp/jvpp
42 JAVAROOT = .
43
44 BUILT_SOURCES += jvpp/org_openvpp_jvpp_VppJNIConnection.h jvpp/jvpp.c
45
46 jvpp/org_openvpp_jvpp_VppJNIConnection.h: $(prefix)/../vpp/vpp-api/vpe.api
47         @echo "  jVpp API";                             \
48         cp -rf @srcdir@/jvpp/* -t jvpp/;                        \
49         mkdir -p jvpp/gen/target/org/openvpp/jvpp;                              \
50         cp -rf jvpp/org/openvpp/jvpp/* -t jvpp/gen/target/org/openvpp/jvpp/;    \
51         $(CC) $(CPPFLAGS) -E -P -C -x c $<                                        \
52         | vppapigen --input - --python defs_vpp_papi.py;                                \
53         mkdir -p dto future callfacade callback notification;   \
54         ./jvpp/gen/jvpp_gen.py -i defs_vpp_papi.py;                             \
55         cp -rf dto future callfacade callback notification *.java -t jvpp/gen/target/org/openvpp/jvpp/; \
56         cp -rf jvpp_gen.h -t jvpp/gen/target;   \
57         rm -rf dto future callfacade callback notification *.java jvpp_gen.h;   \
58         $(JAVAC) -classpath . -d . jvpp/gen/target/org/openvpp/jvpp/*.java \
59                 jvpp/gen/target/org/openvpp/jvpp/dto/*.java  \
60                 jvpp/gen/target/org/openvpp/jvpp/callback/*.java \
61                 jvpp/gen/target/org/openvpp/jvpp/notification/*.java \
62                 jvpp/gen/target/org/openvpp/jvpp/callfacade/*.java \
63                 jvpp/gen/target/org/openvpp/jvpp/future/*.java  \
64                 jvpp/gen/target/org/openvpp/jvpp/test/*.java    \
65                 || (echo "JVpp compilation failed: $$?"; exit 1);       \
66         $(JAVAH) -classpath . -d jvpp org.openvpp.jvpp.VppJNIConnection ;       \
67         $(JAVAH) -classpath . -d jvpp org.openvpp.jvpp.JVppImpl ;
68
69 $(jarfile_jvpp): libjvpp.la
70         cd .libs ; $(JAR) cf $(JARFLAGS) ../$@ libjvpp.so.0.0.0 ../$(packagedir_jvpp)/* ; cd ..;
71
72 all-local: $(jarfile_jvpp)