Makefile.am revision 8c1fd947
1# Copyright (c) <current-year> <your-organization>
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
15SUBDIRS=java
16AM_CFLAGS = -Wall -Werror -I@TOOLKIT_INCLUDE@
17
18nsh_plugin_la_CPPFLAGS = -DDEBUG -g
19nsh_test_plugin_la_CPPFLAGS = -DDEBUG -g
20
21CPPFLAGS += -DDEBUG -g
22
23lib_LTLIBRARIES = nsh_plugin.la nsh_test_plugin.la
24nsh_plugin_la_SOURCES = nsh/nsh.c  \
25	nsh/nsh_pop.c \
26	nsh/nsh_output.c \
27	vpp-api/nsh.api.h \
28	nsh-md2-ioam/nsh_md2_ioam.c \
29	nsh-md2-ioam/nsh_md2_ioam_trace.c \
30	nsh-md2-ioam/md2_ioam_transit.c \
31	nsh-md2-ioam/nsh_md2_ioam_api.c \
32	nsh-md2-ioam/export-nsh-md2-ioam/nsh_md2_ioam_export.c \
33	nsh-md2-ioam/export-nsh-md2-ioam/nsh_md2_ioam_export_thread.c \
34	nsh-md2-ioam/export-nsh-md2-ioam/nsh_md2_ioam_node.c
35
36nsh_plugin_la_LDFLAGS = -module
37
38BUILT_SOURCES = vpp-api/nsh.api.h
39
40SUFFIXES = .api.h .api
41
42vpp-api/%.api.h: nsh/%.api
43	mkdir -p `dirname $@` ; \
44	$(CC) $(CPPFLAGS) -E -P -C -x c $^ \
45	| vppapigen --input - --output $@ --show-name $@
46
47nobase_include_HEADERS =			\
48  vpp-api/nsh_all_api_h.h			\
49  vpp-api/nsh_msg_enum.h			\
50  vpp-api/nsh.api.h
51
52nsh_test_plugin_la_SOURCES = \
53  nsh/nsh_test.c vpp-api/nsh.api.h
54nsh_test_plugin_la_LDFLAGS = -module
55
56install-data-hook:
57	mkdir $(prefix)/lib/vpp_plugins || true
58	mkdir $(prefix)/lib/vpp_api_test_plugins || true
59	cp $(prefix)/lib/nsh_plugin.so.*.*.* $(prefix)/lib/vpp_plugins/nsh_plugin.so
60	cp $(prefix)/lib/nsh_test_plugin.so.*.*.* \
61		$(prefix)/lib/vpp_api_test_plugins/nsh_test_plugin.so
62	rm -f $(prefix)/lib/nsh_plugin.*
63	rm -f $(prefix)/lib/nsh_test_plugin.*
64
65pkg-rpm: all install
66	cd $(srcdir)/packaging/rpm; \
67	rpmbuild -bb --define "_topdir $$PWD" \
68		--define "_plugin_prefix ${prefix}" vpp-nsh-plugin.spec
69
70pkg-deb: all install
71	DOTPREFIX=$$(readlink -f ${srcdir}/packaging/deb/debian); \
72	echo DOTPREFIX $${DOTPREFIX}; \
73	DOTPREFIX=$$(echo $${DOTPREFIX}| sed 's;[^\/]*;..;g'); \
74	echo DOTPREFIX $${DOTPREFIX}; \
75	echo ../../$${DOTPREFIX}/$(prefix)/lib/vpp_plugins/nsh_plugin.so /usr/lib/vpp_plugins > $(srcdir)/packaging/deb/debian/vpp-nsh-plugin.install; \
76	echo ../../$${DOTPREFIX}/$(prefix)/lib/vpp_api_test_plugins/nsh_test_plugin.so /usr/lib/vpp_api_test_plugins >> $(srcdir)/packaging/deb/debian/vpp-nsh-plugin.install; \
77	echo ../../$${DOTPREFIX}/$(prefix)/include/vpp-api/nsh_all_api_h.h /usr/include/vpp-api > $(srcdir)/packaging/deb/debian/vpp-nsh-plugin-dev.install; \
78	echo ../../$${DOTPREFIX}/$(prefix)/include/vpp-api/nsh_msg_enum.h /usr/include/vpp-api >> $(srcdir)/packaging/deb/debian/vpp-ns\
79h-plugin-dev.install; \
80	echo ../../$${DOTPREFIX}/$(prefix)/include/vpp-api/nsh.api.h /usr/include/vpp-api >> $(srcdir)/packaging/deb/debian/vpp-nsh-plugin-dev.install
81	$(srcdir)/packaging/scripts/generate-deb-changelog; 				\
82	(								\
83	cd $(srcdir)/packaging/deb &&							\
84	dpkg-buildpackage -us -uc -b					\
85	)
86
87