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
17 AM_CFLAGS = -Wall -I${top_srcdir} -I${top_builddir} \
18 -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux \
19 -I@top_srcdir@/plugins -I@top_builddir@/plugins
21 AM_LDFLAGS = -module -shared -avoid-version -rpath /none -no-undefined
33 noinst_LTLIBRARIES += libjvpp_common.la
34 libjvpp_common_la_SOURCES = jvpp-common/jvpp_common.c
35 libjvpp_common_la_LDFLAGS =
38 # jvpp-registry (connection management + plugin registry)
41 noinst_LTLIBRARIES += libjvpp_registry.la
43 libjvpp_registry_la_SOURCES = jvpp-registry/jvpp_registry.c
44 libjvpp_registry_la_CPPFLAGS = -Ijvpp-registry
45 libjvpp_registry_la_LIBAD = libjvpp_common.la
47 packagedir_jvpp_registry = io/fd/vpp/jvpp
48 jvpp_registry_src_files := \
49 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/*.java) \
50 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/**/*.java)
52 BUILT_SOURCES += jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
53 CLEANDIRS += jvpp-registry/target
54 JAR_FILES += jvpp-registry-$(PACKAGE_VERSION).jar
56 jvpp_registry_ok = jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
58 jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h: $(jvpp_registry_src_files)
60 @rm -rf jvpp-registry/target
61 @mkdir -p jvpp-registry/target
62 @$(JAVAC) -d jvpp-registry/target $^
63 @$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.jvpp.VppJNIConnection
64 @$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.jvpp.JVppRegistryImpl
65 @touch jvpp-registry.ok
69 @rm -rf jvpp-$(1)/target
70 @ @srcdir@/jvpp/gen/jvpp_gen.py --plugin_name $(1) --root_dir jvpp-$(1) \
71 -i $(jvpp_$(1)_json_files) > /dev/null
72 @find jvpp-$(1)/target -name \*.java > jvpp-$(1).files
73 @$(JAVAC) -classpath jvpp-registry/target \
74 -d jvpp-$(1)/target @jvpp-$(1).files
76 -classpath jvpp-registry/target:jvpp-$(1)/target \
77 -d jvpp-$(1) io.fd.vpp.jvpp.$(1).$(2)
81 # jvpp-core (Java wrapper for vpe.api)
83 noinst_LTLIBRARIES += libjvpp_core.la
84 libjvpp_core_la_SOURCES = jvpp-core/jvpp_core.c jvpp-core/jvpp_core_gen.h
85 libjvpp_core_la_CPPFLAGS = -Ijvpp-registry -Ijvpp-core
86 BUILT_SOURCES += jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h
88 JAR_FILES += jvpp-core-$(PACKAGE_VERSION).jar
89 CLEANDIRS += jvpp-core/target
90 jvpp_core_json_files = $(shell find @top_builddir@/vnet/ -type f -name '*.api.json')
92 jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: $(jvpp_registry_ok) $(jvpp_core_json_files)
93 $(call japigen,core,JVppCoreImpl)
99 noinst_LTLIBRARIES += libjvpp_acl.la
100 libjvpp_acl_la_SOURCES = jvpp-acl/jvpp_acl.c
101 libjvpp_acl_la_CPPFLAGS = -Ijvpp-acl
103 BUILT_SOURCES += jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h
105 JAR_FILES += jvpp-acl-$(PACKAGE_VERSION).jar
106 CLEANDIRS += jvpp-acl/target
108 jvpp_acl_json_files = @top_builddir@/plugins/acl/acl.api.json
110 jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h: $(jvpp_registry_ok) $(jvpp_acl_json_files)
111 $(call japigen,acl,JVppAclImpl)
117 if ENABLE_SNAT_PLUGIN
118 noinst_LTLIBRARIES += libjvpp_snat.la
119 libjvpp_snat_la_SOURCES = jvpp-snat/jvpp_snat.c
120 libjvpp_snat_la_CPPFLAGS = -Ijvpp-snat
122 BUILT_SOURCES += jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h
124 JAR_FILES += jvpp-snat-$(PACKAGE_VERSION).jar
125 CLEANDIRS += jvpp-snat/target
127 jvpp_snat_json_files = @top_builddir@/plugins/snat/snat.api.json
129 jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_json_files)
130 $(call japigen,snat,JVppSnatImpl)
136 if ENABLE_IOAM_PLUGIN
137 noinst_LTLIBRARIES += libjvpp_ioamtrace.la
138 libjvpp_ioamtrace_la_SOURCES = jvpp-ioamtrace/jvpp_ioam_trace.c
140 BUILT_SOURCES += jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h
141 JAR_FILES += jvpp-ioamtrace-$(PACKAGE_VERSION).jar
142 CLEANDIRS += jvpp-ioamtrace/target
144 jvpp_ioamtrace_json_files = @top_builddir@/plugins/ioam/lib-trace/trace.api.json
146 jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h: $(jvpp_registry_ok) $(jvpp_ioamtrace_json_files)
147 $(call japigen,ioamtrace,JVppIoamtraceImpl)
152 noinst_LTLIBRARIES += libjvpp_ioampot.la
153 libjvpp_ioampot_la_SOURCES = jvpp-ioampot/jvpp_ioam_pot.c
155 BUILT_SOURCES += jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h
156 JAR_FILES += jvpp-ioampot-$(PACKAGE_VERSION).jar
157 CLEANDIRS += jvpp-ioampot/target
159 jvpp_ioampot_json_files = @top_builddir@/plugins/ioam/lib-pot/pot.api.json
161 jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h: $(jvpp_registry_ok) $(jvpp_ioampot_json_files)
162 $(call japigen,ioampot,JVppIoampotImpl)
167 noinst_LTLIBRARIES += libjvpp_ioamexport.la
168 libjvpp_ioamexport_la_SOURCES = jvpp-ioamexport/jvpp_ioam_export.c
170 BUILT_SOURCES += jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h
171 JAR_FILES += jvpp-ioamexport-$(PACKAGE_VERSION).jar
172 CLEANDIRS += jvpp-ioamexport/target
174 jvpp_ioamexport_json_files = @top_builddir@/plugins/ioam/export/ioam_export.api.json
176 jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h: $(jvpp_registry_ok) $(jvpp_ioamexport_json_files)
177 $(call japigen,ioamexport,JVppIoamexportImpl)
183 jvpp-%-$(PACKAGE_VERSION).jar: libjvpp_%.la
185 @cp .libs/libjvpp_$*.so jvpp-$*/target
186 @$(JAR) cf $(JARFLAGS) $@ -C jvpp-$*/target .
188 jardir = $(prefix)/share/java
189 jar_DATA = $(JAR_FILES)
191 all-local: $(JAR_FILES)
196 CLEANFILES = jvpp-registry.ok $(JAR_FILES) $(BUILT_SOURCES)