Makefile.am revision 2fd17601
1# Copyright (c) 2015 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 subdir-objects
15ACLOCAL_AMFLAGS = -I m4
16AM_CFLAGS = -Wall 
17
18
19noinst_PROGRAMS =
20BUILT_SOURCES =
21bin_PROGRAMS =
22CLEANFILES =
23
24nobase_include_HEADERS = jvpp/io_fd_vpp_jvpp_nsh_JVppNshImpl.h
25
26jarfile_jnsh_sfc = jnsh_sfc-$(PACKAGE_VERSION).jar
27java_packagedir = io/fd/vpp/jvpp/nsh
28java_gendir = jvpp/src/main/java
29resourcesdir = jvpp/src/main/resources
30api_file=$(srcdir)/../nsh/nsh.api
31jvpp_gen = jvpp_gen.py
32
33
34lib_LTLIBRARIES = libjvpp_nsh.la
35
36libjvpp_nsh_la_SOURCES = $(srcdir)/../java/nsh.api.h jvpp/jvpp_nsh.c jvpp/io_fd_vpp_jvpp_nsh_JVppNshImpl.h
37
38libjvpp_nsh_la_LIBADD = -lvlibmemoryclient -lsvm -lvppinfra \
39	              -lpthread -lm -lrt -ljvpp_common
40libjvpp_nsh_la_LDFLAGS = -module
41libjvpp_nsh_la_CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -I../ -I$(srcdir)/../
42
43BUILT_SOURCES = jvpp/io_fd_vpp_jvpp_nsh_JVppNshImpl.h
44
45jvpp/io_fd_vpp_jvpp_nsh_JVppNshImpl.h: nsh.api.json
46	$(jvpp_gen) -i nsh.api.json --plugin_name nsh --root_dir $(java_gendir)/$(java_packagedir)  > /dev/null;  \
47	mv -f $(java_gendir)/$(java_packagedir)/target/io/fd/vpp/jvpp/nsh/* $(java_gendir)/$(java_packagedir)/;  \
48	mv -f $(java_gendir)/$(java_packagedir)/jvpp_nsh_gen.h jvpp/jvpp_nsh_gen.h;							\
49	cp $(srcdir)/pom.xml jvpp/;				\
50	mkdir -p $(java_gendir)/$(java_packagedir)/test;
51	cp $(srcdir)/jvpp/test/*.java $(java_gendir)/$(java_packagedir)/test/;				\
52	cd jvpp;				\
53	mvn $${MAVEN_SETTINGS_OPTIONS} -v;	\
54	mvn $${MAVEN_SETTINGS_OPTIONS} clean process-classes;
55
56$(jarfile_jnsh_sfc): libjvpp_nsh.la
57	mkdir -p $(resourcesdir);				\
58	cp .libs/libjvpp_nsh.so $(resourcesdir)/libjvpp_nsh.so;	\
59	cd jvpp;				\
60	mvn $${MAVEN_SETTINGS_OPTIONS} -v;	\
61	mvn $${MAVEN_SETTINGS_OPTIONS} package;
62
63nsh.api.json: $(api_file)
64	@echo "  jNsh_sfc API"; \
65	$(CC) $(CPPFLAGS) -E -P -C -x c $^ \
66	| vppapigen --input $^ JSON --output $@
67
68all-local: $(jarfile_jnsh_sfc)
69