Instead of defining targets conditionally and depending on them unconditionally, define a couple of variables and conditionally add targets to them. In addition to removing a bunch of useless code, this has the nice effect of no longer requiring the main Makefile.am to have any knowledge about the contents of the various snippets it includes. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/Makefile.am | 59 ++++++++++++++++---------------------- src/remote/Makefile.inc.am | 30 ++++++++----------- 2 files changed, 37 insertions(+), 52 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 82a96adb99..cd386297ed 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -72,6 +72,8 @@ STATEFUL_DRIVER_SOURCE_FILES = noinst_LTLIBRARIES = mod_LTLIBRARIES = INSTALL_DATA_DIRS = +INSTALL_DATA_LOCAL = +UNINSTALL_LOCAL = libvirt_la_BUILT_LIBADD = SYM_FILES = USED_SYM_FILES = @@ -805,10 +807,10 @@ install-logrotate: $(LOGROTATE_FILES) uninstall-logrotate: rm -f $(LOGROTATE_FILES:%.logrotate=$(DESTDIR)$(sysconfdir)/logrotate.d/%) rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || : -else ! WITH_LIBVIRTD -install-logrotate: -uninstall-logrotate: -endif ! WITH_LIBVIRTD + +INSTALL_DATA_LOCAL += install-logrotate +UNINSTALL_LOCAL += uninstall-logrotate +endif WITH_LIBVIRTD if WITH_LIBVIRTD if LIBVIRT_INIT_SCRIPT_RED_HAT @@ -827,14 +829,11 @@ uninstall-init:: uninstall-sysconfig BUILT_SOURCES += $(SYSVINIT_FILES) DISTCLEANFILES += $(SYSVINIT_FILES) -else ! LIBVIRT_INIT_SCRIPT_RED_HAT -install-init:: -uninstall-init:: -endif ! LIBVIRT_INIT_SCRIPT_RED_HAT -else ! WITH_LIBVIRTD -install-init:: -uninstall-init:: -endif ! WITH_LIBVIRTD + +INSTALL_DATA_LOCAL += install-init +UNINSTALL_LOCAL += uninstall-init +endif LIBVIRT_INIT_SCRIPT_RED_HAT +endif WITH_LIBVIRTD %.8: %.8.in $(top_srcdir)/configure.ac @@ -873,14 +872,11 @@ install-systemd: $(SYSTEMD_UNIT_FILES) install-sysconfig uninstall-systemd: uninstall-sysconfig rm -f $(SYSTEMD_UNIT_FILES:%=$(DESTDIR)$(SYSTEMD_UNIT_DIR)/%) rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || : -else ! LIBVIRT_INIT_SCRIPT_SYSTEMD -install-systemd: -uninstall-systemd: -endif ! LIBVIRT_INIT_SCRIPT_SYSTEMD -else ! WITH_LIBVIRTD -install-systemd: -uninstall-systemd: -endif ! WITH_LIBVIRTD + +INSTALL_DATA_LOCAL += install-systemd +UNINSTALL_LOCAL += uninstall-systemd +endif LIBVIRT_INIT_SCRIPT_SYSTEMD +endif WITH_LIBVIRTD EXTRA_DIST += $(UPSTART_FILES) @@ -904,14 +900,11 @@ uninstall-upstart: uninstall-sysconfig rm -f $(DESTDIR)$(sysconfdir)/event.d/$$tgt ; \ done rmdir $(DESTDIR)$(sysconfdir)/event.d || : -else ! LIBVIRT_INIT_SCRIPT_UPSTART -install-upstart: -uninstall-upstart: -endif ! LIBVIRT_INIT_SCRIPT_UPSTART -else ! WITH_LIBVIRTD -install-upstart: -uninstall-upstart: -endif ! WITH_LIBVIRTD + +INSTALL_DATA_LOCAL += install-upstart +UNINSTALL_LOCAL += uninstall-upstart +endif LIBVIRT_INIT_SCRIPT_UPSTART +endif WITH_LIBVIRTD EXTRA_DIST += dtrace2systemtap.pl @@ -1010,17 +1003,15 @@ libvirt_nss_la_LIBADD = \ endif WITH_NSS -install-data-local: install-init install-systemd install-upstart \ - install-sysctl install-polkit install-sasl \ - install-logrotate $(INSTALL_DATA_DIRS:%=install-data-%) +install-data-local: $(INSTALL_DATA_LOCAL) \ + $(INSTALL_DATA_DIRS:%=install-data-%) $(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt" $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/images" $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems" $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/boot" -uninstall-local:: uninstall-init uninstall-systemd uninstall-upstart \ - uninstall-sysctl uninstall-polkit uninstall-sasl \ - uninstall-logrotate $(INSTALL_DATA_DIRS:%=uninstall-data-%) +uninstall-local:: $(UNINSTALL_LOCAL) \ + $(INSTALL_DATA_DIRS:%=uninstall-data-%) rmdir "$(DESTDIR)$(localstatedir)/cache/libvirt" ||: rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/images" ||: rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems" ||: diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am index 3355dc68e5..0988435eed 100644 --- a/src/remote/Makefile.inc.am +++ b/src/remote/Makefile.inc.am @@ -203,10 +203,10 @@ install-sysctl: uninstall-sysctl: rm -f $(DESTDIR)$(sysctldir)/60-libvirtd.conf rmdir $(DESTDIR)$(sysctldir) || : -else ! WITH_SYSCTL -install-sysctl: -uninstall-sysctl: -endif ! WITH_SYSCTL + +INSTALL_DATA_LOCAL += install-sysctl +UNINSTALL_LOCAL += uninstall-sysctl +endif WITH_SYSCTL if WITH_POLKIT polkitdir = $(datadir)/polkit-1 @@ -227,17 +227,11 @@ uninstall-polkit:: rm -f $(DESTDIR)$(polkitrulesdir)/50-libvirt.rules rmdir $(DESTDIR)$(polkitrulesdir) || : -else ! WITH_POLKIT -install-polkit:: -uninstall-polkit:: -endif ! WITH_POLKIT +INSTALL_DATA_LOCAL += install-polkit +UNINSTALL_LOCAL += uninstall-polkit +endif WITH_POLKIT -else ! WITH_LIBVIRTD -install-polkit:: -uninstall-polkit:: -install-sysctl:: -uninstall-sysctl:: -endif ! WITH_LIBVIRTD +endif WITH_LIBVIRTD .PHONY: \ install-data-remote \ @@ -258,10 +252,10 @@ install-sasl: uninstall-sasl: rm -f $(DESTDIR)$(sasldir)/libvirt.conf rmdir $(DESTDIR)$(sasldir) || : -else ! WITH_SASL -install-sasl: -uninstall-sasl: -endif ! WITH_SASL + +INSTALL_DATA_LOCAL += install-sasl +UNINSTALL_LOCAL += uninstall-sasl +endif WITH_SASL libvirtd.init: remote/libvirtd.init.in $(top_builddir)/config.status $(AM_V_GEN)sed \ -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list