We can't rely on $(noinst_PROGRAMS) retaining its original
value, so let's use a separate $(EXAMPLES) variable instead.

Signed-off-by: Andrea Bolognani <abolo...@redhat.com>
---
 examples/Makefile.am | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/examples/Makefile.am b/examples/Makefile.am
index c7688c7c3d..11c9f44917 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -34,11 +34,32 @@ LDADD = $(STATIC_BINARIES) $(WARN_CFLAGS) \
        $(top_builddir)/src/libvirt.la \
        $(top_builddir)/src/libvirt-admin.la
 
-noinst_PROGRAMS=dominfo/info1 dommigrate/dommigrate domsuspend/suspend \
-       domtop/domtop hellolibvirt/hellolibvirt object-events/event-test \
-       openauth/openauth rename/rename admin/list_servers admin/list_clients \
-       admin/threadpool_params admin/client_limits admin/client_info \
-       admin/client_close admin/logging
+# List of example programs. We need to list them here instead of using
+# $(noinst_PROGRAMS) directly because we want to have access to the
+# unmodified list during (un)installation, but at the same time automake
+# might tweak $(noinst_PROGRAMS) to eg. automatically add the .exe file
+# extension when targeting Windows.
+EXAMPLES = \
+       admin/client_close \
+       admin/client_info \
+       admin/client_limits \
+       admin/list_clients \
+       admin/list_servers \
+       admin/logging \
+       admin/threadpool_params \
+       dominfo/info1 \
+       dommigrate/dommigrate \
+       domsuspend/suspend \
+       domtop/domtop \
+       hellolibvirt/hellolibvirt \
+       object-events/event-test \
+       openauth/openauth \
+       rename/rename \
+       $(NULL)
+
+noinst_PROGRAMS = \
+       $(EXAMPLES) \
+       $(NULL)
 
 dominfo_info1_SOURCES = dominfo/info1.c
 dommigrate_dommigrate_SOURCES = dommigrate/dommigrate.c
@@ -88,13 +109,13 @@ examplesdir = $(docdir)/examples
 
 install-data-local: $(INSTALL_DATA_LOCAL)
        $(mkinstalldirs) $(DESTDIR)$(examplesdir)
-       for p in $(noinst_PROGRAMS); do \
+       for p in $(EXAMPLES); do \
                d=$$(dirname $$p); \
                $(mkinstalldirs) $(DESTDIR)$(examplesdir)/$$d; \
                $(INSTALL_DATA) $(srcdir)/$${p}.c 
$(DESTDIR)$(examplesdir)/$$d/; \
        done
 
 uninstall-local: $(UNINSTALL_LOCAL)
-       for p in $(noinst_PROGRAMS); do \
+       for p in $(EXAMPLES); do \
                rm -f $(DESTDIR)$(examplesdir)/$${p}.c; \
        done
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to