On 03/14/2014 12:55 PM, Jiri Denemark wrote:
On Fri, Mar 14, 2014 at 07:54:58 -0600, Eric Blake wrote:
> On 03/14/2014 04:43 AM, Jiri Denemark wrote:
>> Ancient automake (such as from RHEL5) does not provide abs_srcdir and
>> abs_builddir variables which are used by a recent commit of mine
>> (e562e82).
>>
>> Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
>> ---
>> +# old automake does not provide abs_{src,build}dir
variables
>> +abs_builddir = $(shell pwd)
>> +abs_srcdir = $(shell cd $(srcdir) && pwd)
Hmm, just noticed another thing - with NEWER automake, we are now less
efficient (calling out to $(shell) overwrites the value that is already
provided for free without a subprocess by newer automake). Does it work
if you use:
abs_builddir ?= $(shell pwd)
>
> Luckily we require GNU make, so this works. It would be nice, however,
> if src/Makefile.am and tests/Makefile.am shared the same formulas; right
> now, tests/Makefile.am uses the more portable (but slower):
>
> AM_CFLAGS = ...
> -Dabs_builddir="\"`pwd`\"" \
> -Dabs_srcdir="\"`cd '$(srcdir)'; pwd`\"" \
Which is unusable in this case, because we don't need to pass the
variables to the compiler. It's make itself that needs to consume the
variables:
$(abs_builddir)/cpu/cpu_map.xml:
$(AM_V_GEN)ln -s $(abs_srcdir)/cpu/cpu_map.xml $@
The $(abs_srcdir) could be inlined with ``, but you are right that the
use of $(abs_builddir) has to be expanded up front for make to track the
right file in its dependency. So ACK to this patch if the switch to ?=
instead of = works.
It still might be nice to update tests/Makefile.am in a followup to use
$(shell) instead of `` (since $(shell) is more efficient), but that's
not for this patch.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org