strange "out of order" output using "info" command in a rule

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

strange "out of order" output using "info" command in a rule

Robert P. J. Day-2

  looking at someone else's Makefile, did a full build and saved all
the output for subsequent perusal thusly:

  $ make ... > /tmp/stuff 2>&1

  weirdly(?), there is a target which first runs a number of simple
linux commands (rm, mkdir, ...), then invokes "foreach" a couple
times to call some functions.

  i say "weirdly" because the output shows the "foreach" invocations
being run (they invoke their own "info" calls) *before* the linux
commands.

  is there some kind of buffering being done that would cause this?
it's entirely reproducible, and the make runs perfectly correctly, but
the saved output clearly(?) does not match the order of commands in
that particular rule.

  am i misunderstanding something simple?

rday

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: strange "out of order" output using "info" command in a rule

Paul Smith-20
On Sat, 2019-10-12 at 08:13 -0400, Robert P. J. Day wrote:
>   weirdly(?), there is a target which first runs a number of simple
> linux commands (rm, mkdir, ...), then invokes "foreach" a couple
> times to call some functions.
>
>   i say "weirdly" because the output shows the "foreach" invocations
> being run (they invoke their own "info" calls) *before* the linux
> commands.

When you say "foreach" I assume you are referring to GNU make $(foreach
...) functions?

That's expected.  GNU make will expand the entire recipe first,
including all lines of the recipe, before starting any shell commands.

There's an issue in Savannah about this.  It's a source of much
confusion and I wondered if it would break things to change it.  But so
far it's just idle curiosity.


_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: strange "out of order" output using "info" command in a rule

Robert P. J. Day-2
On Sat, 12 Oct 2019, Paul Smith wrote:

> On Sat, 2019-10-12 at 08:13 -0400, Robert P. J. Day wrote:
> >   weirdly(?), there is a target which first runs a number of simple
> > linux commands (rm, mkdir, ...), then invokes "foreach" a couple
> > times to call some functions.
> >
> >   i say "weirdly" because the output shows the "foreach" invocations
> > being run (they invoke their own "info" calls) *before* the linux
> > commands.
>
> When you say "foreach" I assume you are referring to GNU make
> $(foreach ...) functions?

  yessir.

> That's expected.  GNU make will expand the entire recipe first,
> including all lines of the recipe, before starting any shell
> commands.
>
> There's an issue in Savannah about this.  It's a source of much
> confusion and I wondered if it would break things to change it.
> But so far it's just idle curiosity.

  got it. i suspected it was something like that, just wanted to be
sure.

rday

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make