blob: bfb5665aecb0866c8be44de78481386205df4eaf [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
Marek Gradzki94f8bc12017-01-10 16:43:53 +010075 @find jvpp-$(1)/target -name \*.java > jvpp-$(1).generated.files
76 @find @srcdir@/jvpp-$(1) -name \*.java > jvpp-$(1).static.files
Damjan Marioncb034b92016-12-28 18:38:59 +010077 @$(JAVAC) -classpath jvpp-registry/target \
Marek Gradzki94f8bc12017-01-10 16:43:53 +010078 -d jvpp-$(1)/target @jvpp-$(1).generated.files @jvpp-$(1).static.files
Damjan Marioncb034b92016-12-28 18:38:59 +010079 @$(JAVAH) -force \
80 -classpath jvpp-registry/target:jvpp-$(1)/target \
81 -d jvpp-$(1) io.fd.vpp.jvpp.$(1).$(2)
82endef
83
84#
85# jvpp-core (Java wrapper for vpe.api)
86#
87noinst_LTLIBRARIES += libjvpp_core.la
88libjvpp_core_la_SOURCES = jvpp-core/jvpp_core.c jvpp-core/jvpp_core_gen.h
89libjvpp_core_la_CPPFLAGS = -Ijvpp-registry -Ijvpp-core
90BUILT_SOURCES += jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h
91
92JAR_FILES += jvpp-core-$(PACKAGE_VERSION).jar
93CLEANDIRS += jvpp-core/target
94jvpp_core_json_files = $(shell find @top_builddir@/vnet/ -type f -name '*.api.json')
Jan Srnicekef6e54d2017-01-05 12:42:00 +010095jvpp_core_json_files += @top_builddir@/vpp/api/vpe.api.json
Damjan Marioncb034b92016-12-28 18:38:59 +010096
97jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: $(jvpp_registry_ok) $(jvpp_core_json_files)
98 $(call japigen,core,JVppCoreImpl)
99
100#
101# ACL Plugin
102#
103if ENABLE_ACL_PLUGIN
104noinst_LTLIBRARIES += libjvpp_acl.la
105libjvpp_acl_la_SOURCES = jvpp-acl/jvpp_acl.c
106libjvpp_acl_la_CPPFLAGS = -Ijvpp-acl
107
108BUILT_SOURCES += jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h
109
110JAR_FILES += jvpp-acl-$(PACKAGE_VERSION).jar
111CLEANDIRS += jvpp-acl/target
112
113jvpp_acl_json_files = @top_builddir@/plugins/acl/acl.api.json
114
115jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h: $(jvpp_registry_ok) $(jvpp_acl_json_files)
116 $(call japigen,acl,JVppAclImpl)
117endif
118
119#
120# SNAT Plugin
121#
122if ENABLE_SNAT_PLUGIN
123noinst_LTLIBRARIES += libjvpp_snat.la
124libjvpp_snat_la_SOURCES = jvpp-snat/jvpp_snat.c
125libjvpp_snat_la_CPPFLAGS = -Ijvpp-snat
126
127BUILT_SOURCES += jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h
128
129JAR_FILES += jvpp-snat-$(PACKAGE_VERSION).jar
130CLEANDIRS += jvpp-snat/target
131
132jvpp_snat_json_files = @top_builddir@/plugins/snat/snat.api.json
133
134jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_json_files)
135 $(call japigen,snat,JVppSnatImpl)
136endif
137
138#
139# iOAM Trace Plugin
140#
141if ENABLE_IOAM_PLUGIN
142noinst_LTLIBRARIES += libjvpp_ioamtrace.la
143libjvpp_ioamtrace_la_SOURCES = jvpp-ioamtrace/jvpp_ioam_trace.c
144
145BUILT_SOURCES += jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h
146JAR_FILES += jvpp-ioamtrace-$(PACKAGE_VERSION).jar
147CLEANDIRS += jvpp-ioamtrace/target
148
149jvpp_ioamtrace_json_files = @top_builddir@/plugins/ioam/lib-trace/trace.api.json
150
151jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h: $(jvpp_registry_ok) $(jvpp_ioamtrace_json_files)
152 $(call japigen,ioamtrace,JVppIoamtraceImpl)
153
154#
155# iOAM POT Plugin
156#
157noinst_LTLIBRARIES += libjvpp_ioampot.la
158libjvpp_ioampot_la_SOURCES = jvpp-ioampot/jvpp_ioam_pot.c
159
160BUILT_SOURCES += jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h
161JAR_FILES += jvpp-ioampot-$(PACKAGE_VERSION).jar
162CLEANDIRS += jvpp-ioampot/target
163
164jvpp_ioampot_json_files = @top_builddir@/plugins/ioam/lib-pot/pot.api.json
165
166jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h: $(jvpp_registry_ok) $(jvpp_ioampot_json_files)
167 $(call japigen,ioampot,JVppIoampotImpl)
168
169#
170# iOAM Export Plugin
171#
172noinst_LTLIBRARIES += libjvpp_ioamexport.la
173libjvpp_ioamexport_la_SOURCES = jvpp-ioamexport/jvpp_ioam_export.c
174
175BUILT_SOURCES += jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h
176JAR_FILES += jvpp-ioamexport-$(PACKAGE_VERSION).jar
177CLEANDIRS += jvpp-ioamexport/target
178
179jvpp_ioamexport_json_files = @top_builddir@/plugins/ioam/export/ioam_export.api.json
180
181jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h: $(jvpp_registry_ok) $(jvpp_ioamexport_json_files)
182 $(call japigen,ioamexport,JVppIoamexportImpl)
183endif
184
185#
186# JAR creation
187#
188jvpp-%-$(PACKAGE_VERSION).jar: libjvpp_%.la
189 @echo " JAR $@"
190 @cp .libs/libjvpp_$*.so jvpp-$*/target
191 @$(JAR) cf $(JARFLAGS) $@ -C jvpp-$*/target .
Damjan Marioncb034b92016-12-28 18:38:59 +0100192
193jardir = $(prefix)/share/java
194jar_DATA = $(JAR_FILES)
195
196all-local: $(JAR_FILES)
197
198#
199# Cleanup
200#
201CLEANFILES = jvpp-registry.ok $(JAR_FILES) $(BUILT_SOURCES)
202
203clean-local:
204 rm -rf $(CLEANDIRS)