blob: d33ae82ff0df35a662eafbb1040c0fe746b3a99b [file] [log] [blame]
Damjan Marion09cce662018-09-27 18:02:28 +00001# 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 subdir-objects
15ACLOCAL_AMFLAGS = -I m4
16AM_LIBTOOLFLAGS = --quiet
17
18AM_CFLAGS = @CPU_FLAGS@ -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 = -shared -avoid-version -rpath /none -no-undefined
23
24BUILT_SOURCES =
25bin_PROGRAMS =
26noinst_LTLIBRARIES =
27JAR_FILES =
28CLEANDIRS =
29
30#
31# jvpp-common
32#
33
34nobase_include_HEADERS = \
35 jvpp-common/jvpp_common.h
36
37lib_LTLIBRARIES = libjvpp_common.la
38libjvpp_common_la_SOURCES = jvpp-common/jvpp_common.c
39libjvpp_common_la_LDFLAGS = shared -rpath /none -no-undefined -lvppinfra
40
41JVPP_LIBS = \
42 libjvpp_common.la \
43 -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lm -lrt
44
45#
46# jvpp-registry (connection management + plugin registry)
47#
48
49noinst_LTLIBRARIES += libjvpp_registry.la
50
51libjvpp_registry_la_SOURCES = jvpp-registry/jvpp_registry.c
52libjvpp_registry_la_CPPFLAGS = -Ijvpp-registry
53libjvpp_registry_la_LIBADD = $(JVPP_LIBS)
54libjvpp_registry_la_DEPENDENCIES = libjvpp_common.la
55
56packagedir_jvpp_registry = io/fd/vpp/jvpp
57jvpp_registry_src_files := \
58 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/*.java) \
59 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/**/*.java)
60
61BUILT_SOURCES += jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
62CLEANDIRS += jvpp-registry/target
63JAR_FILES += jvpp-registry-$(PACKAGE_VERSION).jar
64
65jvpp_registry_ok = jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
66
67jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h: $(jvpp_registry_src_files)
68 @echo " JVPP GEN $@"
69 @rm -rf jvpp-registry/target
70 @mkdir -p jvpp-registry/target
71 @$(JAVAC) -source 8 -target 8 -d jvpp-registry/target -h jvpp-registry $^
72 @touch jvpp-registry.ok
73
74define japigen
75 @echo " JVPP GEN $@"
76 @rm -rf jvpp-$(1)/target
77 @ @srcdir@/jvpp/gen/jvpp_gen.py --plugin_name $(1) --root_dir jvpp-$(1) \
78 -i $(jvpp_$(1)_json_files)
79 @find jvpp-$(1)/target -name \*.java > jvpp-$(1).generated.files
80 @find @srcdir@/jvpp-$(1) -name \*.java > jvpp-$(1).static.files
81 @$(JAVAC) -source 8 -target 8 -classpath jvpp-registry/target \
82 -d jvpp-$(1)/target -h jvpp-$(1) @jvpp-$(1).generated.files @jvpp-$(1).static.files
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
91libjvpp_core_la_LIBADD = $(JVPP_LIBS)
92libjvpp_core_la_DEPENDENCIES = libjvpp_common.la
93
94BUILT_SOURCES += jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h
95JAR_FILES += jvpp-core-$(PACKAGE_VERSION).jar
96CLEANDIRS += jvpp-core/target
97
98# Include all VPP API files
99jvpp_core_json_files = $(shell find @top_builddir@/../vpp/vnet -type f -name '*.api.json')
100jvpp_core_json_files += $(shell find @top_builddir@/../vpp/vpp -type f -name '*.api.json')
101# except for plugins and unsupported ones:
102# jvpp_core_json_files += @top_builddir@/vlibmemory/memclnt.api.json
103
104jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: $(jvpp_registry_ok) $(jvpp_core_json_files)
105 $(call japigen,core,JVppCoreImpl)
106
107#
108# ACL Plugin
109#
110if ENABLE_ACL_PLUGIN
111noinst_LTLIBRARIES += libjvpp_acl.la
112libjvpp_acl_la_SOURCES = jvpp-acl/jvpp_acl.c
113libjvpp_acl_la_CPPFLAGS = -Ijvpp-acl
114libjvpp_acl_la_LIBADD = $(JVPP_LIBS)
115libjvpp_acl_la_DEPENDENCIES = libjvpp_common.la
116
117BUILT_SOURCES += jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h
118JAR_FILES += jvpp-acl-$(PACKAGE_VERSION).jar
119CLEANDIRS += jvpp-acl/target
120
121jvpp_acl_json_files = @top_builddir@/../vpp/plugins/acl/acl.api.json
122
123jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h: $(jvpp_registry_ok) $(jvpp_acl_json_files)
124 $(call japigen,acl,JVppAclImpl)
125endif
126
127#
128# GTPU Plugin
129#
130if ENABLE_GTPU_PLUGIN
131noinst_LTLIBRARIES += libjvpp_gtpu.la
132libjvpp_gtpu_la_SOURCES = jvpp-gtpu/jvpp_gtpu.c
133libjvpp_gtpu_la_CPPFLAGS = -Ijvpp-gtpu
134libjvpp_gtpu_la_LIBADD = $(JVPP_LIBS)
135libjvpp_gtpu_la_DEPENDENCIES = libjvpp_common.la
136
137BUILT_SOURCES += jvpp-gtpu/io_fd_vpp_jvpp_gtpu_JVppGtpuImpl.h
138JAR_FILES += jvpp-gtpu-$(PACKAGE_VERSION).jar
139CLEANDIRS += jvpp-gtpu/target
140
141jvpp_gtpu_json_files = @top_builddir@/../vpp/plugins/gtpu/gtpu.api.json
142
143jvpp-gtpu/io_fd_vpp_jvpp_gtpu_JVppGtpuImpl.h: $(jvpp_registry_ok) $(jvpp_gtpu_json_files)
144 $(call japigen,gtpu,JVppGtpuImpl)
145endif
146
147#
148# PPPOE Plugin
149#
150if ENABLE_PPPOE_PLUGIN
151noinst_LTLIBRARIES += libjvpp_pppoe.la
152libjvpp_pppoe_la_SOURCES = jvpp-pppoe/jvpp_pppoe.c
153libjvpp_pppoe_la_CPPFLAGS = -Ijvpp-pppoe
154libjvpp_pppoe_la_LIBADD = $(JVPP_LIBS)
155libjvpp_pppoe_la_DEPENDENCIES = libjvpp_common.la
156
157BUILT_SOURCES += jvpp-pppoe/io_fd_vpp_jvpp_pppoe_JVppPppoeImpl.h
158JAR_FILES += jvpp-pppoe-$(PACKAGE_VERSION).jar
159CLEANDIRS += jvpp-pppoe/target
160
161jvpp_pppoe_json_files = @top_builddir@/../vpp/plugins/pppoe/pppoe.api.json
162
163jvpp-pppoe/io_fd_vpp_jvpp_pppoe_JVppPppoeImpl.h: $(jvpp_registry_ok) $(jvpp_pppoe_json_files)
164 $(call japigen,pppoe,JVppPppoeImpl)
165endif
166
167#
168# NAT Plugin
169#
170if ENABLE_NAT_PLUGIN
171noinst_LTLIBRARIES += libjvpp_nat.la
172libjvpp_nat_la_SOURCES = jvpp-nat/jvpp_nat.c
173libjvpp_nat_la_CPPFLAGS = -Ijvpp-nat
174libjvpp_nat_la_LIBADD = $(JVPP_LIBS)
175libjvpp_nat_la_DEPENDENCIES = libjvpp_common.la
176
177BUILT_SOURCES += jvpp-nat/io_fd_vpp_jvpp_nat_JVppNatImpl.h
178JAR_FILES += jvpp-nat-$(PACKAGE_VERSION).jar
179CLEANDIRS += jvpp-nat/target
180
181jvpp_nat_json_files = @top_builddir@/../vpp/plugins/nat/nat.api.json
182
183jvpp-nat/io_fd_vpp_jvpp_nat_JVppNatImpl.h: $(jvpp_registry_ok) $(jvpp_nat_json_files)
184 $(call japigen,nat,JVppNatImpl)
185endif
186
187#
188# NSH Plugin
189#
190if ENABLE_NSH_PLUGIN
191noinst_LTLIBRARIES += libjvpp_nsh.la
192libjvpp_nsh_la_SOURCES = jvpp-nsh/jvpp_nsh.c
193libjvpp_nsh_la_CPPFLAGS = -Ijvpp-nsh
194libjvpp_nsh_la_LIBADD = $(JVPP_LIBS)
195libjvpp_nsh_la_DEPENDENCIES = libjvpp_common.la
196
197BUILT_SOURCES += jvpp-nsh/io_fd_vpp_jvpp_nsh_JVppNshImpl.h
198JAR_FILES += jvpp-nsh-$(PACKAGE_VERSION).jar
199CLEANDIRS += jvpp-nsh/target
200
201jvpp_nsh_json_files = @top_builddir@/../vpp/plugins/nsh/nsh.api.json
202
203jvpp-nsh/io_fd_vpp_jvpp_nsh_JVppNshImpl.h: $(jvpp_registry_ok) $(jvpp_nsh_json_files)
204 $(call japigen,nsh,JVppNshImpl)
205endif
206
207#
208# iOAM Trace Plugin
209#
210if ENABLE_IOAM_PLUGIN
211noinst_LTLIBRARIES += libjvpp_ioamtrace.la
212libjvpp_ioamtrace_la_SOURCES = jvpp-ioamtrace/jvpp_ioam_trace.c
213libjvpp_ioamtrace_la_LIBADD = $(JVPP_LIBS)
214libjvpp_ioamtrace_la_DEPENDENCIES = libjvpp_common.la
215
216BUILT_SOURCES += jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h
217JAR_FILES += jvpp-ioamtrace-$(PACKAGE_VERSION).jar
218CLEANDIRS += jvpp-ioamtrace/target
219
220jvpp_ioamtrace_json_files = @top_builddir@/../vpp/plugins/ioam/lib-trace/trace.api.json
221
222jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h: $(jvpp_registry_ok) $(jvpp_ioamtrace_json_files)
223 $(call japigen,ioamtrace,JVppIoamtraceImpl)
224
225#
226# iOAM POT Plugin
227#
228noinst_LTLIBRARIES += libjvpp_ioampot.la
229libjvpp_ioampot_la_SOURCES = jvpp-ioampot/jvpp_ioam_pot.c
230libjvpp_ioampot_la_LIBADD = $(JVPP_LIBS)
231libjvpp_ioampot_la_DEPENDENCIES = libjvpp_common.la
232
233BUILT_SOURCES += jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h
234JAR_FILES += jvpp-ioampot-$(PACKAGE_VERSION).jar
235CLEANDIRS += jvpp-ioampot/target
236
237jvpp_ioampot_json_files = @top_builddir@/../vpp/plugins/ioam/lib-pot/pot.api.json
238
239jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h: $(jvpp_registry_ok) $(jvpp_ioampot_json_files)
240 $(call japigen,ioampot,JVppIoampotImpl)
241
242#
243# iOAM Export Plugin
244#
245noinst_LTLIBRARIES += libjvpp_ioamexport.la
246libjvpp_ioamexport_la_SOURCES = jvpp-ioamexport/jvpp_ioam_export.c
247libjvpp_ioamexport_la_LIBADD = $(JVPP_LIBS)
248libjvpp_ioamexport_la_DEPENDENCIES = libjvpp_common.la
249
250BUILT_SOURCES += jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h
251JAR_FILES += jvpp-ioamexport-$(PACKAGE_VERSION).jar
252CLEANDIRS += jvpp-ioamexport/target
253
254jvpp_ioamexport_json_files = @top_builddir@/../vpp/plugins/ioam/export/ioam_export.api.json
255
256jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h: $(jvpp_registry_ok) $(jvpp_ioamexport_json_files)
257 $(call japigen,ioamexport,JVppIoamexportImpl)
258endif
259
260#
261# JAR creation
262#
263jvpp-%-$(PACKAGE_VERSION).jar: libjvpp_%.la
264 @echo " JAR $@"
265 @cp .libs/libjvpp_$*.so jvpp-$*/target
266 @$(JAR) cf $(JARFLAGS) $@ -C jvpp-$*/target .
267
268jardir = $(prefix)/share/java
269jar_DATA = $(JAR_FILES)
270
271all-local: $(JAR_FILES)
272
273#
274# Cleanup
275#
276CLEANFILES = jvpp-registry.ok $(JAR_FILES) $(BUILT_SOURCES) *.files */*.h
277
278clean-local:
279 rm -rf $(CLEANDIRS)