libvirt/src/locking/Makefile.inc.am
Daniel P. Berrangé cfbe9f1201 build: link to glib library
Add the main glib.h to internal.h so that all common code can use it.

Historically glib allowed applications to register an alternative
memory allocator, so mixing g_malloc/g_free with malloc/free was not
safe.

This was feature was dropped in 2.46.0 with:

      commit 3be6ed60aa58095691bd697344765e715a327fc1
      Author: Alexander Larsson <alexl@redhat.com>
      Date:   Sat Jun 27 18:38:42 2015 +0200

        Deprecate and drop support for memory vtables

Applications are still encourged to match g_malloc/g_free, but it is no
longer a mandatory requirement for correctness, just stylistic. This is
explicitly clarified in

    commit 1f24b36607bf708f037396014b2cdbc08d67b275
    Author: Daniel P. Berrangé <berrange@redhat.com>
    Date:   Thu Sep 5 14:37:54 2019 +0100

        gmem: clarify that g_malloc always uses the system allocator

Applications can still use custom allocators in general, but they must
do this by linking to a library that replaces the core malloc/free
implemenentation entirely, instead of via a glib specific call.

This means that libvirt does not need to be concerned about use of
g_malloc/g_free causing an ABI change in the public libary, and can
avoid memory copying when talking to external libraries.

This patch probes for glib, which provides the foundation layer with
a collection of data structures, helper APIs, and platform portability
logic.

Later patches will introduce linkage to gobject which provides the
object type system, built on glib, and gio which providing objects
for various interesting tasks, most notably including DBus client
and server support and portable sockets APIs, but much more too.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-14 10:54:42 +01:00

287 lines
6.9 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 += $(man8_MANS)
MAINTAINERCLEANFILES += $(MANINFILES)
VIRTLOCKD_UNIT_FILES_IN = \
locking/virtlockd.service.in \
locking/virtlockd.socket.in \
locking/virtlockd-admin.socket.in \
$(NULL)
SYSTEMD_UNIT_FILES += $(notdir $(VIRTLOCKD_UNIT_FILES_IN:%.in=%))
SYSTEMD_UNIT_FILES_IN += $(VIRTLOCKD_UNIT_FILES_IN)
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 \
$(GLIB_LIBS) \
../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 += locking/test_libvirt_lockd.aug
nodist_conf_DATA += locking/qemu-lockd.conf
endif WITH_QEMU
if WITH_LIBXL
nodist_conf_DATA += 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 \
$(GLIB_LIBS) \
../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 \
$(GLIB_LIBS) \
../gnulib/lib/libgnu.la \
$(NULL)
augeas_DATA += locking/libvirt_sanlock.aug
if WITH_QEMU
augeastest_DATA += locking/test_libvirt_sanlock.aug
nodist_conf_DATA += locking/qemu-sanlock.conf
endif WITH_QEMU
if WITH_LIBXL
nodist_conf_DATA += 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 += locking/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)$(runstatedir)/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)$(runstatedir)/libvirt/lockd" ||:
if WITH_SANLOCK
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/sanlock" ||:
endif WITH_SANLOCK
if WITH_SANLOCK
if WITH_QEMU
locking/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 $< > $@
endif WITH_QEMU
endif WITH_SANLOCK
if WITH_QEMU
locking/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 $< > $@
endif WITH_QEMU
locking/test_virtlockd.aug: locking/test_virtlockd.aug.in \
locking/virtlockd.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/locking/virtlockd.conf $< > $@
endif WITH_LIBVIRTD
.PHONY: \
install-data-locking \
uninstall-data-locking \
$(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 $(COMMON_UNIT_VARS) $< > $@-t && mv $@-t $@
virtlockd.socket: locking/virtlockd.socket.in $(top_builddir)/config.status
$(AM_V_GEN)sed $(COMMON_UNIT_VARS) $< > $@-t && mv $@-t $@
virtlockd-admin.socket: locking/virtlockd-admin.socket.in \
$(top_builddir)/config.status
$(AM_V_GEN)sed $(COMMON_UNIT_VARS) $< > $@-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 $@