examples: Fix installation on Windows
[libvirt/ericb.git] / examples / Makefile.am
blob11c9f449174a7dfc36ce4e143dace1895d335595
1 ## Process this file with automake to produce Makefile.in
3 ## Copyright (C) 2005-2016 Red Hat, Inc.
4 ##
5 ## This library is free software; you can redistribute it and/or
6 ## modify it under the terms of the GNU Lesser General Public
7 ## License as published by the Free Software Foundation; either
8 ## version 2.1 of the License, or (at your option) any later version.
9 ##
10 ## This library is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 ## Lesser General Public License for more details.
15 ## You should have received a copy of the GNU Lesser General Public
16 ## License along with this library.  If not, see
17 ## <http://www.gnu.org/licenses/>.
19 FILTERS = $(wildcard $(srcdir)/xml/nwfilter/*.xml)
21 EXTRA_DIST = \
22         lxcconvert/virt-lxc-convert \
23         polkit/libvirt-acl.rules \
24         $(wildcard $(srcdir)/systemtap/*.stp) \
25         $(FILTERS) \
26         $(wildcard $(srcdir)/xml/storage/*.xml) \
27         $(wildcard $(srcdir)/xml/test/*.xml)
30 AM_CPPFLAGS = \
31         -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir) \
32         $(WARN_CFLAGS)
33 LDADD = $(STATIC_BINARIES) $(WARN_CFLAGS) \
34         $(top_builddir)/src/libvirt.la \
35         $(top_builddir)/src/libvirt-admin.la
37 # List of example programs. We need to list them here instead of using
38 # $(noinst_PROGRAMS) directly because we want to have access to the
39 # unmodified list during (un)installation, but at the same time automake
40 # might tweak $(noinst_PROGRAMS) to eg. automatically add the .exe file
41 # extension when targeting Windows.
42 EXAMPLES = \
43         admin/client_close \
44         admin/client_info \
45         admin/client_limits \
46         admin/list_clients \
47         admin/list_servers \
48         admin/logging \
49         admin/threadpool_params \
50         dominfo/info1 \
51         dommigrate/dommigrate \
52         domsuspend/suspend \
53         domtop/domtop \
54         hellolibvirt/hellolibvirt \
55         object-events/event-test \
56         openauth/openauth \
57         rename/rename \
58         $(NULL)
60 noinst_PROGRAMS = \
61         $(EXAMPLES) \
62         $(NULL)
64 dominfo_info1_SOURCES = dominfo/info1.c
65 dommigrate_dommigrate_SOURCES = dommigrate/dommigrate.c
66 domsuspend_suspend_SOURCES = domsuspend/suspend.c
67 domtop_domtop_SOURCES = domtop/domtop.c
68 hellolibvirt_hellolibvirt_SOURCES = hellolibvirt/hellolibvirt.c
70 object_events_event_test_CFLAGS = \
71                 $(WARN_CFLAGS) \
72                 $(NULL)
73 object_events_event_test_SOURCES = object-events/event-test.c
75 openauth_openauth_SOURCES = openauth/openauth.c
76 rename_rename_SOURCES = rename/rename.c
78 admin_list_servers_SOURCES = admin/list_servers.c
79 admin_list_clients_SOURCES = admin/list_clients.c
80 admin_threadpool_params_SOURCES = admin/threadpool_params.c
81 admin_client_limits_SOURCES = admin/client_limits.c
82 admin_client_info_SOURCES = admin/client_info.c
83 admin_client_close_SOURCES = admin/client_close.c
84 admin_logging_SOURCES = admin/logging.c
86 INSTALL_DATA_LOCAL =
87 UNINSTALL_LOCAL =
89 if WITH_NWFILTER
90 NWFILTER_DIR = "$(DESTDIR)$(sysconfdir)/libvirt/nwfilter"
92 install-nwfilter-local:
93         $(MKDIR_P) "$(NWFILTER_DIR)"
94         for f in $(FILTERS); do \
95                 $(INSTALL_DATA) $$f "$(NWFILTER_DIR)"; \
96         done
98 uninstall-nwfilter-local::
99         for f in $(FILTERS); do \
100                 rm -f "$(NWFILTER_DIR)/`basename $$f`"; \
101         done
102         -test -z "$(shell ls $(NWFILTER_DIR))" || rmdir $(NWFILTER_DIR)
104 INSTALL_DATA_LOCAL += install-nwfilter-local
105 UNINSTALL_LOCAL += uninstall-nwfilter-local
106 endif WITH_NWFILTER
108 examplesdir = $(docdir)/examples
110 install-data-local: $(INSTALL_DATA_LOCAL)
111         $(mkinstalldirs) $(DESTDIR)$(examplesdir)
112         for p in $(EXAMPLES); do \
113                 d=$$(dirname $$p); \
114                 $(mkinstalldirs) $(DESTDIR)$(examplesdir)/$$d; \
115                 $(INSTALL_DATA) $(srcdir)/$${p}.c $(DESTDIR)$(examplesdir)/$$d/; \
116         done
118 uninstall-local: $(UNINSTALL_LOCAL)
119         for p in $(EXAMPLES); do \
120                 rm -f $(DESTDIR)$(examplesdir)/$${p}.c; \
121         done