blob: 321ba33cb53e7335b8ffcc5ffd9d11b7fea4337c [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
Damjan Marionba3c7732017-11-10 20:26:50 +010018AM_CFLAGS = @CPU_FLAGS@ -Wall -I${top_srcdir} -I${top_builddir} \
Damjan Marioncb034b92016-12-28 18:38:59 +010019 -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux \
20 -I@top_srcdir@/plugins -I@top_builddir@/plugins
21
Marek Gradzkicb365d82017-01-16 14:00:56 +010022AM_LDFLAGS = -shared -avoid-version -rpath /none -no-undefined
Damjan Marioncb034b92016-12-28 18:38:59 +010023
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
Marek Gradzki3f14e232017-01-12 09:16:23 +010037lib_LTLIBRARIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +010038libjvpp_common_la_SOURCES = jvpp-common/jvpp_common.c
Marek Gradzki07c39da2017-01-18 14:16:13 +010039libjvpp_common_la_LDFLAGS = shared -rpath /none -no-undefined
Marek Gradzkiea4fa752017-01-10 19:58:43 +010040
41JVPP_LIBS = \
42 libjvpp_common.la \
43 $(top_builddir)/libvppinfra.la \
44 $(top_builddir)/libvlibmemoryclient.la \
Marek Gradzkiea4fa752017-01-10 19:58:43 +010045 $(top_builddir)/libsvm.la \
46 -lpthread -lm -lrt
Damjan Marioncb034b92016-12-28 18:38:59 +010047
48#
49# jvpp-registry (connection management + plugin registry)
50#
51
52noinst_LTLIBRARIES += libjvpp_registry.la
53
54libjvpp_registry_la_SOURCES = jvpp-registry/jvpp_registry.c
55libjvpp_registry_la_CPPFLAGS = -Ijvpp-registry
Marek Gradzkiea4fa752017-01-10 19:58:43 +010056libjvpp_registry_la_LIBADD = $(JVPP_LIBS)
57libjvpp_registry_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +010058
59packagedir_jvpp_registry = io/fd/vpp/jvpp
60jvpp_registry_src_files := \
61 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/*.java) \
62 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/**/*.java)
63
64BUILT_SOURCES += jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
65CLEANDIRS += jvpp-registry/target
66JAR_FILES += jvpp-registry-$(PACKAGE_VERSION).jar
67
68jvpp_registry_ok = jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
69
70jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h: $(jvpp_registry_src_files)
Marek Gradzki568cc602018-01-26 11:39:27 +010071 @echo " JVPP GEN $@"
Damjan Marioncb034b92016-12-28 18:38:59 +010072 @rm -rf jvpp-registry/target
73 @mkdir -p jvpp-registry/target
Marco Varlese6b8fcff2018-05-02 13:33:47 +020074 @$(JAVAC) -source 8 -target 8 -d jvpp-registry/target -h jvpp-registry $^
Damjan Marioncb034b92016-12-28 18:38:59 +010075 @touch jvpp-registry.ok
76
77define japigen
Marek Gradzki568cc602018-01-26 11:39:27 +010078 @echo " JVPP GEN $@"
Damjan Marioncb034b92016-12-28 18:38:59 +010079 @rm -rf jvpp-$(1)/target
80 @ @srcdir@/jvpp/gen/jvpp_gen.py --plugin_name $(1) --root_dir jvpp-$(1) \
Ole Troan9d420872017-10-12 13:06:35 +020081 -i $(jvpp_$(1)_json_files)
Marek Gradzki94f8bc12017-01-10 16:43:53 +010082 @find jvpp-$(1)/target -name \*.java > jvpp-$(1).generated.files
83 @find @srcdir@/jvpp-$(1) -name \*.java > jvpp-$(1).static.files
Marco Varlese6b8fcff2018-05-02 13:33:47 +020084 @$(JAVAC) -source 8 -target 8 -classpath jvpp-registry/target \
85 -d jvpp-$(1)/target -h jvpp-$(1) @jvpp-$(1).generated.files @jvpp-$(1).static.files
Damjan Marioncb034b92016-12-28 18:38:59 +010086endef
87
88#
89# jvpp-core (Java wrapper for vpe.api)
90#
91noinst_LTLIBRARIES += libjvpp_core.la
92libjvpp_core_la_SOURCES = jvpp-core/jvpp_core.c jvpp-core/jvpp_core_gen.h
93libjvpp_core_la_CPPFLAGS = -Ijvpp-registry -Ijvpp-core
Marek Gradzkiea4fa752017-01-10 19:58:43 +010094libjvpp_core_la_LIBADD = $(JVPP_LIBS)
95libjvpp_core_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +010096
Marek Gradzkiea4fa752017-01-10 19:58:43 +010097BUILT_SOURCES += jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h
Damjan Marioncb034b92016-12-28 18:38:59 +010098JAR_FILES += jvpp-core-$(PACKAGE_VERSION).jar
99CLEANDIRS += jvpp-core/target
Marek Gradzki87a137c2017-12-08 15:26:55 +0100100
101# Include all VPP API files
Damjan Marioncb034b92016-12-28 18:38:59 +0100102jvpp_core_json_files = $(shell find @top_builddir@/vnet/ -type f -name '*.api.json')
Marek Gradzki87a137c2017-12-08 15:26:55 +0100103jvpp_core_json_files += $(shell find @top_builddir@/vpp/ -type f -name '*.api.json')
104# except for plugins and unsupported ones:
105# jvpp_core_json_files += @top_builddir@/vlibmemory/memclnt.api.json
Damjan Marioncb034b92016-12-28 18:38:59 +0100106
107jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: $(jvpp_registry_ok) $(jvpp_core_json_files)
108 $(call japigen,core,JVppCoreImpl)
109
110#
111# ACL Plugin
112#
113if ENABLE_ACL_PLUGIN
114noinst_LTLIBRARIES += libjvpp_acl.la
115libjvpp_acl_la_SOURCES = jvpp-acl/jvpp_acl.c
116libjvpp_acl_la_CPPFLAGS = -Ijvpp-acl
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100117libjvpp_acl_la_LIBADD = $(JVPP_LIBS)
118libjvpp_acl_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100119
120BUILT_SOURCES += jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h
Damjan Marioncb034b92016-12-28 18:38:59 +0100121JAR_FILES += jvpp-acl-$(PACKAGE_VERSION).jar
122CLEANDIRS += jvpp-acl/target
123
124jvpp_acl_json_files = @top_builddir@/plugins/acl/acl.api.json
125
126jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h: $(jvpp_registry_ok) $(jvpp_acl_json_files)
127 $(call japigen,acl,JVppAclImpl)
128endif
129
130#
Hongjun Nief486b12017-04-12 19:21:16 +0800131# GTPU Plugin
132#
133if ENABLE_GTPU_PLUGIN
134noinst_LTLIBRARIES += libjvpp_gtpu.la
135libjvpp_gtpu_la_SOURCES = jvpp-gtpu/jvpp_gtpu.c
136libjvpp_gtpu_la_CPPFLAGS = -Ijvpp-gtpu
137libjvpp_gtpu_la_LIBADD = $(JVPP_LIBS)
138libjvpp_gtpu_la_DEPENDENCIES = libjvpp_common.la
139
140BUILT_SOURCES += jvpp-gtpu/io_fd_vpp_jvpp_gtpu_JVppGtpuImpl.h
141JAR_FILES += jvpp-gtpu-$(PACKAGE_VERSION).jar
142CLEANDIRS += jvpp-gtpu/target
143
144jvpp_gtpu_json_files = @top_builddir@/plugins/gtpu/gtpu.api.json
145
146jvpp-gtpu/io_fd_vpp_jvpp_gtpu_JVppGtpuImpl.h: $(jvpp_registry_ok) $(jvpp_gtpu_json_files)
147 $(call japigen,gtpu,JVppGtpuImpl)
148endif
149
150#
Hongjun Ni62f9cdd2017-07-04 20:11:57 +0800151# PPPOE Plugin
152#
153if ENABLE_PPPOE_PLUGIN
154noinst_LTLIBRARIES += libjvpp_pppoe.la
155libjvpp_pppoe_la_SOURCES = jvpp-pppoe/jvpp_pppoe.c
156libjvpp_pppoe_la_CPPFLAGS = -Ijvpp-pppoe
157libjvpp_pppoe_la_LIBADD = $(JVPP_LIBS)
158libjvpp_pppoe_la_DEPENDENCIES = libjvpp_common.la
159
160BUILT_SOURCES += jvpp-pppoe/io_fd_vpp_jvpp_pppoe_JVppPppoeImpl.h
161JAR_FILES += jvpp-pppoe-$(PACKAGE_VERSION).jar
162CLEANDIRS += jvpp-pppoe/target
163
164jvpp_pppoe_json_files = @top_builddir@/plugins/pppoe/pppoe.api.json
165
166jvpp-pppoe/io_fd_vpp_jvpp_pppoe_JVppPppoeImpl.h: $(jvpp_registry_ok) $(jvpp_pppoe_json_files)
167 $(call japigen,pppoe,JVppPppoeImpl)
168endif
169
170#
Matus Fabian2ba92e32017-08-21 07:05:03 -0700171# NAT Plugin
Damjan Marioncb034b92016-12-28 18:38:59 +0100172#
Matus Fabian2ba92e32017-08-21 07:05:03 -0700173if ENABLE_NAT_PLUGIN
174noinst_LTLIBRARIES += libjvpp_nat.la
175libjvpp_nat_la_SOURCES = jvpp-nat/jvpp_nat.c
176libjvpp_nat_la_CPPFLAGS = -Ijvpp-nat
177libjvpp_nat_la_LIBADD = $(JVPP_LIBS)
178libjvpp_nat_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100179
Matus Fabian2ba92e32017-08-21 07:05:03 -0700180BUILT_SOURCES += jvpp-nat/io_fd_vpp_jvpp_nat_JVppNatImpl.h
181JAR_FILES += jvpp-nat-$(PACKAGE_VERSION).jar
182CLEANDIRS += jvpp-nat/target
Damjan Marioncb034b92016-12-28 18:38:59 +0100183
Matus Fabian2ba92e32017-08-21 07:05:03 -0700184jvpp_nat_json_files = @top_builddir@/plugins/nat/nat.api.json
Damjan Marioncb034b92016-12-28 18:38:59 +0100185
Matus Fabian2ba92e32017-08-21 07:05:03 -0700186jvpp-nat/io_fd_vpp_jvpp_nat_JVppNatImpl.h: $(jvpp_registry_ok) $(jvpp_nat_json_files)
187 $(call japigen,nat,JVppNatImpl)
Damjan Marioncb034b92016-12-28 18:38:59 +0100188endif
189
190#
191# iOAM Trace Plugin
192#
193if ENABLE_IOAM_PLUGIN
194noinst_LTLIBRARIES += libjvpp_ioamtrace.la
195libjvpp_ioamtrace_la_SOURCES = jvpp-ioamtrace/jvpp_ioam_trace.c
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100196libjvpp_ioamtrace_la_LIBADD = $(JVPP_LIBS)
197libjvpp_ioamtrace_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100198
199BUILT_SOURCES += jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h
200JAR_FILES += jvpp-ioamtrace-$(PACKAGE_VERSION).jar
201CLEANDIRS += jvpp-ioamtrace/target
202
203jvpp_ioamtrace_json_files = @top_builddir@/plugins/ioam/lib-trace/trace.api.json
204
205jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h: $(jvpp_registry_ok) $(jvpp_ioamtrace_json_files)
206 $(call japigen,ioamtrace,JVppIoamtraceImpl)
207
208#
209# iOAM POT Plugin
210#
211noinst_LTLIBRARIES += libjvpp_ioampot.la
212libjvpp_ioampot_la_SOURCES = jvpp-ioampot/jvpp_ioam_pot.c
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100213libjvpp_ioampot_la_LIBADD = $(JVPP_LIBS)
214libjvpp_ioampot_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100215
216BUILT_SOURCES += jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h
217JAR_FILES += jvpp-ioampot-$(PACKAGE_VERSION).jar
218CLEANDIRS += jvpp-ioampot/target
219
220jvpp_ioampot_json_files = @top_builddir@/plugins/ioam/lib-pot/pot.api.json
221
222jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h: $(jvpp_registry_ok) $(jvpp_ioampot_json_files)
223 $(call japigen,ioampot,JVppIoampotImpl)
224
225#
226# iOAM Export Plugin
227#
228noinst_LTLIBRARIES += libjvpp_ioamexport.la
229libjvpp_ioamexport_la_SOURCES = jvpp-ioamexport/jvpp_ioam_export.c
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100230libjvpp_ioamexport_la_LIBADD = $(JVPP_LIBS)
231libjvpp_ioamexport_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100232
233BUILT_SOURCES += jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h
234JAR_FILES += jvpp-ioamexport-$(PACKAGE_VERSION).jar
235CLEANDIRS += jvpp-ioamexport/target
236
237jvpp_ioamexport_json_files = @top_builddir@/plugins/ioam/export/ioam_export.api.json
238
239jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h: $(jvpp_registry_ok) $(jvpp_ioamexport_json_files)
240 $(call japigen,ioamexport,JVppIoamexportImpl)
241endif
242
243#
244# JAR creation
245#
246jvpp-%-$(PACKAGE_VERSION).jar: libjvpp_%.la
247 @echo " JAR $@"
248 @cp .libs/libjvpp_$*.so jvpp-$*/target
249 @$(JAR) cf $(JARFLAGS) $@ -C jvpp-$*/target .
Damjan Marioncb034b92016-12-28 18:38:59 +0100250
251jardir = $(prefix)/share/java
252jar_DATA = $(JAR_FILES)
253
254all-local: $(JAR_FILES)
255
256#
257# Cleanup
258#
Burt Silverman006eb472017-01-27 15:29:54 -0500259CLEANFILES = jvpp-registry.ok $(JAR_FILES) $(BUILT_SOURCES) *.files */*.h
Damjan Marioncb034b92016-12-28 18:38:59 +0100260
261clean-local:
262 rm -rf $(CLEANDIRS)