blob: 3696e5bf0899e7df5a8241baaa194473096f1ffa [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
18AM_CFLAGS = -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
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 \
45 $(top_builddir)/libvlibapi.la \
46 $(top_builddir)/libsvm.la \
47 -lpthread -lm -lrt
Damjan Marioncb034b92016-12-28 18:38:59 +010048
49#
50# jvpp-registry (connection management + plugin registry)
51#
52
53noinst_LTLIBRARIES += libjvpp_registry.la
54
55libjvpp_registry_la_SOURCES = jvpp-registry/jvpp_registry.c
56libjvpp_registry_la_CPPFLAGS = -Ijvpp-registry
Marek Gradzkiea4fa752017-01-10 19:58:43 +010057libjvpp_registry_la_LIBADD = $(JVPP_LIBS)
58libjvpp_registry_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +010059
60packagedir_jvpp_registry = io/fd/vpp/jvpp
61jvpp_registry_src_files := \
62 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/*.java) \
63 $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/**/*.java)
64
65BUILT_SOURCES += jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
66CLEANDIRS += jvpp-registry/target
67JAR_FILES += jvpp-registry-$(PACKAGE_VERSION).jar
68
69jvpp_registry_ok = jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
70
71jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h: $(jvpp_registry_src_files)
72 @echo " JAPIGEN $@"
73 @rm -rf jvpp-registry/target
74 @mkdir -p jvpp-registry/target
75 @$(JAVAC) -d jvpp-registry/target $^
76 @$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.jvpp.VppJNIConnection
77 @$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.jvpp.JVppRegistryImpl
78 @touch jvpp-registry.ok
79
80define japigen
81 @echo " JAPIGEN $@"
82 @rm -rf jvpp-$(1)/target
83 @ @srcdir@/jvpp/gen/jvpp_gen.py --plugin_name $(1) --root_dir jvpp-$(1) \
84 -i $(jvpp_$(1)_json_files) > /dev/null
Marek Gradzki94f8bc12017-01-10 16:43:53 +010085 @find jvpp-$(1)/target -name \*.java > jvpp-$(1).generated.files
86 @find @srcdir@/jvpp-$(1) -name \*.java > jvpp-$(1).static.files
Damjan Marioncb034b92016-12-28 18:38:59 +010087 @$(JAVAC) -classpath jvpp-registry/target \
Marek Gradzki94f8bc12017-01-10 16:43:53 +010088 -d jvpp-$(1)/target @jvpp-$(1).generated.files @jvpp-$(1).static.files
Damjan Marioncb034b92016-12-28 18:38:59 +010089 @$(JAVAH) -force \
90 -classpath jvpp-registry/target:jvpp-$(1)/target \
91 -d jvpp-$(1) io.fd.vpp.jvpp.$(1).$(2)
92endef
93
94#
95# jvpp-core (Java wrapper for vpe.api)
96#
97noinst_LTLIBRARIES += libjvpp_core.la
98libjvpp_core_la_SOURCES = jvpp-core/jvpp_core.c jvpp-core/jvpp_core_gen.h
99libjvpp_core_la_CPPFLAGS = -Ijvpp-registry -Ijvpp-core
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100100libjvpp_core_la_LIBADD = $(JVPP_LIBS)
101libjvpp_core_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100102
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100103BUILT_SOURCES += jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h
Damjan Marioncb034b92016-12-28 18:38:59 +0100104JAR_FILES += jvpp-core-$(PACKAGE_VERSION).jar
105CLEANDIRS += jvpp-core/target
106jvpp_core_json_files = $(shell find @top_builddir@/vnet/ -type f -name '*.api.json')
Jan Srnicekef6e54d2017-01-05 12:42:00 +0100107jvpp_core_json_files += @top_builddir@/vpp/api/vpe.api.json
Damjan Marioncb034b92016-12-28 18:38:59 +0100108
109jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: $(jvpp_registry_ok) $(jvpp_core_json_files)
110 $(call japigen,core,JVppCoreImpl)
111
112#
113# ACL Plugin
114#
115if ENABLE_ACL_PLUGIN
116noinst_LTLIBRARIES += libjvpp_acl.la
117libjvpp_acl_la_SOURCES = jvpp-acl/jvpp_acl.c
118libjvpp_acl_la_CPPFLAGS = -Ijvpp-acl
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100119libjvpp_acl_la_LIBADD = $(JVPP_LIBS)
120libjvpp_acl_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100121
122BUILT_SOURCES += jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h
Damjan Marioncb034b92016-12-28 18:38:59 +0100123JAR_FILES += jvpp-acl-$(PACKAGE_VERSION).jar
124CLEANDIRS += jvpp-acl/target
125
126jvpp_acl_json_files = @top_builddir@/plugins/acl/acl.api.json
127
128jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h: $(jvpp_registry_ok) $(jvpp_acl_json_files)
129 $(call japigen,acl,JVppAclImpl)
130endif
131
132#
133# SNAT Plugin
134#
135if ENABLE_SNAT_PLUGIN
136noinst_LTLIBRARIES += libjvpp_snat.la
137libjvpp_snat_la_SOURCES = jvpp-snat/jvpp_snat.c
138libjvpp_snat_la_CPPFLAGS = -Ijvpp-snat
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100139libjvpp_snat_la_LIBADD = $(JVPP_LIBS)
140libjvpp_snat_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100141
142BUILT_SOURCES += jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h
Damjan Marioncb034b92016-12-28 18:38:59 +0100143JAR_FILES += jvpp-snat-$(PACKAGE_VERSION).jar
144CLEANDIRS += jvpp-snat/target
145
146jvpp_snat_json_files = @top_builddir@/plugins/snat/snat.api.json
147
148jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_json_files)
149 $(call japigen,snat,JVppSnatImpl)
150endif
151
152#
153# iOAM Trace Plugin
154#
155if ENABLE_IOAM_PLUGIN
156noinst_LTLIBRARIES += libjvpp_ioamtrace.la
157libjvpp_ioamtrace_la_SOURCES = jvpp-ioamtrace/jvpp_ioam_trace.c
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100158libjvpp_ioamtrace_la_LIBADD = $(JVPP_LIBS)
159libjvpp_ioamtrace_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100160
161BUILT_SOURCES += jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h
162JAR_FILES += jvpp-ioamtrace-$(PACKAGE_VERSION).jar
163CLEANDIRS += jvpp-ioamtrace/target
164
165jvpp_ioamtrace_json_files = @top_builddir@/plugins/ioam/lib-trace/trace.api.json
166
167jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h: $(jvpp_registry_ok) $(jvpp_ioamtrace_json_files)
168 $(call japigen,ioamtrace,JVppIoamtraceImpl)
169
170#
171# iOAM POT Plugin
172#
173noinst_LTLIBRARIES += libjvpp_ioampot.la
174libjvpp_ioampot_la_SOURCES = jvpp-ioampot/jvpp_ioam_pot.c
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100175libjvpp_ioampot_la_LIBADD = $(JVPP_LIBS)
176libjvpp_ioampot_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100177
178BUILT_SOURCES += jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h
179JAR_FILES += jvpp-ioampot-$(PACKAGE_VERSION).jar
180CLEANDIRS += jvpp-ioampot/target
181
182jvpp_ioampot_json_files = @top_builddir@/plugins/ioam/lib-pot/pot.api.json
183
184jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h: $(jvpp_registry_ok) $(jvpp_ioampot_json_files)
185 $(call japigen,ioampot,JVppIoampotImpl)
186
187#
188# iOAM Export Plugin
189#
190noinst_LTLIBRARIES += libjvpp_ioamexport.la
191libjvpp_ioamexport_la_SOURCES = jvpp-ioamexport/jvpp_ioam_export.c
Marek Gradzkiea4fa752017-01-10 19:58:43 +0100192libjvpp_ioamexport_la_LIBADD = $(JVPP_LIBS)
193libjvpp_ioamexport_la_DEPENDENCIES = libjvpp_common.la
Damjan Marioncb034b92016-12-28 18:38:59 +0100194
195BUILT_SOURCES += jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h
196JAR_FILES += jvpp-ioamexport-$(PACKAGE_VERSION).jar
197CLEANDIRS += jvpp-ioamexport/target
198
199jvpp_ioamexport_json_files = @top_builddir@/plugins/ioam/export/ioam_export.api.json
200
201jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h: $(jvpp_registry_ok) $(jvpp_ioamexport_json_files)
202 $(call japigen,ioamexport,JVppIoamexportImpl)
203endif
204
205#
206# JAR creation
207#
208jvpp-%-$(PACKAGE_VERSION).jar: libjvpp_%.la
209 @echo " JAR $@"
210 @cp .libs/libjvpp_$*.so jvpp-$*/target
211 @$(JAR) cf $(JARFLAGS) $@ -C jvpp-$*/target .
Damjan Marioncb034b92016-12-28 18:38:59 +0100212
213jardir = $(prefix)/share/java
214jar_DATA = $(JAR_FILES)
215
216all-local: $(JAR_FILES)
217
218#
219# Cleanup
220#
221CLEANFILES = jvpp-registry.ok $(JAR_FILES) $(BUILT_SOURCES)
222
223clean-local:
224 rm -rf $(CLEANDIRS)