blob: 21a18575837997ed9af1ecf92c5582a77d3fbe8a [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
74 @$(JAVAC) -d jvpp-registry/target $^
75 @$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.jvpp.VppJNIConnection
76 @$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.jvpp.JVppRegistryImpl
77 @touch jvpp-registry.ok
78
79define japigen
Marek Gradzki568cc602018-01-26 11:39:27 +010080 @echo " JVPP GEN $@"
Damjan Marioncb034b92016-12-28 18:38:59 +010081 @rm -rf jvpp-$(1)/target
82 @ @srcdir@/jvpp/gen/jvpp_gen.py --plugin_name $(1) --root_dir jvpp-$(1) \
Ole Troan9d420872017-10-12 13:06:35 +020083 -i $(jvpp_$(1)_json_files)
Marek Gradzki94f8bc12017-01-10 16:43:53 +010084 @find jvpp-$(1)/target -name \*.java > jvpp-$(1).generated.files
85 @find @srcdir@/jvpp-$(1) -name \*.java > jvpp-$(1).static.files
Damjan Marioncb034b92016-12-28 18:38:59 +010086 @$(JAVAC) -classpath jvpp-registry/target \
Marek Gradzki94f8bc12017-01-10 16:43:53 +010087 -d jvpp-$(1)/target @jvpp-$(1).generated.files @jvpp-$(1).static.files
Damjan Marioncb034b92016-12-28 18:38:59 +010088 @$(JAVAH) -force \
89 -classpath jvpp-registry/target:jvpp-$(1)/target \
90 -d jvpp-$(1) io.fd.vpp.jvpp.$(1).$(2)
91endef
92
93#
94# jvpp-core (Java wrapper for vpe.api)
95#
96noinst_LTLIBRARIES += libjvpp_core.la
97libjvpp_core_la_SOURCES = jvpp-core/jvpp_core.c jvpp-core/jvpp_core_gen.h
98libjvpp_core_la_CPPFLAGS = -Ijvpp-registry -Ijvpp-core
Marek Gradzkiea4fa752017-01-10 19:58:43 +010099libjvpp_core_la_LIBADD = $(JVPP_LIBS)
100libjvpp_core_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100101
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100102BUILT_SOURCES += jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h
Damjan Marioncb034b92016-12-28 18:38:59 +0100103JAR_FILES += jvpp-core-$(PACKAGE_VERSION).jar
104CLEANDIRS += jvpp-core/target
Marek Gradzki87a137c2017-12-08 15:26:55 +0100105
106# Include all VPP API files
Damjan Marioncb034b92016-12-28 18:38:59 +0100107jvpp_core_json_files = $(shell find @top_builddir@/vnet/ -type f -name '*.api.json')
Marek Gradzki87a137c2017-12-08 15:26:55 +0100108jvpp_core_json_files += $(shell find @top_builddir@/vpp/ -type f -name '*.api.json')
109# except for plugins and unsupported ones:
110# jvpp_core_json_files += @top_builddir@/vlibmemory/memclnt.api.json
Damjan Marioncb034b92016-12-28 18:38:59 +0100111
112jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: $(jvpp_registry_ok) $(jvpp_core_json_files)
113 $(call japigen,core,JVppCoreImpl)
114
115#
116# ACL Plugin
117#
118if ENABLE_ACL_PLUGIN
119noinst_LTLIBRARIES += libjvpp_acl.la
120libjvpp_acl_la_SOURCES = jvpp-acl/jvpp_acl.c
121libjvpp_acl_la_CPPFLAGS = -Ijvpp-acl
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100122libjvpp_acl_la_LIBADD = $(JVPP_LIBS)
123libjvpp_acl_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100124
125BUILT_SOURCES += jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h
Damjan Marioncb034b92016-12-28 18:38:59 +0100126JAR_FILES += jvpp-acl-$(PACKAGE_VERSION).jar
127CLEANDIRS += jvpp-acl/target
128
129jvpp_acl_json_files = @top_builddir@/plugins/acl/acl.api.json
130
131jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h: $(jvpp_registry_ok) $(jvpp_acl_json_files)
132 $(call japigen,acl,JVppAclImpl)
133endif
134
135#
Hongjun Nief486b12017-04-12 19:21:16 +0800136# GTPU Plugin
137#
138if ENABLE_GTPU_PLUGIN
139noinst_LTLIBRARIES += libjvpp_gtpu.la
140libjvpp_gtpu_la_SOURCES = jvpp-gtpu/jvpp_gtpu.c
141libjvpp_gtpu_la_CPPFLAGS = -Ijvpp-gtpu
142libjvpp_gtpu_la_LIBADD = $(JVPP_LIBS)
143libjvpp_gtpu_la_DEPENDENCIES = libjvpp_common.la
144
145BUILT_SOURCES += jvpp-gtpu/io_fd_vpp_jvpp_gtpu_JVppGtpuImpl.h
146JAR_FILES += jvpp-gtpu-$(PACKAGE_VERSION).jar
147CLEANDIRS += jvpp-gtpu/target
148
149jvpp_gtpu_json_files = @top_builddir@/plugins/gtpu/gtpu.api.json
150
151jvpp-gtpu/io_fd_vpp_jvpp_gtpu_JVppGtpuImpl.h: $(jvpp_registry_ok) $(jvpp_gtpu_json_files)
152 $(call japigen,gtpu,JVppGtpuImpl)
153endif
154
155#
Hongjun Ni62f9cdd2017-07-04 20:11:57 +0800156# PPPOE Plugin
157#
158if ENABLE_PPPOE_PLUGIN
159noinst_LTLIBRARIES += libjvpp_pppoe.la
160libjvpp_pppoe_la_SOURCES = jvpp-pppoe/jvpp_pppoe.c
161libjvpp_pppoe_la_CPPFLAGS = -Ijvpp-pppoe
162libjvpp_pppoe_la_LIBADD = $(JVPP_LIBS)
163libjvpp_pppoe_la_DEPENDENCIES = libjvpp_common.la
164
165BUILT_SOURCES += jvpp-pppoe/io_fd_vpp_jvpp_pppoe_JVppPppoeImpl.h
166JAR_FILES += jvpp-pppoe-$(PACKAGE_VERSION).jar
167CLEANDIRS += jvpp-pppoe/target
168
169jvpp_pppoe_json_files = @top_builddir@/plugins/pppoe/pppoe.api.json
170
171jvpp-pppoe/io_fd_vpp_jvpp_pppoe_JVppPppoeImpl.h: $(jvpp_registry_ok) $(jvpp_pppoe_json_files)
172 $(call japigen,pppoe,JVppPppoeImpl)
173endif
174
175#
Matus Fabian2ba92e32017-08-21 07:05:03 -0700176# NAT Plugin
Damjan Marioncb034b92016-12-28 18:38:59 +0100177#
Matus Fabian2ba92e32017-08-21 07:05:03 -0700178if ENABLE_NAT_PLUGIN
179noinst_LTLIBRARIES += libjvpp_nat.la
180libjvpp_nat_la_SOURCES = jvpp-nat/jvpp_nat.c
181libjvpp_nat_la_CPPFLAGS = -Ijvpp-nat
182libjvpp_nat_la_LIBADD = $(JVPP_LIBS)
183libjvpp_nat_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100184
Matus Fabian2ba92e32017-08-21 07:05:03 -0700185BUILT_SOURCES += jvpp-nat/io_fd_vpp_jvpp_nat_JVppNatImpl.h
186JAR_FILES += jvpp-nat-$(PACKAGE_VERSION).jar
187CLEANDIRS += jvpp-nat/target
Damjan Marioncb034b92016-12-28 18:38:59 +0100188
Matus Fabian2ba92e32017-08-21 07:05:03 -0700189jvpp_nat_json_files = @top_builddir@/plugins/nat/nat.api.json
Damjan Marioncb034b92016-12-28 18:38:59 +0100190
Matus Fabian2ba92e32017-08-21 07:05:03 -0700191jvpp-nat/io_fd_vpp_jvpp_nat_JVppNatImpl.h: $(jvpp_registry_ok) $(jvpp_nat_json_files)
192 $(call japigen,nat,JVppNatImpl)
Damjan Marioncb034b92016-12-28 18:38:59 +0100193endif
194
195#
196# iOAM Trace Plugin
197#
198if ENABLE_IOAM_PLUGIN
199noinst_LTLIBRARIES += libjvpp_ioamtrace.la
200libjvpp_ioamtrace_la_SOURCES = jvpp-ioamtrace/jvpp_ioam_trace.c
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100201libjvpp_ioamtrace_la_LIBADD = $(JVPP_LIBS)
202libjvpp_ioamtrace_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100203
204BUILT_SOURCES += jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h
205JAR_FILES += jvpp-ioamtrace-$(PACKAGE_VERSION).jar
206CLEANDIRS += jvpp-ioamtrace/target
207
208jvpp_ioamtrace_json_files = @top_builddir@/plugins/ioam/lib-trace/trace.api.json
209
210jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h: $(jvpp_registry_ok) $(jvpp_ioamtrace_json_files)
211 $(call japigen,ioamtrace,JVppIoamtraceImpl)
212
213#
214# iOAM POT Plugin
215#
216noinst_LTLIBRARIES += libjvpp_ioampot.la
217libjvpp_ioampot_la_SOURCES = jvpp-ioampot/jvpp_ioam_pot.c
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100218libjvpp_ioampot_la_LIBADD = $(JVPP_LIBS)
219libjvpp_ioampot_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100220
221BUILT_SOURCES += jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h
222JAR_FILES += jvpp-ioampot-$(PACKAGE_VERSION).jar
223CLEANDIRS += jvpp-ioampot/target
224
225jvpp_ioampot_json_files = @top_builddir@/plugins/ioam/lib-pot/pot.api.json
226
227jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h: $(jvpp_registry_ok) $(jvpp_ioampot_json_files)
228 $(call japigen,ioampot,JVppIoampotImpl)
229
230#
231# iOAM Export Plugin
232#
233noinst_LTLIBRARIES += libjvpp_ioamexport.la
234libjvpp_ioamexport_la_SOURCES = jvpp-ioamexport/jvpp_ioam_export.c
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100235libjvpp_ioamexport_la_LIBADD = $(JVPP_LIBS)
236libjvpp_ioamexport_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100237
238BUILT_SOURCES += jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h
239JAR_FILES += jvpp-ioamexport-$(PACKAGE_VERSION).jar
240CLEANDIRS += jvpp-ioamexport/target
241
242jvpp_ioamexport_json_files = @top_builddir@/plugins/ioam/export/ioam_export.api.json
243
244jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h: $(jvpp_registry_ok) $(jvpp_ioamexport_json_files)
245 $(call japigen,ioamexport,JVppIoamexportImpl)
246endif
247
248#
249# JAR creation
250#
251jvpp-%-$(PACKAGE_VERSION).jar: libjvpp_%.la
252 @echo " JAR $@"
253 @cp .libs/libjvpp_$*.so jvpp-$*/target
254 @$(JAR) cf $(JARFLAGS) $@ -C jvpp-$*/target .
Damjan Marioncb034b92016-12-28 18:38:59 +0100255
256jardir = $(prefix)/share/java
257jar_DATA = $(JAR_FILES)
258
259all-local: $(JAR_FILES)
260
261#
262# Cleanup
263#
Burt Silverman006eb472017-01-27 15:29:54 -0500264CLEANFILES = jvpp-registry.ok $(JAR_FILES) $(BUILT_SOURCES) *.files */*.h
Damjan Marioncb034b92016-12-28 18:38:59 +0100265
266clean-local:
267 rm -rf $(CLEANDIRS)