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