From cd191ba0bb5d700a2ed3f6a031c324ec0148e777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com> Date: Tue, 20 Feb 2018 14:28:00 +0000 Subject: [PATCH] src: simplify sysv init file handling in make rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove lots of duplication in the sysv init file handling, so we can add more init files without modifying so many places. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/Makefile.am | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 3e6fb6c244..de2441dd6b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2702,24 +2702,30 @@ uninstall-sysconfig: rm -f $(DESTDIR)$(sysconfdir)/sysconfig/virtlockd rmdir $(DESTDIR)$(sysconfdir)/sysconfig || : -EXTRA_DIST += locking/virtlockd.init.in logging/virtlogd.init.in +SYSVINIT_FILES_IN = \ + locking/virtlockd.init.in \ + logging/virtlogd.init.in \ + $(NULL) + +SYSVINIT_FILES = $(notdir $(SYSVINIT_FILES_IN:%.in=%)) + +EXTRA_DIST += $(SYSVINIT_FILES_IN) if WITH_LIBVIRTD if LIBVIRT_INIT_SCRIPT_RED_HAT -install-init:: virtlockd.init virtlogd.init install-sysconfig +install-init:: $(SYSVINIT_FILES) install-sysconfig $(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d - $(INSTALL_SCRIPT) virtlockd.init \ - $(DESTDIR)$(sysconfdir)/rc.d/init.d/virtlockd - $(INSTALL_SCRIPT) virtlogd.init \ - $(DESTDIR)$(sysconfdir)/rc.d/init.d/virtlogd + for f in $(SYSVINIT_FILES:%.init=%) ; \ + do \ + $(INSTALL_SCRIPT) $$f.init $(DESTDIR)$(sysconfdir)/rc.d/init.d/$$f; \ + done uninstall-init:: uninstall-sysconfig - rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/virtlockd - rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/virtlogd + rm -f $(SYSVINIT_FILES:%.init=$(DESTDIR)$(sysconfdir)/rc.d/init.d/%) rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d || : -BUILT_SOURCES += virtlockd.init virtlogd.init -DISTCLEANFILES += virtlockd.init virtlogd.init +BUILT_SOURCES += $(SYSVINIT_FILES) +DISTCLEANFILES += $(SYSVINIT_FILES) else ! LIBVIRT_INIT_SCRIPT_RED_HAT install-init:: uninstall-init:: -- GitLab