1 # 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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
14 AUTOMAKE_OPTIONS = foreign
15 ACLOCAL_AMFLAGS = -I m4
16 AM_LIBTOOLFLAGS = --quiet
18 AM_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
22 AM_LDFLAGS = -module -shared -avoid-version -rpath /none -no-undefined
34 nobase_include_HEADERS = \
35 jvpp-common/jvpp_common.h
37 noinst_LTLIBRARIES += libjvpp_common.la
38 libjvpp_common_la_SOURCES = jvpp-common/jvpp_common.c
39 libjvpp_common_la_LDFLAGS =
42 # jvpp-registry (connection management + plugin registry)
45 noinst_LTLIBRARIES += libjvpp_registry.la
47 libjvpp_registry_la_SOURCES = jvpp-registry/jvpp_registry.c
48 libjvpp_registry_la_CPPFLAGS = -Ijvpp-registry
49 libjvpp_registry_la_LIBAD = libjvpp_common.la
51 packagedir_jvpp_registry = io/fd/vpp/jvpp
52 jvpp_registry_src_files := \
53 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/*.java) \
54 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/**/*.java)
56 BUILT_SOURCES += jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
57 CLEANDIRS += jvpp-registry/target
58 JAR_FILES += jvpp-registry-$(PACKAGE_VERSION).jar
60 jvpp_registry_ok = jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
62 jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h: $(jvpp_registry_src_files)
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
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
76 @find jvpp-$(1)/target -name \*.java > jvpp-$(1).generated.files
77 @find @srcdir@/jvpp-$(1) -name \*.java > jvpp-$(1).static.files
78 @$(JAVAC) -classpath jvpp-registry/target \
79 -d jvpp-$(1)/target @jvpp-$(1).generated.files @jvpp-$(1).static.files
81 -classpath jvpp-registry/target:jvpp-$(1)/target \
82 -d jvpp-$(1) io.fd.vpp.jvpp.$(1).$(2)
86 # jvpp-core (Java wrapper for vpe.api)
88 noinst_LTLIBRARIES += libjvpp_core.la
89 libjvpp_core_la_SOURCES = jvpp-core/jvpp_core.c jvpp-core/jvpp_core_gen.h
90 libjvpp_core_la_CPPFLAGS = -Ijvpp-registry -Ijvpp-core
91 BUILT_SOURCES += jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h
93 JAR_FILES += jvpp-core-$(PACKAGE_VERSION).jar
94 CLEANDIRS += jvpp-core/target
95 jvpp_core_json_files = $(shell find @top_builddir@/vnet/ -type f -name '*.api.json')
96 jvpp_core_json_files += @top_builddir@/vpp/api/vpe.api.json
98 jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: $(jvpp_registry_ok) $(jvpp_core_json_files)
99 $(call japigen,core,JVppCoreImpl)
105 noinst_LTLIBRARIES += libjvpp_acl.la
106 libjvpp_acl_la_SOURCES = jvpp-acl/jvpp_acl.c
107 libjvpp_acl_la_CPPFLAGS = -Ijvpp-acl
109 BUILT_SOURCES += jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h
111 JAR_FILES += jvpp-acl-$(PACKAGE_VERSION).jar
112 CLEANDIRS += jvpp-acl/target
114 jvpp_acl_json_files = @top_builddir@/plugins/acl/acl.api.json
116 jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h: $(jvpp_registry_ok) $(jvpp_acl_json_files)
117 $(call japigen,acl,JVppAclImpl)
123 if ENABLE_SNAT_PLUGIN
124 noinst_LTLIBRARIES += libjvpp_snat.la
125 libjvpp_snat_la_SOURCES = jvpp-snat/jvpp_snat.c
126 libjvpp_snat_la_CPPFLAGS = -Ijvpp-snat
128 BUILT_SOURCES += jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h
130 JAR_FILES += jvpp-snat-$(PACKAGE_VERSION).jar
131 CLEANDIRS += jvpp-snat/target
133 jvpp_snat_json_files = @top_builddir@/plugins/snat/snat.api.json
135 jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_json_files)
136 $(call japigen,snat,JVppSnatImpl)
142 if ENABLE_IOAM_PLUGIN
143 noinst_LTLIBRARIES += libjvpp_ioamtrace.la
144 libjvpp_ioamtrace_la_SOURCES = jvpp-ioamtrace/jvpp_ioam_trace.c
146 BUILT_SOURCES += jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h
147 JAR_FILES += jvpp-ioamtrace-$(PACKAGE_VERSION).jar
148 CLEANDIRS += jvpp-ioamtrace/target
150 jvpp_ioamtrace_json_files = @top_builddir@/plugins/ioam/lib-trace/trace.api.json
152 jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h: $(jvpp_registry_ok) $(jvpp_ioamtrace_json_files)
153 $(call japigen,ioamtrace,JVppIoamtraceImpl)
158 noinst_LTLIBRARIES += libjvpp_ioampot.la
159 libjvpp_ioampot_la_SOURCES = jvpp-ioampot/jvpp_ioam_pot.c
161 BUILT_SOURCES += jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h
162 JAR_FILES += jvpp-ioampot-$(PACKAGE_VERSION).jar
163 CLEANDIRS += jvpp-ioampot/target
165 jvpp_ioampot_json_files = @top_builddir@/plugins/ioam/lib-pot/pot.api.json
167 jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h: $(jvpp_registry_ok) $(jvpp_ioampot_json_files)
168 $(call japigen,ioampot,JVppIoampotImpl)
173 noinst_LTLIBRARIES += libjvpp_ioamexport.la
174 libjvpp_ioamexport_la_SOURCES = jvpp-ioamexport/jvpp_ioam_export.c
176 BUILT_SOURCES += jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h
177 JAR_FILES += jvpp-ioamexport-$(PACKAGE_VERSION).jar
178 CLEANDIRS += jvpp-ioamexport/target
180 jvpp_ioamexport_json_files = @top_builddir@/plugins/ioam/export/ioam_export.api.json
182 jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h: $(jvpp_registry_ok) $(jvpp_ioamexport_json_files)
183 $(call japigen,ioamexport,JVppIoamexportImpl)
189 jvpp-%-$(PACKAGE_VERSION).jar: libjvpp_%.la
191 @cp .libs/libjvpp_$*.so jvpp-$*/target
192 @$(JAR) cf $(JARFLAGS) $@ -C jvpp-$*/target .
194 jardir = $(prefix)/share/java
195 jar_DATA = $(JAR_FILES)
197 all-local: $(JAR_FILES)
202 CLEANFILES = jvpp-registry.ok $(JAR_FILES) $(BUILT_SOURCES)