]> xenbits.xensource.com Git - libvirt.git/commitdiff
remote: reduce duplication in systemd unit file make rules into one
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 18 Jul 2019 15:31:45 +0000 (16:31 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 9 Aug 2019 13:06:31 +0000 (14:06 +0100)
The make rules for the systemd socket unit files are all essentially
identical and can be collapsed into a single generic rule. The service
unit file rule can be simplified too.

Reviewed-by: Christophe de Dinechin <dinechin@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/Makefile.am
src/remote/Makefile.inc.am

index 150f67e0c30d671fc8ed2ce3ecb8576b29a0a429..309947d5f74059217c7f3d7a01e91e3ab4de4767 100644 (file)
@@ -89,6 +89,12 @@ man8_MANS =
 DRIVER_SOURCES =
 man7_MANS =
 
+COMMON_UNIT_VARS = \
+       -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
+       -e 's|[@]sbindir[@]|$(sbindir)|g' \
+       -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
+       $(NULL)
+
 include util/Makefile.inc.am
 include conf/Makefile.inc.am
 include cpu/Makefile.inc.am
index 9dc27361fd5f6685dde597e612f06ecb1ebdcc31..554fa4afe9ee5fc4f96d3051965ebaf47e03067e 100644 (file)
@@ -293,48 +293,15 @@ INSTALL_DATA_LOCAL += install-sasl
 UNINSTALL_LOCAL += uninstall-sasl
 endif WITH_SASL
 
+LIBVIRTD_UNIT_VARS = \
+       $(COMMON_UNIT_VARS) \
+       $(NULL)
+
 libvirtd.service: remote/libvirtd.service.in $(top_builddir)/config.status
-       $(AM_V_GEN)sed \
-           -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
-           -e 's|[@]sbindir[@]|$(sbindir)|g' \
-           -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-           < $< > $@-t && \
-           mv $@-t $@
-
-libvirtd.socket: remote/libvirtd.socket.in $(top_builddir)/config.status
-       $(AM_V_GEN)sed \
-           -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
-           -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-           < $< > $@-t && \
-           mv $@-t $@
-
-libvirtd-ro.socket: remote/libvirtd-ro.socket.in $(top_builddir)/config.status
-       $(AM_V_GEN)sed \
-           -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
-           -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-           < $< > $@-t && \
-           mv $@-t $@
-
-libvirtd-admin.socket: remote/libvirtd-admin.socket.in $(top_builddir)/config.status
-       $(AM_V_GEN)sed \
-           -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
-           -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-           < $< > $@-t && \
-           mv $@-t $@
-
-libvirtd-tcp.socket: remote/libvirtd-tcp.socket.in $(top_builddir)/config.status
-       $(AM_V_GEN)sed \
-           -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
-           -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-           < $< > $@-t && \
-           mv $@-t $@
-
-libvirtd-tls.socket: remote/libvirtd-tls.socket.in $(top_builddir)/config.status
-       $(AM_V_GEN)sed \
-           -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
-           -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-           < $< > $@-t && \
-           mv $@-t $@
+       $(AM_V_GEN)$(SED) $(LIBVIRTD_UNIT_VARS) $< > $@-t && mv $@-t $@
+
+libvirt%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
+       $(AM_V_GEN)$(SED) $(LIBVIRTD_UNIT_VARS) $< > $@-t && mv $@-t $@
 
 virt-guest-shutdown.target: remote/virt-guest-shutdown.target.in \
                        $(top_builddir)/config.status