mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +03:00
build: use library rather than cross-directory compilation
If we use subdir-objects with automake, any reference to a cross-directory .c file will result in automake creating rules that track dependency in the cross directory. But this presents a problem during 'make distclean' - if the cross directory is cleaned up first, then the daemon directory will be left with dangling references to .Po dependency files that no longer exist. Meanwhile, referring to the cross-directory .c file means that we are compiling the file twice - once in src, and once in daemon. Better is to compile just once in src into a convenience library, and then use that library from daemon. The tests directory had a similar situation of a cross-directory .c file; to solve that, we actually need a convenience library. * daemon/Makefile.am (DAEMON_SOURCES): Drop .c files... (libvirtd_LDADD): ...and instead use library. (libvirtd_conf_la_SOURCES): Declare a new convenience library. (libvirtd_LDFLAGS): Drop duplicate flag. * tests/Makefile.am (libvirtdconftest_SOURCES): Drop .c file... (libvirtdconftest_LDADD): ..and instead use library. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
073e157533
commit
012c25e88c
@ -37,14 +37,12 @@ DAEMON_GENERATED = \
|
||||
|
||||
DAEMON_SOURCES = \
|
||||
libvirtd.c libvirtd.h \
|
||||
libvirtd-config.c libvirtd-config.h \
|
||||
remote.c remote.h \
|
||||
stream.c stream.h \
|
||||
../src/remote/remote_protocol.c \
|
||||
../src/remote/lxc_protocol.c \
|
||||
../src/remote/qemu_protocol.c \
|
||||
$(DAEMON_GENERATED)
|
||||
|
||||
LIBVIRTD_CONF_SOURCES = libvirtd-config.c libvirtd-config.h
|
||||
|
||||
DISTCLEANFILES =
|
||||
EXTRA_DIST = \
|
||||
remote_dispatch.h \
|
||||
@ -67,7 +65,9 @@ EXTRA_DIST = \
|
||||
THREADS.txt \
|
||||
libvirtd.pod.in \
|
||||
libvirtd.8.in \
|
||||
$(DAEMON_SOURCES)
|
||||
$(DAEMON_SOURCES) \
|
||||
$(LIBVIRTD_CONF_SOURCES) \
|
||||
$(NULL)
|
||||
|
||||
BUILT_SOURCES =
|
||||
|
||||
@ -95,6 +95,22 @@ qemu_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
|
||||
|
||||
if WITH_LIBVIRTD
|
||||
|
||||
# Build a convenience library, for reuse in tests/libvirtdconftest
|
||||
noinst_LTLIBRARIES = libvirtd_conf.la
|
||||
libvirtd_conf_la_SOURCES = $(LIBVIRTD_CONF_SOURCES)
|
||||
libvirtd_conf_la_CFLAGS = \
|
||||
$(LIBXML_CFLAGS) \
|
||||
$(WARN_CFLAGS) $(PIE_CFLAGS) \
|
||||
$(COVERAGE_CFLAGS) \
|
||||
$(NULL)
|
||||
libvirtd_conf_la_LDFLAGS = \
|
||||
$(RELRO_LDFLAGS) \
|
||||
$(PIE_LDFLAGS) \
|
||||
$(COVERAGE_LDFLAGS) \
|
||||
$(NO_INDIRECT_LDFLAGS) \
|
||||
$(NULL)
|
||||
libvirtd_conf_la_LIBADD = $(LIBXML_LIBS)
|
||||
|
||||
man8_MANS = libvirtd.8
|
||||
|
||||
sbin_PROGRAMS = libvirtd
|
||||
@ -130,7 +146,6 @@ libvirtd_CFLAGS = \
|
||||
libvirtd_LDFLAGS = \
|
||||
$(RELRO_LDFLAGS) \
|
||||
$(PIE_LDFLAGS) \
|
||||
$(RELRO_LDFLAGS) \
|
||||
$(COVERAGE_LDFLAGS) \
|
||||
$(NO_INDIRECT_LDFLAGS) \
|
||||
$(NULL)
|
||||
@ -148,8 +163,11 @@ libvirtd_LDADD += ../src/libvirt_probes.lo
|
||||
endif WITH_DTRACE_PROBES
|
||||
|
||||
libvirtd_LDADD += \
|
||||
libvirtd_conf.la \
|
||||
../src/libvirt-lxc.la \
|
||||
../src/libvirt-qemu.la
|
||||
../src/libvirt-qemu.la \
|
||||
../src/libvirt_driver_remote.la \
|
||||
$(NULL)
|
||||
|
||||
if ! WITH_DRIVER_MODULES
|
||||
if WITH_QEMU
|
||||
|
@ -599,8 +599,8 @@ commandhelper_LDFLAGS = -static
|
||||
if WITH_LIBVIRTD
|
||||
libvirtdconftest_SOURCES = \
|
||||
libvirtdconftest.c testutils.h testutils.c \
|
||||
../daemon/libvirtd-config.c
|
||||
libvirtdconftest_LDADD = $(LDADDS)
|
||||
$(NULL)
|
||||
libvirtdconftest_LDADD = ../daemon/libvirtd_conf.la $(LDADDS)
|
||||
else ! WITH_LIBVIRTD
|
||||
EXTRA_DIST += libvirtdconftest.c
|
||||
endif ! WITH_LIBVIRTD
|
||||
|
Loading…
Reference in New Issue
Block a user