Re: [PATCH 1/4] build: avoid $(srcdir) in *_SOURCES

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09.09.2013 17:51, Eric Blake wrote:
> 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@xxxxxxxxxx>
> 
> fixup DAEMON_GENERATED
> ---
>  daemon/Makefile.am |  23 ++++++-----
>  src/Makefile.am    | 109 ++++++++++++++++++++++++++++++-----------------------
>  2 files changed, 74 insertions(+), 58 deletions(-)
> 
> diff --git a/daemon/Makefile.am b/daemon/Makefile.am
> index 90689f8..e0b8744 100644
> --- a/daemon/Makefile.am
> +++ b/daemon/Makefile.am
> @@ -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

The other option is to have this line as:
  > $(srcdir)/$@

But this version is okay as is. ACK.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]