summaryrefslogtreecommitdiffstats
path: root/vpp-api/java/Makefile.am
blob: 1d0a675853606337d01abb5a08b1f37809046b12 (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
123
124
125
126
127
128
129
130
131
# 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 = -Ijvpp-registry -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 = io/fd/vpp/jvpp

BUILT_SOURCES += jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h

jvpp_registry_src_files := $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/*.java) $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/**/*.java)

jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h: $(jvpp_registry_src_files)
	@echo " jvpp-registry.jar generation"
	mkdir -p jvpp-registry/target
	$(JAVAC) -d jvpp-registry/target $(jvpp_registry_src_files)
	$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.jvpp.VppJNIConnection
	$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.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

jarfile_jvpp_core = jvpp-core-$(PACKAGE_VERSION).jar
packagedir_jvpp_core = io/fd/vpp/jvpp/core

BUILT_SOURCES += jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h

jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h:		\
    jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h	\
    $(prefix)/../vnet/vnet/af_packet.api.json		\
    $(prefix)/../vnet/vnet/netmap.api.json		\
    $(prefix)/../vnet/vnet/vhost_user.api.json		\
    $(prefix)/../vpp/vpp-api/vpe.api.json		\
    $(prefix)/../vnet/vnet/ip.api.json 			\
    $(prefix)/../vnet/vnet/tap.api.json 		\
    $(prefix)/../vnet/vnet/vxlan.api.json		\
    $(prefix)/../vnet/vnet/vxlan_gpe.api.json
	cp -rf @srcdir@/jvpp-core/* -t jvpp-core/
	mkdir -p jvpp-core/target
	cd jvpp-core \
		&& mkdir -p types dto future callfacade callback notification \
		&& @srcdir@/jvpp/gen/jvpp_gen.py  --plugin_name core \
		    -i $(prefix)/../vpp/vpp-api/vpe.api.json \
		    $(prefix)/../vnet/vnet/af_packet.api.json \
		    $(prefix)/../vnet/vnet/netmap.api.json \
		    $(prefix)/../vnet/vnet/vhost_user.api.json \
		    $(prefix)/../vnet/vnet/interface.api.json \
		    $(prefix)/../vnet/vnet/l2.api.json \
		    $(prefix)/../vnet/vnet/map.api.json \
		    $(prefix)/../vnet/vnet/ip.api.json \
		    $(prefix)/../vnet/vnet/span.api.json \
		    $(prefix)/../vnet/vnet/tap.api.json \
		    $(prefix)/../vnet/vnet/vxlan.api.json \
		    $(prefix)/../vnet/vnet/vxlan_gpe.api.json \
		&& cp -rf types dto future callfacade callback notification *.java -t $(packagedir_jvpp_core) \
		&& rm -rf types dto future callfacade callback notification *.java

	$(JAVAC) -classpath jvpp-registry/target -d jvpp-core/target jvpp-core/$(packagedir_jvpp_core)/*.java \
		jvpp-core/$(packagedir_jvpp_core)/types/*.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) -force -classpath jvpp-registry/target:jvpp-core/target -d jvpp-core io.fd.vpp.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)