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: Paul Smith
Subject: Re: $(file) function bug or not?
Date: Tue, 28 Jan 2014 13:20:16 -0500

On Tue, 2014-01-28 at 09:52 -0800, David Boyce wrote:
> I think the headline here is that $(file) is analogous to $(shell) in
> that it's intended specifically for use _outside_ of recipes. If you
> find yourself using either one in a recipe it's probably a sign you're
> on the wrong track.

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 ...).

You can use it in a recipe to create an @-file, for example, for input
to a program where just using $^ directly would be far too large for the
command line.

But there's no real point in deleting the file first with "rm", since
the ">" operator will truncate it anyway.  I guess there might be _some_
small reason to try to delete it with "rm -rf" if you suspect it might
already exist as a directory.


Now that I think about it, I just did come up with a valid reason to use
$(shell ...) in a recipe!

  foo:
          $(shell rm -rf biz)
          $(file > biz, hello there)

:-p :-)




reply via email to

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