summaryrefslogtreecommitdiffstats
path: root/vpp-api/java/Makefile.am
blob: 8e3d45731ed02f51d68d042558355ee863254ec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Copyright (c) 2015 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

AUTOMAKE_OPTIONS = foreign subdir-objects
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -Wall 

noinst_PROGRAMS = 
BUILT_SOURCES =
bin_PROGRAMS = 
CLEANFILES = 
lib_LTLIBRARIES = 

#
# jvpp-common
#

nobase_include_HEADERS =		\
  jvpp-common/jvpp_common.h

lib_LTLIBRARIES += libjvpp_common.la

libjvpp_common_la_SOURCES = jvpp-common/jvpp_common.c
libjvpp_common_la_LIBADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra \
	              -lpthread -lm -lrt
libjvpp_common_la_LDFLAGS = -module
libjvpp_common_la_CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux


#
# jvpp-registry (connection management + plugin registry)
#
lib_LTLIBRARIES += libjvpp_registry.la

libjvpp_registry_la_SOURCES = jvpp-registry/jvpp_registry.c
libjvpp_registry_la_LIBADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra \
	              -lpthread -lm -lrt -ljvpp_common
libjvpp_registry_la_LDFLAGS = -module
libjvpp_registry_la_CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
EXTRA_libjvpp_registry_la_DEPENDENCIES=libjvpp_common.la

jarfile_jvpp_registry = jvpp-registry-$(PACKAGE_VERSION).jar
packagedir_jvpp_registry = org/openvpp/jvpp

BUILT_SOURCES += jvpp-registry/org_openvpp_jvpp_VppJNIConnection.h


jvpp-registry/org_openvpp_jvpp_VppJNIConnection.h:
	@echo " jvpp-registry.jar generation ";				\
	mkdir -p jvpp-registry/target;				\
	cp -rf @srcdir@/jvpp-registry/* -t jvpp-registry/;
	$(JAVAC) -d jvpp-registry/target jvpp-registry/$(packagedir_jvpp_registry)/*.java \
		jvpp-registry/$(packagedir_jvpp_registry)/dto/*.java  \
		jvpp-registry/$(packagedir_jvpp_registry)/callback/*.java \
		jvpp-registry/$(packagedir_jvpp_registry)/notification/*.java \
		jvpp-registry/$(packagedir_jvpp_registry)/future/*.java 	\
		jvpp-registry/$(packagedir_jvpp_registry)/test/*.java 	\
		|| (echo "jvpp-registry compilation failed: $$?"; exit 1);	\
	$(JAVAH) -classpath jvpp-registry/target -d jvpp-registry org.openvpp.jvpp.VppJNIConnection ;
	$(JAVAH) -classpath jvpp-registry/target -d jvpp-registry org.openvpp.jvpp.JVppRegistryImpl ;

$(jarfile_jvpp_registry): libjvpp_registry.la
	cp .libs/libjvpp_registry.so.0.0.0 jvpp-registry/target;	\
	$(JAR) cf $(JARFLAGS) $@ -C jvpp-registry/target .;

#
# jvpp-core (Java wrapper for vpe.api)
#
lib_LTLIBRARIES += libjvpp_core.la

libjvpp_core_la_SOURCES = jvpp-core/jvpp_core.c jvpp-core/jvpp_core_gen.h
libjvpp_core_la_LIBADD = -lvlibmemoryclient -lvlibapi -lsvm -lvppinfra \
	              -lpthread -lm -lrt -ljvpp_common
libjvpp_core_la_LDFLAGS = -module
libjvpp_core_la_CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
EXTRA_libjvpp_core_la_DEPENDENCIES=libjvpp_registry.la

jarfile_jvpp_core = jvpp-core-$(PACKAGE_VERSION).jar
packagedir_jvpp_core = org/openvpp/jvpp/core
api_file = $(prefix)/../vpp/vpp-api/vpe.api

BUILT_SOURCES += jvpp-core/org_openvpp_jvpp_core_JVppCoreImpl.h


defs_vpp_papi.py:
	@echo "jVpp API";				\
	vppapigen --input $(api_file) --python jvpp-core/defs_vpp_papi.py;

jvpp-core/org_openvpp_jvpp_core_JVppCoreImpl.h: jvpp-registry/org_openvpp_jvpp_VppJNIConnection.h defs_vpp_papi.py 
	cp -rf @srcdir@/jvpp-core/* -t jvpp-core/; \
	mkdir -p jvpp-core/target; \
	cd jvpp-core; \
	mkdir dto future callfacade callback notification; \
	@srcdir@/jvpp/gen/jvpp_gen.py -i defs_vpp_papi.py --plugin_name core; \
	cp -rf dto future callfacade callback notification *.java -t $(packagedir_jvpp_core); \
	rm -rf dto future callfacade callback notification *.java; \
	cd ..; \
	$(JAVAC) -classpath jvpp-registry/target -d jvpp-core/target jvpp-core/$(packagedir_jvpp_core)/*.java \
		jvpp-core/$(packagedir_jvpp_core)/dto/*.java \
		jvpp-core/$(packagedir_jvpp_core)/callback/*.java \
		jvpp-core/$(packagedir_jvpp_core)/notification/*.java \
		jvpp-core/$(packagedir_jvpp_core)/future/*.java 	\
		jvpp-core/$(packagedir_jvpp_core)/callfacade/*.java 	\
		jvpp-core/$(packagedir_jvpp_core)/test/*.java \
		|| (echo "jvpp-core compilation failed: $$?"; exit 1); \
	$(JAVAH) -classpath jvpp-registry/target:jvpp-core/target -d jvpp-core org.openvpp.jvpp.core.JVppCoreImpl ;
	
$(jarfile_jvpp_core): libjvpp_core.la
	cp .libs/libjvpp_core.so.0.0.0 jvpp-core/target;	\
	$(JAR) cf $(JARFLAGS) $@ -C jvpp-core/target .;

all-local: $(jarfile_jvpp_registry) $(jarfile_jvpp_core)