blob: 00ee5946945eb7904135a9b37f6bdf15b1397917 [file] [log] [blame]
Damjan Marioncb034b92016-12-28 18:38:59 +01001# 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
14AUTOMAKE_OPTIONS = foreign
15ACLOCAL_AMFLAGS = -I m4
Damjan Marion724f64c2017-01-11 11:11:00 +010016AM_LIBTOOLFLAGS = --quiet
Damjan Marioncb034b92016-12-28 18:38:59 +010017
18AM_CFLAGS = -Wall -I${top_srcdir} -I${top_builddir} \
19 -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux \
20 -I@top_srcdir@/plugins -I@top_builddir@/plugins
21
22AM_LDFLAGS = -module -shared -avoid-version -rpath /none -no-undefined
23
24BUILT_SOURCES =
25bin_PROGRAMS =
26noinst_LTLIBRARIES =
27JAR_FILES =
28CLEANDIRS =
29
30#
31# jvpp-common
32#
33
Damjan Marion71f87422017-01-03 11:17:19 +010034nobase_include_HEADERS = \
35 jvpp-common/jvpp_common.h
36
Damjan Marioncb034b92016-12-28 18:38:59 +010037noinst_LTLIBRARIES += libjvpp_common.la
38libjvpp_common_la_SOURCES = jvpp-common/jvpp_common.c
39libjvpp_common_la_LDFLAGS =
40
41#
42# jvpp-registry (connection management + plugin registry)
43#
44
45noinst_LTLIBRARIES += libjvpp_registry.la
46
47libjvpp_registry_la_SOURCES = jvpp-registry/jvpp_registry.c
48libjvpp_registry_la_CPPFLAGS = -Ijvpp-registry
49libjvpp_registry_la_LIBAD = libjvpp_common.la
50
51packagedir_jvpp_registry = io/fd/vpp/jvpp
52jvpp_registry_src_files := \
53 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/*.java) \
54 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/**/*.java)
55
56BUILT_SOURCES += jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
57CLEANDIRS += jvpp-registry/target
58JAR_FILES += jvpp-registry-$(PACKAGE_VERSION).jar
59
60jvpp_registry_ok = jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
61
62jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h: $(jvpp_registry_src_files)
63 @echo " JAPIGEN $@"
64 @rm -rf jvpp-registry/target
65 @mkdir -p jvpp-registry/target
66 @$(JAVAC) -d jvpp-registry/target $^
67 @$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.jvpp.VppJNIConnection
68 @$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.jvpp.JVppRegistryImpl
69 @touch jvpp-registry.ok
70
71define japigen
72 @echo " JAPIGEN $@"
73 @rm -rf jvpp-$(1)/target
74 @ @srcdir@/jvpp/gen/jvpp_gen.py --plugin_name $(1) --root_dir jvpp-$(1) \
75 -i $(jvpp_$(1)_json_files) > /dev/null
Marek Gradzki94f8bc12017-01-10 16:43:53 +010076 @find jvpp-$(1)/target -name \*.java > jvpp-$(1).generated.files
77 @find @srcdir@/jvpp-$(1) -name \*.java > jvpp-$(1).static.files
Damjan Marioncb034b92016-12-28 18:38:59 +010078 @$(JAVAC) -classpath jvpp-registry/target \
Marek Gradzki94f8bc12017-01-10 16:43:53 +010079 -d jvpp-$(1)/target @jvpp-$(1).generated.files @jvpp-$(1).static.files
Damjan Marioncb034b92016-12-28 18:38:59 +010080 @$(JAVAH) -force \
81 -classpath jvpp-registry/target:jvpp-$(1)/target \
82 -d jvpp-$(1) io.fd.vpp.jvpp.$(1).$(2)
83endef
84
85#
86# jvpp-core (Java wrapper for vpe.api)
87#
88noinst_LTLIBRARIES += libjvpp_core.la
89libjvpp_core_la_SOURCES = jvpp-core/jvpp_core.c jvpp-core/jvpp_core_gen.h
90libjvpp_core_la_CPPFLAGS = -Ijvpp-registry -Ijvpp-core
91BUILT_SOURCES += jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h
92
93JAR_FILES += jvpp-core-$(PACKAGE_VERSION).jar
94CLEANDIRS += jvpp-core/target
95jvpp_core_json_files = $(shell find @top_builddir@/vnet/ -type f -name '*.api.json')
Jan Srnicekef6e54d2017-01-05 12:42:00 +010096jvpp_core_json_files += @top_builddir@/vpp/api/vpe.api.json
Damjan Marioncb034b92016-12-28 18:38:59 +010097
98jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: $(jvpp_registry_ok) $(jvpp_core_json_files)
99 $(call japigen,core,JVppCoreImpl)
100
101#
102# ACL Plugin
103#
104if ENABLE_ACL_PLUGIN
105noinst_LTLIBRARIES += libjvpp_acl.la
106libjvpp_acl_la_SOURCES = jvpp-acl/jvpp_acl.c
107libjvpp_acl_la_CPPFLAGS = -Ijvpp-acl
108
109BUILT_SOURCES += jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h
110
111JAR_FILES += jvpp-acl-$(PACKAGE_VERSION).jar
112CLEANDIRS += jvpp-acl/target
113
114jvpp_acl_json_files = @top_builddir@/plugins/acl/acl.api.json
115
116jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h: $(jvpp_registry_ok) $(jvpp_acl_json_files)
117 $(call japigen,acl,JVppAclImpl)
118endif
119
120#
121# SNAT Plugin
122#
123if ENABLE_SNAT_PLUGIN
124noinst_LTLIBRARIES += libjvpp_snat.la
125libjvpp_snat_la_SOURCES = jvpp-snat/jvpp_snat.c
126libjvpp_snat_la_CPPFLAGS = -Ijvpp-snat
127
128BUILT_SOURCES += jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h
129
130JAR_FILES += jvpp-snat-$(PACKAGE_VERSION).jar
131CLEANDIRS += jvpp-snat/target
132
133jvpp_snat_json_files = @top_builddir@/plugins/snat/snat.api.json
134
135jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_json_files)
136 $(call japigen,snat,JVppSnatImpl)
137endif
138
139#
140# iOAM Trace Plugin
141#
142if ENABLE_IOAM_PLUGIN
143noinst_LTLIBRARIES += libjvpp_ioamtrace.la
144libjvpp_ioamtrace_la_SOURCES = jvpp-ioamtrace/jvpp_ioam_trace.c
145
146BUILT_SOURCES += jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h
147JAR_FILES += jvpp-ioamtrace-$(PACKAGE_VERSION).jar
148CLEANDIRS += jvpp-ioamtrace/target
149
150jvpp_ioamtrace_json_files = @top_builddir@/plugins/ioam/lib-trace/trace.api.json
151
152jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h: $(jvpp_registry_ok) $(jvpp_ioamtrace_json_files)
153 $(call japigen,ioamtrace,JVppIoamtraceImpl)
154
155#
156# iOAM POT Plugin
157#
158noinst_LTLIBRARIES += libjvpp_ioampot.la
159libjvpp_ioampot_la_SOURCES = jvpp-ioampot/jvpp_ioam_pot.c
160
161BUILT_SOURCES += jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h
162JAR_FILES += jvpp-ioampot-$(PACKAGE_VERSION).jar
163CLEANDIRS += jvpp-ioampot/target
164
165jvpp_ioampot_json_files = @top_builddir@/plugins/ioam/lib-pot/pot.api.json
166
167jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h: $(jvpp_registry_ok) $(jvpp_ioampot_json_files)
168 $(call japigen,ioampot,JVppIoampotImpl)
169
170#
171# iOAM Export Plugin
172#
173noinst_LTLIBRARIES += libjvpp_ioamexport.la
174libjvpp_ioamexport_la_SOURCES = jvpp-ioamexport/jvpp_ioam_export.c
175
176BUILT_SOURCES += jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h
177JAR_FILES += jvpp-ioamexport-$(PACKAGE_VERSION).jar
178CLEANDIRS += jvpp-ioamexport/target
179
180jvpp_ioamexport_json_files = @top_builddir@/plugins/ioam/export/ioam_export.api.json
181
182jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h: $(jvpp_registry_ok) $(jvpp_ioamexport_json_files)
183 $(call japigen,ioamexport,JVppIoamexportImpl)
184endif
185
186#
187# JAR creation
188#
189jvpp-%-$(PACKAGE_VERSION).jar: libjvpp_%.la
190 @echo " JAR $@"
191 @cp .libs/libjvpp_$*.so jvpp-$*/target
192 @$(JAR) cf $(JARFLAGS) $@ -C jvpp-$*/target .
Damjan Marioncb034b92016-12-28 18:38:59 +0100193
194jardir = $(prefix)/share/java
195jar_DATA = $(JAR_FILES)
196
197all-local: $(JAR_FILES)
198
199#
200# Cleanup
201#
202CLEANFILES = jvpp-registry.ok $(JAR_FILES) $(BUILT_SOURCES)
203
204clean-local:
205 rm -rf $(CLEANDIRS)