Makefile.am revision d65ee3a8
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 -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_plugin.api.h 
26nsh_plugin_la_LDFLAGS = -module
27
28BUILT_SOURCES = vpp-api/nsh.api.h
29
30SUFFIXES = .api.h .api
31
32vpp-api/%.api.h: nsh/%.api
33	mkdir -p `dirname $@` ; \
34	$(CC) $(CPPFLAGS) -E -P -C -x c $^ \
35	| vppapigen --input - --output $@ --show-name $@
36
37nobase_include_HEADERS =			\
38  vpp-api/nsh_all_api_h.h			\
39  vpp-api/nsh_msg_enum.h			\
40  vpp-api/nsh.api.h
41
42nsh_test_plugin_la_SOURCES = \
43  nsh/nsh_test.c nsh/nsh_plugin.api.h
44nsh_test_plugin_la_LDFLAGS = -module
45
46install-data-hook:
47	mkdir $(prefix)/lib/vpp_plugins || true
48	mkdir $(prefix)/lib/vpp_api_test_plugins || true
49	cp $(prefix)/lib/nsh_plugin.so.*.*.* $(prefix)/lib/vpp_plugins/nsh_plugin.so
50	cp $(prefix)/lib/nsh_test_plugin.so.*.*.* \
51		$(prefix)/lib/vpp_api_test_plugins/nsh_test_plugin.so
52	rm -f $(prefix)/lib/nsh_plugin.*
53	rm -f $(prefix)/lib/nsh_test_plugin.*
54
55pkg-rpm: all install
56	cd $(srcdir)/packaging/rpm; \
57	rpmbuild -bb --define "_topdir $$PWD" \
58		--define "_plugin_prefix ${prefix}" vpp-nsh-plugin.spec
59
60pkg-deb: all install
61	DOTPREFIX=$$(readlink -f ${srcdir}/packaging/deb/debian); \
62	echo DOTPREFIX $${DOTPREFIX}; \
63	DOTPREFIX=$$(echo $${DOTPREFIX}| sed 's;[^\/]*;..;g'); \
64	echo DOTPREFIX $${DOTPREFIX}; \
65	echo ../../$${DOTPREFIX}/$(prefix)/lib/vpp_plugins/nsh_plugin.so /usr/lib/vpp_plugins > $(srcdir)/packaging/deb/debian/vpp-nsh-plugin.install; \
66	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; \
67	echo ../../$${DOTPREFIX}/$(prefix)/include/vpp-api/nsh_all_api_h.h /usr/include/vpp-api > $(srcdir)/packaging/deb/debian/vpp-nsh-plugin-dev.install; \
68	echo ../../$${DOTPREFIX}/$(prefix)/include/vpp-api/nsh_msg_enum.h /usr/include/vpp-api >> $(srcdir)/packaging/deb/debian/vpp-ns\
69h-plugin-dev.install; \
70	echo ../../$${DOTPREFIX}/$(prefix)/include/vpp-api/nsh.api.h /usr/include/vpp-api >> $(srcdir)/packaging/deb/debian/vpp-nsh-plugin-dev.install
71	$(srcdir)/packaging/scripts/generate-deb-changelog; 				\
72	(								\
73	cd $(srcdir)/packaging/deb &&							\
74	dpkg-buildpackage -us -uc -b					\
75	)
76
77