bug-make
[Top][All Lists]
Advanced

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

[bug #55137] $(file …) is executed too early when used in recipe


From: Paul D. Smith
Subject: [bug #55137] $(file …) is executed too early when used in recipe
Date: Mon, 13 May 2019 18:00:17 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0

Update of bug #55137 (project make):

                  Status:                    None => Not A Bug              
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

It's always been the case that the entire recipe, including all functions and
macros on all the recipe lines, is expanded before the first recipe line is
run.  The $(file ...) function is just a normal make function and obeys all
the same expansion rules as any other function or macro.  Changing that
behavior is of course possible but we'd have to think about it very carefully
to understand the backward-compatibility ramifications.

To do what you want you'll have to force the directory creation to happen
during expansion: you can do this by using the $(shell ...) function.  This is
just about the only time I can think of where it's not an anti-pattern to use
$(shell ...) in a recipe:


OUTPUT/something :
        $(shell mkdir -p $(@D))
        $(file >$@, $(@F))


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55137>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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