automake
[Top][All Lists]
Advanced

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

Re: using VPATH in depend2.am?


From: Harald Dunkel
Subject: Re: using VPATH in depend2.am?
Date: Sun, 20 Aug 2006 22:51:48 +0200
User-agent: Thunderbird 1.5.0.5 (X11/20060812)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Stepan,

Maybe you remember this story about correctly searching for
the files to compile looking at VPATH. I am using it for
quite some time without problems.

Do you think that this change could be included in a future
version of Automake?


Regards

Harri
===============================================================
Stepan Kasal wrote:
> Hello,
> 
> On Fri, Oct 21, 2005 at 10:58:44PM +0200, Harald Dunkel wrote:
>> Stepan Kasal wrote:
>>>     `IFS=:; x=':$(VPATH)'; \
>>>     for d in $$x; do \
>>>             test -n $$d && d=$$d/; \
>>>             test -f $${d}%SOURCE% && echo $$d && break;
>>>     done`%SOURCE%
>> I like this version.
> 
> well, I don't.  :-)
> 
> I made at least two mistakes:
> 1)  test -n $$d  -- this is not correct when $d is empty.
> 2)  x=':$(VPATH)' -- when VPATH is empty, the loop is run twice.
> 
>> But if you look at the original depend2.am
>> in am 1.9.6, there were some tics around %SOURCES%, [...]
> 
> yes, they are there, but not consistently.  There are things like
> 
>       `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
> 
> Unless we want to support whitespace or dollars in %SOURCE%, there is no
> benefit from these quotes.  It's better to omit them, the code is more
> readable then.  (The whole long line goes displayed by make.)
> 
> By the same reasoning, there is no benefit from the quotes around $(VPATH).
> 
> Suggested code for today:  ;-)
> 
>       `IFS=:; v=$(VPATH); \
>       for d in '' $$v; do \
>               test -n "$$d" && d=$$d/; \
>               test -f $${d}%SOURCE% && echo $$d && break; \
>       done`%SOURCE%
> 
> 
> It's tempting to have:
>       `IFS=:; v=$(VPATH); \
>       test -f %SOURCE% || \
>       for d in $$v; do test -f $${d}/%SOURCE% && echo $$d/ && break; \
>       done`%SOURCE%
> but it seems that
>       a=
>       for f in $a; do ... done
> is not interpreted correctly by some shells.  The Autoconf manual doesn't
> document it but Autoconf contains workaround for it.  I'll ask at the
> Autoconf list whether this is a myth or not.
> 
> Have a nice day,
>       Stepan
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE6MtkUTlbRTxpHjcRAkgJAJ94O1bFHhcKCZODD+rR5fNO2MoUMwCePNTI
UhH3ETcJU1/YL1Fpz/Gbx+c=
=9dpz
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]