]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: fix 'make dist' on virgin checkout
authorEric Blake <eblake@redhat.com>
Wed, 13 Jun 2012 03:49:22 +0000 (21:49 -0600)
committerCole Robinson <crobinso@redhat.com>
Fri, 15 Jun 2012 01:41:54 +0000 (21:41 -0400)
'make dist' was depending on *protocol-structs files, which are
stored in git but in turn depended on generated files.  We still
want to ship the protocol-structs files, but by renaming the
tests to something not matching a file name, we separate 'make
check' (which depends on the generated file) from 'make dist'
(which only depends on the git files).  After all, the tarball
should never depend on a generated file not stored in git.

I found one more case of a git file depending on a generated
file, in a bogus virkeycode.c listing; but at least this one
had no associated rules so it never broke 'make dist'.

Reported by Wen Congyang.  Latent bug has been present since
commit 62dee6f, but only recently exposed by commit 7bff56a.

* src/Makefile.am ($(srcdir)/util/virkeycode.c): Drop useless
dependency.
(BUILT_SOURCES): ...and build virkeymaps.h sooner.
(PROTOCOL_STRUCTS): Rather than depend on the struct file...
(check-local): ...convert things into a phony target of...
(check-protocol): ...a new check.
($(srcdir)/remote_protocol-struct): Rename to isolate the distributed
file from the conditional test.
(PDWTAGS): Deal with rename.  Swap to compare 'expected actual'.
(cherry picked from commit 9b5970c6c4ef267f2ba7d43d8b4d4996659c9fe1)

src/Makefile.am

index a2aae9d8278f87dead3db79905841b43268c7c3c..c3ee161f56a1a442cc2b0f2228872b30e3867bf1 100644 (file)
@@ -111,12 +111,12 @@ UTIL_SOURCES =                                                    \
 EXTRA_DIST += $(srcdir)/util/virkeymaps.h $(srcdir)/util/keymaps.csv \
                $(srcdir)/util/virkeycode-mapgen.py
 
+BUILT_SOURCES += $(srcdir)/util/virkeymaps.h
+
 $(srcdir)/util/virkeymaps.h: $(srcdir)/util/keymaps.csv        \
                $(srcdir)/util/virkeycode-mapgen.py
        $(AM_V_GEN)$(PYTHON) $(srcdir)/util/virkeycode-mapgen.py <$(srcdir)/util/keymaps.csv >$@
 
-$(srcdir)/util/virkeycode.c: $(srcdir)/util/virkeycode.h $(srcdir)/util/virkeymaps.h
-
 EXTRA_DIST += util/threads-pthread.c util/threads-win32.c
 
 # Internal generic driver infrastructure
@@ -289,7 +289,7 @@ PDWTAGS = \
                -e '}'                                                  \
                < $(@F)-t1 > $(@F)-t3;                                  \
            case $$? in 8) rm -f $(@F)-t?; exit 0;; 0) ;; *) exit 1;; esac;\
-           diff -u $(@F)-t3 $@; st=$$?; rm -f $(@F)-t?; exit $$st;     \
+           diff -u $(@)s $(@F)-t3; st=$$?; rm -f $(@F)-t?; exit $$st;  \
          fi;                                                           \
        else                                                            \
          echo 'WARNING: you lack pdwtags; skipping the $@ test' >&2;   \
@@ -302,21 +302,24 @@ PROTOCOL_STRUCTS = \
        $(srcdir)/virnetprotocol-structs \
        $(srcdir)/virkeepaliveprotocol-structs
 if WITH_REMOTE
+check-protocol: $(PROTOCOL_STRUCTS) $(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.
-$(srcdir)/%_protocol-structs: libvirt_driver_remote_la-%_protocol.lo
-       $(PDWTAGS)
-$(srcdir)/virnetprotocol-structs: libvirt_net_rpc_la-virnetprotocol.lo
+$(srcdir)/remote_protocol-struct $(srcdir)/qemu_protocol-struct: \
+               $(srcdir)/%-struct: libvirt_driver_remote_la-%.lo
        $(PDWTAGS)
-$(srcdir)/virkeepaliveprotocol-structs: libvirt_net_rpc_la-virkeepaliveprotocol.lo
+$(srcdir)/virnetprotocol-struct $(srcdir)/virkeepaliveprotocol-struct: \
+               $(srcdir)/%-struct: libvirt_net_rpc_la-%.lo
        $(PDWTAGS)
 else !WITH_REMOTE
-# These generated files must live in git, because they cannot be re-generated
-# when configured --without-remote.
-$(PROTOCOL_STRUCTS):
+# The $(PROTOCOL_STRUCTS) files must live in git, because they cannot be
+# re-generated when configured --without-remote.
+check-protocol:
 endif
 EXTRA_DIST += $(PROTOCOL_STRUCTS)
-check-local: $(PROTOCOL_STRUCTS)
+check-local: check-protocol
+.PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct)
 
 # Mock driver, covering domains, storage, networks, etc
 TEST_DRIVER_SOURCES =                                          \