On Mon, May 13, 2019 at 02:55:14PM +0200, Andrea Bolognani wrote:
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 <abologna(a)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
I wonder if we should just directly use the _SOURCES vars instead of making
the assumption that binary names match source files. eg
EXAMPLE_SRCS = \
$(dominfo_info1_SOURCES) \
$(dommigrate_dommigrate_SOURCES) \
.....
then
install-data-local: $(INSTALL_DATA_LOCAL)
$(mkinstalldirs) $(DESTDIR)$(examplesdir)
- for p in $(noinst_PROGRAMS); do \
+ for p in $(EXAMPLES); do \
s/EXAMPLES/EXAMPLE_SRCS/
d=$$(dirname $$p); \
$(mkinstalldirs) $(DESTDIR)$(examplesdir)/$$d; \
$(INSTALL_DATA) $(srcdir)/$${p}.c $(DESTDIR)$(examplesdir)/$$d/; \
s/.c//
done
uninstall-local: $(UNINSTALL_LOCAL)
- for p in $(noinst_PROGRAMS); do \
+ for p in $(EXAMPLES); do \
s/EXAMPLES/EXAMPLE_SRCS/
rm -f $(DESTDIR)$(examplesdir)/$${p}.c; \
s/.c//
done
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|