automake
[Top][All Lists]
Advanced

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

Re: using VPATH in depend2.am?


From: Stepan Kasal
Subject: Re: using VPATH in depend2.am?
Date: Mon, 24 Oct 2005 15:24:50 +0200
User-agent: Mutt/1.4.1i

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




reply via email to

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