libvirt/src/locking/Makefile.inc.am
Daniel P. Berrangé e5df4edefa src: don't statically link code that's already in libvirt.so
Various binaries are statically linking to libvirt_util.la and
other intermediate libraries we build. These intermediate libs
all get built into the main libvirt.so shared library eventually,
so we can dynamically link to that instead and reduce the on disk
footprint.

In libvirt-daemon RPM:

            virtlockd: 1.6 MB -> 153 KB
             virtlogd: 1.6 MB -> 157 KB
     libvirt_iohelper: 937 KB -> 23 KB

In libvirt-daemon-driver-network RPM:

 libvirt_leaseshelper: 940 KB -> 26 KB

In libvirt-daemon-driver-storage-core RPM:

   libvirt_parthelper: 926 KB -> 21 KB

IOW, about 5.6 MB total space saving in a build done on Fedora 30
x86_64 architecture.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-05-17 14:34:45 +01:00

329 lines
8.1 KiB
Makefile

# vim: filetype=automake
DRIVER_SOURCES += \
locking/lock_manager.c \
locking/lock_manager.h \
locking/lock_driver.h \
locking/lock_driver_nop.h \
locking/lock_driver_nop.c \
locking/domain_lock.h \
locking/domain_lock.c \
$(NULL)
LOCK_DRIVER_SANLOCK_SOURCES = \
locking/lock_driver_sanlock.c
LOCK_DRIVER_SANLOCK_HELPER_SOURCES = \
locking/sanlock_helper.c
LOCK_PROTOCOL_GENERATED = \
locking/lock_protocol.h \
locking/lock_protocol.c \
$(NULL)
LOCK_DAEMON_GENERATED = \
locking/lock_daemon_dispatch_stubs.h
$(NULL)
LOCK_PROTOCOL = $(srcdir)/locking/lock_protocol.x
LOCK_DRIVER_LOCKD_SOURCES = \
locking/lock_driver_lockd.c \
locking/lock_driver_lockd.h \
$(NULL)
LOCK_DAEMON_SOURCES = \
locking/lock_daemon.h \
locking/lock_daemon.c \
locking/lock_daemon_config.h \
locking/lock_daemon_config.c \
locking/lock_daemon_dispatch.c \
locking/lock_daemon_dispatch.h \
$(NULL)
EXTRA_DIST += \
$(LOCK_PROTOCOL) \
$(LOCK_PROTOCOL_GENERATED) \
$(LOCK_DAEMON_GENERATED) \
$(LOCK_DAEMON_SOURCES) \
$(LOCK_DRIVER_LOCKD_SOURCES) \
locking/sanlock.conf \
locking/libvirt_sanlock.aug \
locking/test_libvirt_sanlock.aug.in \
locking/lockd.conf \
locking/libvirt_lockd.aug \
locking/test_libvirt_lockd.aug.in \
locking/virtlockd.aug \
locking/virtlockd.conf \
locking/test_virtlockd.aug.in \
$(NULL)
BUILT_SOURCES += \
$(LOCK_PROTOCOL_GENERATED) \
$(LOCK_DAEMON_GENERATED) \
$(NULL)
MAINTAINERCLEANFILES += \
$(LOCK_PROTOCOL_GENERATED) \
$(LOCK_DAEMON_GENERATED) \
$(NULL)
RPC_PROBE_FILES += $(srcdir)/locking/lock_protocol.x
SYSCONF_FILES += locking/virtlockd.sysconf
PODFILES += locking/virtlockd.pod
MANINFILES += virtlockd.8.in
CLEANFILES += test_virtlockd.aug $(man8_MANS)
MAINTAINERCLEANFILES += $(MANINFILES)
SYSTEMD_UNIT_FILES_IN += \
locking/virtlockd.service.in \
locking/virtlockd.socket.in \
locking/virtlockd-admin.socket.in \
$(NULL)
lockdriverdir = $(libdir)/libvirt/lock-driver
lockdriver_LTLIBRARIES =
if WITH_LIBVIRTD
lockdriver_LTLIBRARIES += lockd.la
lockd_la_SOURCES = \
$(LOCK_DRIVER_LOCKD_SOURCES) \
$(LOCK_PROTOCOL_GENERATED) \
$(NULL)
lockd_la_CFLAGS = \
-I$(srcdir)/conf \
$(XDR_CFLAGS) \
$(AM_CFLAGS) \
$(NULL)
lockd_la_LDFLAGS = $(AM_LDFLAGS_MOD_NOUNDEF)
lockd_la_LIBADD = \
libvirt.la \
../gnulib/lib/libgnu.la \
$(NULL)
augeas_DATA += locking/libvirt_lockd.aug
if WITH_DTRACE_PROBES
lockd_la_LIBADD += libvirt_probes.lo
endif WITH_DTRACE_PROBES
if WITH_SASL
lockd_la_CFLAGS += \
$(SASL_CFLAGS) \
$(NULL)
endif WITH_SASL
if WITH_QEMU
augeastest_DATA += test_libvirt_lockd.aug
CLEANFILES += test_libvirt_lockd.aug
nodist_conf_DATA += locking/qemu-lockd.conf
BUILT_SOURCES += locking/qemu-lockd.conf
DISTCLEANFILES += locking/qemu-lockd.conf
endif WITH_QEMU
if WITH_LIBXL
nodist_conf_DATA += locking/libxl-lockd.conf
BUILT_SOURCES += locking/libxl-lockd.conf
DISTCLEANFILES += locking/libxl-lockd.conf
endif WITH_LIBXL
sbin_PROGRAMS += virtlockd
virtlockd_SOURCES = \
$(LOCK_DAEMON_SOURCES) \
$(LOCK_PROTOCOL_GENERATED) \
$(LOCK_DAEMON_GENERATED) \
$(NULL)
virtlockd_CFLAGS = \
$(AM_CFLAGS) \
$(PIE_CFLAGS) \
$(XDR_CFLAGS) \
$(NULL)
virtlockd_LDFLAGS = \
$(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(NO_UNDEFINED_LDFLAGS) \
$(NULL)
virtlockd_LDADD = \
libvirt.la \
libvirt_driver_admin.la \
../gnulib/lib/libgnu.la \
$(CYGWIN_EXTRA_LIBADD) \
$(NULL)
if WITH_DTRACE_PROBES
virtlockd_LDADD += libvirt_probes.lo
endif WITH_DTRACE_PROBES
if WITH_SASL
virtlockd_CFLAGS += \
$(SASL_CFLAGS) \
$(NULL)
endif WITH_SASL
if WITH_SANLOCK
lockdriver_LTLIBRARIES += sanlock.la
sanlock_la_SOURCES = $(LOCK_DRIVER_SANLOCK_SOURCES)
sanlock_la_CFLAGS = -I$(srcdir)/conf $(AM_CFLAGS)
sanlock_la_LDFLAGS = $(AM_LDFLAGS_MOD_NOUNDEF)
sanlock_la_LIBADD = -lsanlock_client libvirt.la ../gnulib/lib/libgnu.la
augeas_DATA += locking/libvirt_sanlock.aug
if WITH_QEMU
augeastest_DATA += test_libvirt_sanlock.aug
CLEANFILES += test_libvirt_sanlock.aug
nodist_conf_DATA += locking/qemu-sanlock.conf
BUILT_SOURCES += locking/qemu-sanlock.conf
DISTCLEANFILES += locking/qemu-sanlock.conf
endif WITH_QEMU
if WITH_LIBXL
nodist_conf_DATA += locking/libxl-sanlock.conf
BUILT_SOURCES += locking/libxl-sanlock.conf
DISTCLEANFILES += locking/libxl-sanlock.conf
endif WITH_LIBXL
libexec_PROGRAMS += libvirt_sanlock_helper
libvirt_sanlock_helper_SOURCES = $(LOCK_DRIVER_SANLOCK_HELPER_SOURCES)
libvirt_sanlock_helper_CFLAGS = \
-I$(srcdir)/conf \
$(AM_CFLAGS) \
$(PIE_CFLAGS) \
$(NULL)
libvirt_sanlock_helper_LDFLAGS = \
$(AM_LDFLAGS) \
$(PIE_LDFLAGS) \
$(NULL)
libvirt_sanlock_helper_LDADD = libvirt.la
endif WITH_SANLOCK
man8_MANS += virtlockd.8
conf_DATA += locking/virtlockd.conf
augeas_DATA += locking/virtlockd.aug
augeastest_DATA += test_virtlockd.aug
INSTALL_DATA_DIRS += locking
install-data-locking:
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd"
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd/files"
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/run/libvirt/lockd"
if WITH_SANLOCK
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/sanlock"
endif WITH_SANLOCK
uninstall-data-locking:
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd/files" ||:
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd" ||:
rmdir "$(DESTDIR)$(localstatedir)/run/libvirt/lockd" ||:
if WITH_SANLOCK
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/sanlock" ||:
endif WITH_SANLOCK
if WITH_SANLOCK
if WITH_QEMU
test_libvirt_sanlock.aug: locking/test_libvirt_sanlock.aug.in \
locking/qemu-sanlock.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) locking/qemu-sanlock.conf $< $@
check-augeas-sanlock: test_libvirt_sanlock.aug
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
'$(AUGPARSE)' -I $(srcdir)/locking test_libvirt_sanlock.aug; \
fi
else ! WITH_QEMU
check-augeas-sanlock:
endif ! WITH_QEMU
else ! WITH_SANLOCK
check-augeas-sanlock:
endif ! WITH_SANLOCK
if WITH_QEMU
test_libvirt_lockd.aug: locking/test_libvirt_lockd.aug.in \
locking/qemu-lockd.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) locking/qemu-lockd.conf $< $@
else ! WITH_QEMU
test_libvirt_lockd.aug:
endif ! WITH_QEMU
test_virtlockd.aug: locking/test_virtlockd.aug.in \
locking/virtlockd.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/locking/virtlockd.conf $< $@
if WITH_QEMU
check-augeas-lockd: test_libvirt_lockd.aug
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
'$(AUGPARSE)' -I $(srcdir)/locking test_libvirt_lockd.aug; \
fi
else ! WITH_QEMU
check-augeas-lockd:
endif ! WITH_QEMU
check-augeas-virtlockd: test_virtlockd.aug
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
'$(AUGPARSE)' -I $(srcdir)/locking test_virtlockd.aug; \
fi
AUGEAS_DIRS += locking
check-augeas-locking: check-augeas-virtlockd check-augeas-lockd check-augeas-sanlock
endif WITH_LIBVIRTD
.PHONY: \
install-data-locking \
uninstall-data-locking \
check-augeas-locking \
check-augeas-virtlockd \
check-augeas-lockd \
check-augeas-sanlock \
$(NULL)
locking/%-lockd.conf: $(srcdir)/locking/lockd.conf
$(AM_V_GEN)$(MKDIR_P) locking ; \
cp $< $@
locking/%-sanlock.conf: $(srcdir)/locking/sanlock.conf
$(AM_V_GEN)$(MKDIR_P) locking ; \
cp $< $@
locking/lock_daemon_dispatch_stubs.h: $(LOCK_PROTOCOL) \
$(srcdir)/rpc/gendispatch.pl Makefile.am
$(AM_V_GEN)perl -w $(srcdir)/rpc/gendispatch.pl --mode=server \
virLockSpaceProtocol VIR_LOCK_SPACE_PROTOCOL \
$(LOCK_PROTOCOL) > $(srcdir)/locking/lock_daemon_dispatch_stubs.h
virtlockd.service: locking/virtlockd.service.in $(top_builddir)/config.status
$(AM_V_GEN)sed \
-e 's|[@]sbindir[@]|$(sbindir)|g' \
< $< > $@-t && \
mv $@-t $@
virtlockd.socket: locking/virtlockd.socket.in $(top_builddir)/config.status
$(AM_V_GEN)sed \
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
< $< > $@-t && \
mv $@-t $@
virtlockd-admin.socket: locking/virtlockd-admin.socket.in \
$(top_builddir)/config.status
$(AM_V_GEN)sed \
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
< $< > $@-t && \
mv $@-t $@
virtlockd.8.in: locking/virtlockd.pod
$(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \
if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \
sed \
-e 's|SYSCONFDIR|\@sysconfdir\@|g' \
-e 's|LOCALSTATEDIR|\@localstatedir\@|g' \
< $@-t1 > $@-t2 && \
rm -f $@-t1 && \
mv $@-t2 $@