2 # Copyright (c) <current-year> <your-organization>
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 AUTOMAKE_OPTIONS = foreign subdir-objects
17 AM_CFLAGS = -Wall @DPDK@
18 AM_LDFLAGS = -module -shared -avoid-version
20 vppapitestpluginsdir = ${libdir}/vpp_api_test_plugins
21 vpppluginsdir = ${libdir}/vpp_plugins
23 vppapitestplugins_LTLIBRARIES = snat_test_plugin.la
24 vppplugins_LTLIBRARIES = snat_plugin.la
26 snat_plugin_la_SOURCES = snat/snat.c \
29 snat/snat_plugin.api.h
31 BUILT_SOURCES = snat/snat.api.h snat/snat.api.json
33 SUFFIXES = .api.h .api
36 mkdir -p `dirname $@` ; \
37 $(CC) $(CPPFLAGS) -E -P -C -x c $^ \
38 | vppapigen --input - --output $@ --show-name $@
41 @echo " JSON APIGEN " $@ ; \
42 mkdir -p `dirname $@` ; \
43 $(CC) $(CPPFLAGS) -E -P -C -x c $^ \
44 | vppapigen --input - --json $@
46 apidir = $(prefix)/snat/
47 api_DATA = snat.api.json
50 snat/snat_all_api_h.h \
51 snat/snat_msg_enum.h \
54 snat_test_plugin_la_SOURCES = \
55 snat/snat_test.c snat/snat_plugin.api.h
59 @(cd $(vpppluginsdir) && $(RM) $(vppplugins_LTLIBRARIES))
60 @(cd $(vppapitestpluginsdir) && $(RM) $(vppapitestplugins_LTLIBRARIES))
63 # Java code generation
65 jvpp_registry_root = ../../vpp-api/java
66 jvpp_registry_version = 17.01
67 jsnat_jarfile = jvpp-snat-$(PACKAGE_VERSION).jar
68 jvpp_package_dir = io/fd/vpp/jvpp/snat
70 jvpp_target_dir = target
71 jvpp_target = $(jvpp_root)/$(jvpp_target_dir)
72 api_file=$(srcdir)/snat/snat.api
74 lib_LTLIBRARIES = libjvpp_snat.la
75 libjvpp_snat_la_SOURCES = snat/snat.api.h snat/jvpp_snat.c snat/jvpp/io_fd_vpp_jvpp_snat_JVppSnatImpl.h
76 libjvpp_snat_la_LIBADD = -lvlibmemoryclient -lvlibapi -lvppinfra \
77 -lpthread -lm -lrt -L$(jvpp_registry_root)/.libs -ljvpp_common
78 libjvpp_snat_la_LDFLAGS = -module
79 libjvpp_snat_la_CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -I../ -I$(srcdir)/../
81 BUILT_SOURCES += $(jvpp_root)/io_fd_vpp_jvpp_snat_JVppSnatImpl.h
83 $(jvpp_root)/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: snat.api.json
85 mkdir -p $(jvpp_target); \
86 mkdir -p $(jvpp_root)/$(jvpp_package_dir); \
87 cd $(jvpp_root)/$(jvpp_package_dir); \
88 mkdir -p dto future callfacade callback notification test; \
89 @srcdir@/$(jvpp_registry_root)/jvpp/gen/jvpp_gen.py -i $${dir}/snat.api.json --plugin_name snat; \
91 mv -f $(jvpp_root)/$(jvpp_package_dir)/jvpp_snat_gen.h $(jvpp_root)/jvpp_snat_gen.h; \
92 cp $(srcdir)/$(jvpp_root)/$(jvpp_package_dir)/test/*.java $(jvpp_root)/$(jvpp_package_dir)/test/; \
94 $(JAVAC) -classpath .:$(jvpp_target_dir):../../$(jvpp_registry_root)/jvpp-registry-$(jvpp_registry_version).jar -d $(jvpp_target_dir) $(jvpp_package_dir)/*.java \
95 $(jvpp_package_dir)/dto/*.java \
96 $(jvpp_package_dir)/callback/*.java \
97 $(jvpp_package_dir)/notification/*.java \
98 $(jvpp_package_dir)/future/*.java \
99 $(jvpp_package_dir)/callfacade/*.java \
100 $(jvpp_package_dir)/test/*.java \
101 || (echo "snat jvpp compilation failed: $$?"; exit 1); \
102 $(JAVAH) -classpath .:$(jvpp_target_dir):../../$(jvpp_registry_root)/jvpp-registry-$(jvpp_registry_version).jar -d . io.fd.vpp.jvpp.snat.JVppSnatImpl ;
104 $(jsnat_jarfile): libjvpp_snat.la
105 cp .libs/libjvpp_snat.so.0.0.0 $(jvpp_target); \
107 $(JAR) cfv $(JARFLAGS) ../../../$@ libjvpp_snat.so.0.0.0 $(jvpp_package_dir)/* ; cd ..;
110 @echo " jSnat_sfc API"; \
111 vppapigen --input $(api_file) --json snat.api.json;
113 all-local: $(jsnat_jarfile)