bug-make
[Top][All Lists]
Advanced

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

Re: $(file) function bug or not?


From: David Boyce
Subject: Re: $(file) function bug or not?
Date: Tue, 28 Jan 2014 13:36:37 -0500

On Tue, Jan 28, 2014 at 1:20 PM, Paul Smith <address@hidden> wrote:
> I'm not sure I'd go that far.  $(shell ...) really _is_ useless in a
> recipe because make will invoke a shell to run the recipe anyway, so why
> have it invoke two shells?  It's just redundant.
>
> However, $(file ...) can be useful in a recipe especially on systems
> which have limited command line lengths (Windows for example)... in fact
> I'd say that this is one of the main reasons people wanted $(file ...).

I'll grant you your point about $(file ...); sorry for overstating.
But (and here we go completely away from the original topic, sorry
again) I think $(shell ...) in a recipe should be more firmly
deprecated than you do here. It's not just redundant, it creates an
order-of-evaluation error. See the third date in this example:

% cat Makefile
all:
        @echo The time is now $$(date)
        @echo The time is now $(shell date)
        sleep 4
        @echo The time is now $(shell date)
        @echo The time is now $$(date)

% make
The time is now Tue Jan 28 13:31:08 EST 2014
The time is now Tue Jan 28 13:31:08 EST 2014
sleep 4
The time is now Tue Jan 28 13:31:08 EST 2014
The time is now Tue Jan 28 13:31:12 EST 2014

David



reply via email to

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