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