1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

build: avoid $(srcdir) in *_SOURCES

Trying to enable automake's subdir-objects option resulted in
the creation of literal directories such as src/$(srcdir)/remote/.
I traced this to the fact that we had used a literal $(srcdir)
in a location that later fed an automake *_SOURCES variable.
This has also been reported as an automake bug:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928
but it's better to fix our code than to wait for an automake fix.

Some things to remember that affect VPATH builds, and where an
in-tree build is blissfully unaware of the issues: if a VPATH
build fails to find a file that was used as a prereq of any
other target, then the rule for that file will expand $@ to
prefer the current build dir (bad because a VPATH build on a
fresh checkout will then stick $@ in the current directory
instead of the desired srcdir); conversely, if a VPATH build
finds the file in srcdir but decides it needs to be rebuilt,
then the rule for that file will expand $@ to include the
directory where it was found out-of-date (bad for an explicit
listing of $(srcdir)/$@ because an incremental VPATH build will
then expand srcdir twice).  As we want these files to go into
srcdir unconditionally, we have to massage or avoid $@ for any
recipe that involves one of these files.

Therefore, this patch removes all uses of $(srcdir) from any
generated file name that later feeds a *_SOURCES variable, and
then rewrites all the recipes to generate those files to
hard-code their creation into srcdir without the use of $@.

* src/Makefile.am (REMOTE_DRIVER_GENERATED): Drop $(srcdir); VPATH
builds know how to find the files, and automake subdir-objects
fails with it in place.
(LXC_MONITOR_PROTOCOL_GENERATED, (LXC_MONITOR_GENERATED)
(ACCESS_DRIVER_GENERATED, LOCK_PROTOCOL_GENERATED): Likewise.
(*_client_bodies.h): Hard-code rules to write into srcdir, as
VPATH tries to build $@ locally if missing.
(util/virkeymaps.h): Likewise.
(lxc/lxc_monitor_dispatch.h): Likewise.
(access/viraccessapi*): Likewise.
(locking/lock_daemon_dispatch_stubs.h): Likewise.
* daemon/Makeflie.am (DAEMON_GENERATED, remote_dispatch.h):
Likewise.

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

fixup DAEMON_GENERATED
This commit is contained in:
Eric Blake 2013-09-06 16:54:39 -06:00
parent 76fb8ccddf
commit 073e157533
2 changed files with 74 additions and 58 deletions

View File

@ -29,10 +29,10 @@ INCLUDES = \
CLEANFILES =
DAEMON_GENERATED = \
$(srcdir)/remote_dispatch.h \
$(srcdir)/lxc_dispatch.h \
$(srcdir)/qemu_dispatch.h \
DAEMON_GENERATED = \
remote_dispatch.h \
lxc_dispatch.h \
qemu_dispatch.h \
$(NULL)
DAEMON_SOURCES = \
@ -75,20 +75,23 @@ REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
LXC_PROTOCOL = $(top_srcdir)/src/remote/lxc_protocol.x
QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x
$(srcdir)/remote_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
remote_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
$(REMOTE_PROTOCOL)
$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
--mode=server remote REMOTE $(REMOTE_PROTOCOL) > $@
--mode=server remote REMOTE $(REMOTE_PROTOCOL) \
> $(srcdir)/remote_dispatch.h
$(srcdir)/lxc_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
lxc_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
$(LXC_PROTOCOL)
$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
--mode=server lxc LXC $(LXC_PROTOCOL) > $@
--mode=server lxc LXC $(LXC_PROTOCOL) \
> $(srcdir)/lxc_dispatch.h
$(srcdir)/qemu_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
qemu_dispatch.h: $(srcdir)/../src/rpc/gendispatch.pl \
$(QEMU_PROTOCOL)
$(AM_V_GEN)$(PERL) -w $(srcdir)/../src/rpc/gendispatch.pl \
--mode=server qemu QEMU $(QEMU_PROTOCOL) > $@
--mode=server qemu QEMU $(QEMU_PROTOCOL) \
> $(srcdir)/qemu_dispatch.h
if WITH_LIBVIRTD

View File

@ -154,12 +154,12 @@ UTIL_SOURCES = \
EXTRA_DIST += $(srcdir)/util/virkeymaps.h $(srcdir)/util/keymaps.csv \
$(srcdir)/util/virkeycode-mapgen.py
BUILT_SOURCES += $(srcdir)/util/virkeymaps.h
BUILT_SOURCES += util/virkeymaps.h
$(srcdir)/util/virkeymaps.h: $(srcdir)/util/keymaps.csv \
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/keymaps.csv >$(srcdir)/util/virkeymaps.h
EXTRA_DIST += util/virthreadpthread.c util/virthreadwin32.c
@ -185,8 +185,8 @@ LOCK_DRIVER_SANLOCK_HELPER_SOURCES = \
locking/sanlock_helper.c
LOCK_PROTOCOL_GENERATED = \
$(srcdir)/locking/lock_protocol.h \
$(srcdir)/locking/lock_protocol.c \
locking/lock_protocol.h \
locking/lock_protocol.c \
$(NULL)
LOCK_PROTOCOL = $(srcdir)/locking/lock_protocol.x
@ -216,11 +216,11 @@ LOCK_DAEMON_SOURCES = \
locking/lock_daemon_dispatch.h \
$(NULL)
$(srcdir)/locking/lock_daemon_dispatch_stubs.h: $(LOCK_PROTOCOL) \
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) > $@
$(LOCK_PROTOCOL) > $(srcdir)/locking/lock_daemon_dispatch_stubs.h
NETDEV_CONF_SOURCES = \
@ -302,35 +302,39 @@ CONF_SOURCES = \
# The remote RPC driver, covering domains, storage, networks, etc
REMOTE_DRIVER_GENERATED = \
$(srcdir)/remote/remote_protocol.c \
$(srcdir)/remote/remote_protocol.h \
$(srcdir)/remote/remote_client_bodies.h \
$(srcdir)/remote/lxc_protocol.c \
$(srcdir)/remote/lxc_protocol.h \
$(srcdir)/remote/lxc_client_bodies.h \
$(srcdir)/remote/qemu_protocol.c \
$(srcdir)/remote/qemu_protocol.h \
$(srcdir)/remote/qemu_client_bodies.h
remote/remote_protocol.c \
remote/remote_protocol.h \
remote/remote_client_bodies.h \
remote/lxc_protocol.c \
remote/lxc_protocol.h \
remote/lxc_client_bodies.h \
remote/qemu_protocol.c \
remote/qemu_protocol.h \
remote/qemu_client_bodies.h \
$(NULL)
REMOTE_PROTOCOL = $(srcdir)/remote/remote_protocol.x
LXC_PROTOCOL = $(srcdir)/remote/lxc_protocol.x
QEMU_PROTOCOL = $(srcdir)/remote/qemu_protocol.x
REMOTE_DRIVER_PROTOCOL = $(REMOTE_PROTOCOL) $(QEMU_PROTOCOL) $(LXC_PROTOCOL)
$(srcdir)/remote/remote_client_bodies.h: $(srcdir)/rpc/gendispatch.pl \
remote/remote_client_bodies.h: $(srcdir)/rpc/gendispatch.pl \
$(REMOTE_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=client \
remote REMOTE $(REMOTE_PROTOCOL) > $@
remote REMOTE $(REMOTE_PROTOCOL) \
> $(srcdir)/remote/remote_client_bodies.h
$(srcdir)/remote/lxc_client_bodies.h: $(srcdir)/rpc/gendispatch.pl \
remote/lxc_client_bodies.h: $(srcdir)/rpc/gendispatch.pl \
$(LXC_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=client \
lxc LXC $(LXC_PROTOCOL) > $@
lxc LXC $(LXC_PROTOCOL) \
> $(srcdir)/remote/lxc_client_bodies.h
$(srcdir)/remote/qemu_client_bodies.h: $(srcdir)/rpc/gendispatch.pl \
remote/qemu_client_bodies.h: $(srcdir)/rpc/gendispatch.pl \
$(QEMU_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=client \
qemu QEMU $(QEMU_PROTOCOL) > $@
qemu QEMU $(QEMU_PROTOCOL) \
> $(srcdir)/remote/qemu_client_bodies.h
REMOTE_DRIVER_SOURCES = \
gnutls_1_0_compat.h \
@ -534,16 +538,16 @@ XEN_DRIVER_SOURCES += xen/xen_inotify.c xen/xen_inotify.h
endif WITH_XEN_INOTIFY
LXC_MONITOR_PROTOCOL_GENERATED = \
$(srcdir)/lxc/lxc_monitor_protocol.h \
$(srcdir)/lxc/lxc_monitor_protocol.c \
lxc/lxc_monitor_protocol.h \
lxc/lxc_monitor_protocol.c \
$(NULL)
LXC_MONITOR_GENERATED = \
$(srcdir)/lxc/lxc_monitor_dispatch.h \
lxc/lxc_monitor_dispatch.h \
$(NULL)
LXC_CONTROLLER_GENERATED = \
$(srcdir)/lxc/lxc_controller_dispatch.h \
lxc/lxc_controller_dispatch.h \
$(NULL)
LXC_GENERATED = \
@ -554,15 +558,17 @@ LXC_GENERATED = \
LXC_MONITOR_PROTOCOL = $(srcdir)/lxc/lxc_monitor_protocol.x
$(srcdir)/lxc/lxc_monitor_dispatch.h: $(srcdir)/rpc/gendispatch.pl \
lxc/lxc_monitor_dispatch.h: $(srcdir)/rpc/gendispatch.pl \
$(LXC_MONITOR_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=client \
virLXCMonitor VIR_LXC_MONITOR $(LXC_MONITOR_PROTOCOL) > $@
virLXCMonitor VIR_LXC_MONITOR $(LXC_MONITOR_PROTOCOL) > \
$(srcdir)/lxc/lxc_monitor_dispatch.h
$(srcdir)/lxc/lxc_controller_dispatch.h: $(srcdir)/rpc/gendispatch.pl \
lxc/lxc_controller_dispatch.h: $(srcdir)/rpc/gendispatch.pl \
$(REMOTE_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=server \
virLXCMonitor VIR_LXC_MONITOR $(LXC_MONITOR_PROTOCOL) > $@
virLXCMonitor VIR_LXC_MONITOR $(LXC_MONITOR_PROTOCOL) > \
$(srcdir)/lxc/lxc_controller_dispatch.h
EXTRA_DIST += \
$(LXC_MONITOR_PROTOCOL) \
@ -824,12 +830,13 @@ SECURITY_DRIVER_APPARMOR_SOURCES = \
security/security_apparmor.h security/security_apparmor.c
ACCESS_DRIVER_GENERATED = \
$(srcdir)/access/viraccessapicheck.h \
$(srcdir)/access/viraccessapicheck.c \
$(srcdir)/access/viraccessapicheckqemu.h \
$(srcdir)/access/viraccessapicheckqemu.c \
$(srcdir)/access/viraccessapichecklxc.h \
$(srcdir)/access/viraccessapichecklxc.c
access/viraccessapicheck.h \
access/viraccessapicheck.c \
access/viraccessapicheckqemu.h \
access/viraccessapicheckqemu.c \
access/viraccessapichecklxc.h \
access/viraccessapichecklxc.c \
$(NULL)
ACCESS_DRIVER_SYM_FILES = \
libvirt_access.syms \
@ -1541,32 +1548,38 @@ libvirt_access_lxc.xml: $(srcdir)/rpc/gendispatch.pl \
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclapi \
lxc LXC $(LXC_PROTOCOL) > $@
$(srcdir)/access/viraccessapicheck.h: $(srcdir)/rpc/gendispatch.pl \
access/viraccessapicheck.h: $(srcdir)/rpc/gendispatch.pl \
$(REMOTE_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclheader \
remote REMOTE $(REMOTE_PROTOCOL) > $@
$(srcdir)/access/viraccessapicheck.c: $(srcdir)/rpc/gendispatch.pl \
remote REMOTE $(REMOTE_PROTOCOL) \
> $(srcdir)/access/viraccessapicheck.h
access/viraccessapicheck.c: $(srcdir)/rpc/gendispatch.pl \
$(REMOTE_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclbody \
remote REMOTE $(REMOTE_PROTOCOL) access/viraccessapicheck.h > $@
remote REMOTE $(REMOTE_PROTOCOL) access/viraccessapicheck.h \
> $(srcdir)/access/viraccessapicheck.c
$(srcdir)/access/viraccessapicheckqemu.h: $(srcdir)/rpc/gendispatch.pl \
access/viraccessapicheckqemu.h: $(srcdir)/rpc/gendispatch.pl \
$(QEMU_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclheader \
qemu QEMU $(QEMU_PROTOCOL) > $@
$(srcdir)/access/viraccessapicheckqemu.c: $(srcdir)/rpc/gendispatch.pl \
qemu QEMU $(QEMU_PROTOCOL) \
> $(srcdir)/access/viraccessapicheckqemu.h
access/viraccessapicheckqemu.c: $(srcdir)/rpc/gendispatch.pl \
$(QEMU_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclbody \
qemu QEMU $(QEMU_PROTOCOL) access/viraccessapicheckqemu.h > $@
qemu QEMU $(QEMU_PROTOCOL) access/viraccessapicheckqemu.h \
> $(srcdir)/access/viraccessapicheckqemu.c
$(srcdir)/access/viraccessapichecklxc.h: $(srcdir)/rpc/gendispatch.pl \
access/viraccessapichecklxc.h: $(srcdir)/rpc/gendispatch.pl \
$(LXC_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclheader \
lxc LXC $(LXC_PROTOCOL) > $@
$(srcdir)/access/viraccessapichecklxc.c: $(srcdir)/rpc/gendispatch.pl \
lxc LXC $(LXC_PROTOCOL) \
> $(srcdir)/access/viraccessapichecklxc.h
access/viraccessapichecklxc.c: $(srcdir)/rpc/gendispatch.pl \
$(LXC_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclbody \
lxc LXC $(LXC_PROTOCOL) access/viraccessapichecklxc.h > $@
lxc LXC $(LXC_PROTOCOL) access/viraccessapichecklxc.h \
> $(srcdir)/access/viraccessapichecklxc.c
# Add all conditional sources just in case...
EXTRA_DIST += \