Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 1 | # 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 | |
| 14 | AUTOMAKE_OPTIONS = foreign |
| 15 | ACLOCAL_AMFLAGS = -I m4 |
Damjan Marion | 724f64c | 2017-01-11 11:11:00 +0100 | [diff] [blame^] | 16 | AM_LIBTOOLFLAGS = --quiet |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 17 | |
| 18 | AM_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 | |
| 22 | AM_LDFLAGS = -module -shared -avoid-version -rpath /none -no-undefined |
| 23 | |
| 24 | BUILT_SOURCES = |
| 25 | bin_PROGRAMS = |
| 26 | noinst_LTLIBRARIES = |
| 27 | JAR_FILES = |
| 28 | CLEANDIRS = |
| 29 | |
| 30 | # |
| 31 | # jvpp-common |
| 32 | # |
| 33 | |
Damjan Marion | 71f8742 | 2017-01-03 11:17:19 +0100 | [diff] [blame] | 34 | nobase_include_HEADERS = \ |
| 35 | jvpp-common/jvpp_common.h |
| 36 | |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 37 | noinst_LTLIBRARIES += libjvpp_common.la |
| 38 | libjvpp_common_la_SOURCES = jvpp-common/jvpp_common.c |
| 39 | libjvpp_common_la_LDFLAGS = |
| 40 | |
| 41 | # |
| 42 | # jvpp-registry (connection management + plugin registry) |
| 43 | # |
| 44 | |
| 45 | noinst_LTLIBRARIES += libjvpp_registry.la |
| 46 | |
| 47 | libjvpp_registry_la_SOURCES = jvpp-registry/jvpp_registry.c |
| 48 | libjvpp_registry_la_CPPFLAGS = -Ijvpp-registry |
| 49 | libjvpp_registry_la_LIBAD = libjvpp_common.la |
| 50 | |
| 51 | packagedir_jvpp_registry = io/fd/vpp/jvpp |
| 52 | jvpp_registry_src_files := \ |
| 53 | $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/*.java) \ |
| 54 | $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/**/*.java) |
| 55 | |
| 56 | BUILT_SOURCES += jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h |
| 57 | CLEANDIRS += jvpp-registry/target |
| 58 | JAR_FILES += jvpp-registry-$(PACKAGE_VERSION).jar |
| 59 | |
| 60 | jvpp_registry_ok = jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h |
| 61 | |
| 62 | jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h: $(jvpp_registry_src_files) |
| 63 | @echo " JAPIGEN $@" |
| 64 | @rm -rf jvpp-registry/target |
| 65 | @mkdir -p jvpp-registry/target |
| 66 | @$(JAVAC) -d jvpp-registry/target $^ |
| 67 | @$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.jvpp.VppJNIConnection |
| 68 | @$(JAVAH) -force -classpath jvpp-registry/target -d jvpp-registry io.fd.vpp.jvpp.JVppRegistryImpl |
| 69 | @touch jvpp-registry.ok |
| 70 | |
| 71 | define japigen |
| 72 | @echo " JAPIGEN $@" |
| 73 | @rm -rf jvpp-$(1)/target |
| 74 | @ @srcdir@/jvpp/gen/jvpp_gen.py --plugin_name $(1) --root_dir jvpp-$(1) \ |
| 75 | -i $(jvpp_$(1)_json_files) > /dev/null |
Marek Gradzki | 94f8bc1 | 2017-01-10 16:43:53 +0100 | [diff] [blame] | 76 | @find jvpp-$(1)/target -name \*.java > jvpp-$(1).generated.files |
| 77 | @find @srcdir@/jvpp-$(1) -name \*.java > jvpp-$(1).static.files |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 78 | @$(JAVAC) -classpath jvpp-registry/target \ |
Marek Gradzki | 94f8bc1 | 2017-01-10 16:43:53 +0100 | [diff] [blame] | 79 | -d jvpp-$(1)/target @jvpp-$(1).generated.files @jvpp-$(1).static.files |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 80 | @$(JAVAH) -force \ |
| 81 | -classpath jvpp-registry/target:jvpp-$(1)/target \ |
| 82 | -d jvpp-$(1) io.fd.vpp.jvpp.$(1).$(2) |
| 83 | endef |
| 84 | |
| 85 | # |
| 86 | # jvpp-core (Java wrapper for vpe.api) |
| 87 | # |
| 88 | noinst_LTLIBRARIES += libjvpp_core.la |
| 89 | libjvpp_core_la_SOURCES = jvpp-core/jvpp_core.c jvpp-core/jvpp_core_gen.h |
| 90 | libjvpp_core_la_CPPFLAGS = -Ijvpp-registry -Ijvpp-core |
| 91 | BUILT_SOURCES += jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h |
| 92 | |
| 93 | JAR_FILES += jvpp-core-$(PACKAGE_VERSION).jar |
| 94 | CLEANDIRS += jvpp-core/target |
| 95 | jvpp_core_json_files = $(shell find @top_builddir@/vnet/ -type f -name '*.api.json') |
Jan Srnicek | ef6e54d | 2017-01-05 12:42:00 +0100 | [diff] [blame] | 96 | jvpp_core_json_files += @top_builddir@/vpp/api/vpe.api.json |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 97 | |
| 98 | jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: $(jvpp_registry_ok) $(jvpp_core_json_files) |
| 99 | $(call japigen,core,JVppCoreImpl) |
| 100 | |
| 101 | # |
| 102 | # ACL Plugin |
| 103 | # |
| 104 | if ENABLE_ACL_PLUGIN |
| 105 | noinst_LTLIBRARIES += libjvpp_acl.la |
| 106 | libjvpp_acl_la_SOURCES = jvpp-acl/jvpp_acl.c |
| 107 | libjvpp_acl_la_CPPFLAGS = -Ijvpp-acl |
| 108 | |
| 109 | BUILT_SOURCES += jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h |
| 110 | |
| 111 | JAR_FILES += jvpp-acl-$(PACKAGE_VERSION).jar |
| 112 | CLEANDIRS += jvpp-acl/target |
| 113 | |
| 114 | jvpp_acl_json_files = @top_builddir@/plugins/acl/acl.api.json |
| 115 | |
| 116 | jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h: $(jvpp_registry_ok) $(jvpp_acl_json_files) |
| 117 | $(call japigen,acl,JVppAclImpl) |
| 118 | endif |
| 119 | |
| 120 | # |
| 121 | # SNAT Plugin |
| 122 | # |
| 123 | if ENABLE_SNAT_PLUGIN |
| 124 | noinst_LTLIBRARIES += libjvpp_snat.la |
| 125 | libjvpp_snat_la_SOURCES = jvpp-snat/jvpp_snat.c |
| 126 | libjvpp_snat_la_CPPFLAGS = -Ijvpp-snat |
| 127 | |
| 128 | BUILT_SOURCES += jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h |
| 129 | |
| 130 | JAR_FILES += jvpp-snat-$(PACKAGE_VERSION).jar |
| 131 | CLEANDIRS += jvpp-snat/target |
| 132 | |
| 133 | jvpp_snat_json_files = @top_builddir@/plugins/snat/snat.api.json |
| 134 | |
| 135 | jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_json_files) |
| 136 | $(call japigen,snat,JVppSnatImpl) |
| 137 | endif |
| 138 | |
| 139 | # |
| 140 | # iOAM Trace Plugin |
| 141 | # |
| 142 | if ENABLE_IOAM_PLUGIN |
| 143 | noinst_LTLIBRARIES += libjvpp_ioamtrace.la |
| 144 | libjvpp_ioamtrace_la_SOURCES = jvpp-ioamtrace/jvpp_ioam_trace.c |
| 145 | |
| 146 | BUILT_SOURCES += jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h |
| 147 | JAR_FILES += jvpp-ioamtrace-$(PACKAGE_VERSION).jar |
| 148 | CLEANDIRS += jvpp-ioamtrace/target |
| 149 | |
| 150 | jvpp_ioamtrace_json_files = @top_builddir@/plugins/ioam/lib-trace/trace.api.json |
| 151 | |
| 152 | jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h: $(jvpp_registry_ok) $(jvpp_ioamtrace_json_files) |
| 153 | $(call japigen,ioamtrace,JVppIoamtraceImpl) |
| 154 | |
| 155 | # |
| 156 | # iOAM POT Plugin |
| 157 | # |
| 158 | noinst_LTLIBRARIES += libjvpp_ioampot.la |
| 159 | libjvpp_ioampot_la_SOURCES = jvpp-ioampot/jvpp_ioam_pot.c |
| 160 | |
| 161 | BUILT_SOURCES += jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h |
| 162 | JAR_FILES += jvpp-ioampot-$(PACKAGE_VERSION).jar |
| 163 | CLEANDIRS += jvpp-ioampot/target |
| 164 | |
| 165 | jvpp_ioampot_json_files = @top_builddir@/plugins/ioam/lib-pot/pot.api.json |
| 166 | |
| 167 | jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h: $(jvpp_registry_ok) $(jvpp_ioampot_json_files) |
| 168 | $(call japigen,ioampot,JVppIoampotImpl) |
| 169 | |
| 170 | # |
| 171 | # iOAM Export Plugin |
| 172 | # |
| 173 | noinst_LTLIBRARIES += libjvpp_ioamexport.la |
| 174 | libjvpp_ioamexport_la_SOURCES = jvpp-ioamexport/jvpp_ioam_export.c |
| 175 | |
| 176 | BUILT_SOURCES += jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h |
| 177 | JAR_FILES += jvpp-ioamexport-$(PACKAGE_VERSION).jar |
| 178 | CLEANDIRS += jvpp-ioamexport/target |
| 179 | |
| 180 | jvpp_ioamexport_json_files = @top_builddir@/plugins/ioam/export/ioam_export.api.json |
| 181 | |
| 182 | jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h: $(jvpp_registry_ok) $(jvpp_ioamexport_json_files) |
| 183 | $(call japigen,ioamexport,JVppIoamexportImpl) |
| 184 | endif |
| 185 | |
| 186 | # |
| 187 | # JAR creation |
| 188 | # |
| 189 | jvpp-%-$(PACKAGE_VERSION).jar: libjvpp_%.la |
| 190 | @echo " JAR $@" |
| 191 | @cp .libs/libjvpp_$*.so jvpp-$*/target |
| 192 | @$(JAR) cf $(JARFLAGS) $@ -C jvpp-$*/target . |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 193 | |
| 194 | jardir = $(prefix)/share/java |
| 195 | jar_DATA = $(JAR_FILES) |
| 196 | |
| 197 | all-local: $(JAR_FILES) |
| 198 | |
| 199 | # |
| 200 | # Cleanup |
| 201 | # |
| 202 | CLEANFILES = jvpp-registry.ok $(JAR_FILES) $(BUILT_SOURCES) |
| 203 | |
| 204 | clean-local: |
| 205 | rm -rf $(CLEANDIRS) |