[libvirt] [PATCH] build: fix 'make -C src check' under subset builds

Eric Blake eblake at redhat.com
Fri Sep 27 13:32:24 UTC 2013


Another build failure detected on cygwin, where lxc is not built.
The lxc_monitor_protocol.c file requires the use of $(XDR_CFLAGS),
but should only be built on platforms where WITH_LXC is true;
however, 'make -C src check' was unconditionally trying to build
the .o file (and with the wrong CFLAGS) in order to validate the
matching -structs file.  Rework the checks to only test files that
are built for the current configuration.

* src/Makefile.am (PROTOCOL_STRUCTS): Split list by which files
are currently being compiled.
(EXTRA_DIST): Ensure that -structs files are shipped even when not
built.
(check-protocol): Declare unconditionally, now that the condition
has been moved into PROTOCOL_STRUCTS.
(libvirt_driver_lxc_impl_la_CFLAGS): Add $(XDR_CFLAGS).
(libvirt_net_rpc_la_SOURCES): List generated files more compactly.

Signed-off-by: Eric Blake <eblake at redhat.com>
---

This is a build-breaker, but I'm still in the middle of running
a (lengthy) 'make distcheck' on several platforms before pushing,
so a review wouldn't hurt.

 src/Makefile.am | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 09311b7..20ba1c8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -428,18 +428,35 @@ check-symsorting:
 EXTRA_DIST += check-symfile.pl check-symsorting.pl

 # Keep this list synced with RPC_PROBE_FILES
-PROTOCOL_STRUCTS = \
+PROTOCOL_STRUCTS =
+if WITH_REMOTE
+PROTOCOL_STRUCTS += \
 	$(srcdir)/remote_protocol-structs \
 	$(srcdir)/lxc_protocol-structs \
 	$(srcdir)/qemu_protocol-structs \
+	$(NULL)
+endif WITH_REMOTE
+PROTOCOL_STRUCTS += \
 	$(srcdir)/virnetprotocol-structs \
 	$(srcdir)/virkeepaliveprotocol-structs \
+	$(NULL)
+if WITH_LXC
+PROTOCOL_STRUCTS += \
 	$(srcdir)/lxc_monitor_protocol-structs \
+	$(NULL)
+endif WITH_LXC
+if WITH_LIBVIRTD
+PROTOCOL_STRUCTS += \
 	$(srcdir)/lock_protocol-structs \
 	$(NULL)
+endif WITH_LIBVIRTD
+
+# The various -structs files live in git, because they are only
+# conditionally generated; ship one -structs file for each .x file.
+EXTRA_DIST += $(notdir $(RPC_PROBE_FILES:.x=-structs)))

-if WITH_REMOTE
 check-protocol: $(PROTOCOL_STRUCTS) $(PROTOCOL_STRUCTS:structs=struct)
+.PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct)

 # The .o file that pdwtags parses is created as a side effect of running
 # libtool; but from make's perspective we depend on the .lo file.
@@ -458,13 +475,6 @@ $(srcdir)/lock_protocol-struct: \
 		$(srcdir)/%-struct: locking/lockd_la-%.lo
 	$(PDWTAGS)

-else !WITH_REMOTE
-# The $(PROTOCOL_STRUCTS) files must live in git, because they cannot be
-# re-generated when configured --without-remote.
-check-protocol:
-endif !WITH_REMOTE
-EXTRA_DIST += $(PROTOCOL_STRUCTS)
-
 check-drivername:
 	$(AM_V_GEN)$(PERL) $(srcdir)/check-drivername.pl \
 		$(srcdir)/driver.h \
@@ -538,7 +548,6 @@ EXTRA_DIST += check-driverimpls.pl check-aclrules.pl check-aclperms.pl
 check-local: check-protocol check-symfile check-symsorting \
 	check-drivername check-driverimpls check-aclrules \
 	check-aclperms
-.PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct)

 # Mock driver, covering domains, storage, networks, etc
 TEST_DRIVER_SOURCES =						\
@@ -1183,6 +1192,7 @@ endif ! WITH_DRIVER_MODULES

 libvirt_driver_lxc_impl_la_CFLAGS = \
 		$(LIBNL_CFLAGS) \
+		$(XDR_CFLAGS) \
 		$(FUSE_CFLAGS) \
 		-I$(top_srcdir)/src/access \
 		-I$(top_srcdir)/src/conf \
@@ -2203,10 +2213,9 @@ BUILT_SOURCES += $(VIR_NET_RPC_GENERATED)

 libvirt_net_rpc_la_SOURCES = \
 	rpc/virnetmessage.h rpc/virnetmessage.c \
-	rpc/virnetprotocol.h rpc/virnetprotocol.c \
 	rpc/virnetsocket.h rpc/virnetsocket.c \
-	rpc/virkeepaliveprotocol.h rpc/virkeepaliveprotocol.c \
-	rpc/virkeepalive.h rpc/virkeepalive.c
+	rpc/virkeepalive.h rpc/virkeepalive.c \
+	$(VIR_NET_RPC_GENERATED)
 if WITH_SSH2
 libvirt_net_rpc_la_SOURCES += \
 	rpc/virnetsshsession.h rpc/virnetsshsession.c
-- 
1.8.3.1




More information about the libvir-list mailing list