1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

src: Simplify installing/uninstalling data

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@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Andrea Bolognani 2019-01-09 17:11:12 +01:00
parent ab575b7b77
commit 50d5cb0df3
2 changed files with 37 additions and 52 deletions

View File

@ -72,6 +72,8 @@ STATEFUL_DRIVER_SOURCE_FILES =
noinst_LTLIBRARIES = noinst_LTLIBRARIES =
mod_LTLIBRARIES = mod_LTLIBRARIES =
INSTALL_DATA_DIRS = INSTALL_DATA_DIRS =
INSTALL_DATA_LOCAL =
UNINSTALL_LOCAL =
libvirt_la_BUILT_LIBADD = libvirt_la_BUILT_LIBADD =
SYM_FILES = SYM_FILES =
USED_SYM_FILES = USED_SYM_FILES =
@ -805,10 +807,10 @@ install-logrotate: $(LOGROTATE_FILES)
uninstall-logrotate: uninstall-logrotate:
rm -f $(LOGROTATE_FILES:%.logrotate=$(DESTDIR)$(sysconfdir)/logrotate.d/%) rm -f $(LOGROTATE_FILES:%.logrotate=$(DESTDIR)$(sysconfdir)/logrotate.d/%)
rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || : rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || :
else ! WITH_LIBVIRTD
install-logrotate: INSTALL_DATA_LOCAL += install-logrotate
uninstall-logrotate: UNINSTALL_LOCAL += uninstall-logrotate
endif ! WITH_LIBVIRTD endif WITH_LIBVIRTD
if WITH_LIBVIRTD if WITH_LIBVIRTD
if LIBVIRT_INIT_SCRIPT_RED_HAT if LIBVIRT_INIT_SCRIPT_RED_HAT
@ -827,14 +829,11 @@ uninstall-init:: uninstall-sysconfig
BUILT_SOURCES += $(SYSVINIT_FILES) BUILT_SOURCES += $(SYSVINIT_FILES)
DISTCLEANFILES += $(SYSVINIT_FILES) DISTCLEANFILES += $(SYSVINIT_FILES)
else ! LIBVIRT_INIT_SCRIPT_RED_HAT
install-init:: INSTALL_DATA_LOCAL += install-init
uninstall-init:: UNINSTALL_LOCAL += uninstall-init
endif ! LIBVIRT_INIT_SCRIPT_RED_HAT endif LIBVIRT_INIT_SCRIPT_RED_HAT
else ! WITH_LIBVIRTD endif WITH_LIBVIRTD
install-init::
uninstall-init::
endif ! WITH_LIBVIRTD
%.8: %.8.in $(top_srcdir)/configure.ac %.8: %.8.in $(top_srcdir)/configure.ac
@ -873,14 +872,11 @@ install-systemd: $(SYSTEMD_UNIT_FILES) install-sysconfig
uninstall-systemd: uninstall-sysconfig uninstall-systemd: uninstall-sysconfig
rm -f $(SYSTEMD_UNIT_FILES:%=$(DESTDIR)$(SYSTEMD_UNIT_DIR)/%) rm -f $(SYSTEMD_UNIT_FILES:%=$(DESTDIR)$(SYSTEMD_UNIT_DIR)/%)
rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || : rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
else ! LIBVIRT_INIT_SCRIPT_SYSTEMD
install-systemd: INSTALL_DATA_LOCAL += install-systemd
uninstall-systemd: UNINSTALL_LOCAL += uninstall-systemd
endif ! LIBVIRT_INIT_SCRIPT_SYSTEMD endif LIBVIRT_INIT_SCRIPT_SYSTEMD
else ! WITH_LIBVIRTD endif WITH_LIBVIRTD
install-systemd:
uninstall-systemd:
endif ! WITH_LIBVIRTD
EXTRA_DIST += $(UPSTART_FILES) EXTRA_DIST += $(UPSTART_FILES)
@ -904,14 +900,11 @@ uninstall-upstart: uninstall-sysconfig
rm -f $(DESTDIR)$(sysconfdir)/event.d/$$tgt ; \ rm -f $(DESTDIR)$(sysconfdir)/event.d/$$tgt ; \
done done
rmdir $(DESTDIR)$(sysconfdir)/event.d || : rmdir $(DESTDIR)$(sysconfdir)/event.d || :
else ! LIBVIRT_INIT_SCRIPT_UPSTART
install-upstart: INSTALL_DATA_LOCAL += install-upstart
uninstall-upstart: UNINSTALL_LOCAL += uninstall-upstart
endif ! LIBVIRT_INIT_SCRIPT_UPSTART endif LIBVIRT_INIT_SCRIPT_UPSTART
else ! WITH_LIBVIRTD endif WITH_LIBVIRTD
install-upstart:
uninstall-upstart:
endif ! WITH_LIBVIRTD
EXTRA_DIST += dtrace2systemtap.pl EXTRA_DIST += dtrace2systemtap.pl
@ -1010,17 +1003,15 @@ libvirt_nss_la_LIBADD = \
endif WITH_NSS endif WITH_NSS
install-data-local: install-init install-systemd install-upstart \ install-data-local: $(INSTALL_DATA_LOCAL) \
install-sysctl install-polkit install-sasl \ $(INSTALL_DATA_DIRS:%=install-data-%)
install-logrotate $(INSTALL_DATA_DIRS:%=install-data-%)
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt" $(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt"
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/images" $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/images"
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems" $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems"
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/boot" $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/boot"
uninstall-local:: uninstall-init uninstall-systemd uninstall-upstart \ uninstall-local:: $(UNINSTALL_LOCAL) \
uninstall-sysctl uninstall-polkit uninstall-sasl \ $(INSTALL_DATA_DIRS:%=uninstall-data-%)
uninstall-logrotate $(INSTALL_DATA_DIRS:%=uninstall-data-%)
rmdir "$(DESTDIR)$(localstatedir)/cache/libvirt" ||: rmdir "$(DESTDIR)$(localstatedir)/cache/libvirt" ||:
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/images" ||: rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/images" ||:
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems" ||: rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems" ||:

View File

@ -203,10 +203,10 @@ install-sysctl:
uninstall-sysctl: uninstall-sysctl:
rm -f $(DESTDIR)$(sysctldir)/60-libvirtd.conf rm -f $(DESTDIR)$(sysctldir)/60-libvirtd.conf
rmdir $(DESTDIR)$(sysctldir) || : rmdir $(DESTDIR)$(sysctldir) || :
else ! WITH_SYSCTL
install-sysctl: INSTALL_DATA_LOCAL += install-sysctl
uninstall-sysctl: UNINSTALL_LOCAL += uninstall-sysctl
endif ! WITH_SYSCTL endif WITH_SYSCTL
if WITH_POLKIT if WITH_POLKIT
polkitdir = $(datadir)/polkit-1 polkitdir = $(datadir)/polkit-1
@ -227,17 +227,11 @@ uninstall-polkit::
rm -f $(DESTDIR)$(polkitrulesdir)/50-libvirt.rules rm -f $(DESTDIR)$(polkitrulesdir)/50-libvirt.rules
rmdir $(DESTDIR)$(polkitrulesdir) || : rmdir $(DESTDIR)$(polkitrulesdir) || :
else ! WITH_POLKIT INSTALL_DATA_LOCAL += install-polkit
install-polkit:: UNINSTALL_LOCAL += uninstall-polkit
uninstall-polkit:: endif WITH_POLKIT
endif ! WITH_POLKIT
else ! WITH_LIBVIRTD endif WITH_LIBVIRTD
install-polkit::
uninstall-polkit::
install-sysctl::
uninstall-sysctl::
endif ! WITH_LIBVIRTD
.PHONY: \ .PHONY: \
install-data-remote \ install-data-remote \
@ -258,10 +252,10 @@ install-sasl:
uninstall-sasl: uninstall-sasl:
rm -f $(DESTDIR)$(sasldir)/libvirt.conf rm -f $(DESTDIR)$(sasldir)/libvirt.conf
rmdir $(DESTDIR)$(sasldir) || : rmdir $(DESTDIR)$(sasldir) || :
else ! WITH_SASL
install-sasl: INSTALL_DATA_LOCAL += install-sasl
uninstall-sasl: UNINSTALL_LOCAL += uninstall-sasl
endif ! WITH_SASL endif WITH_SASL
libvirtd.init: remote/libvirtd.init.in $(top_builddir)/config.status libvirtd.init: remote/libvirtd.init.in $(top_builddir)/config.status
$(AM_V_GEN)sed \ $(AM_V_GEN)sed \