[Top][All Lists]

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

RE: Evaluation of shell functions in recipes

From: Martin Dorey
Subject: RE: Evaluation of shell functions in recipes
Date: Mon, 15 Aug 2011 10:33:58 -0700

> if we just read the docs wrong, or if they *are* wrong.


I don't think this is clearly explained in the docs.  Suggest:


Index: doc/make.texi


RCS file: /sources/make/make/doc/make.texi,v

retrieving revision 1.72

diff -u -r1.72 make.texi

--- doc/make.texi 2 May 2011 15:11:23 -0000     1.72

+++ doc/make.texi 15 Aug 2011 17:32:27 -0000

@@ -3620,6 +3620,7 @@

 References}).  This occurs after make has finished reading all the

 makefiles and the target is determined to be out of date; so, the

 recipes for targets which are not rebuilt are never expanded.

+The whole recipe is expanded before the first line is executed.


 Variable and function references in recipes have identical syntax and

 semantics to references elsewhere in the makefile.  They also have the


-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Stefan Tauner
Sent: Sunday, August 14, 2011 12:43
To: address@hidden
Cc: Stefan Tauner; Carl-Daniel Hailfinger
Subject: Evaluation of shell functions in recipes




please keep our CC:s because we are not subscribed.

i have found a bug in our (flashrom.org) makefile which may be a bug in

make or its documentation.

attached is a small test case makefile.


the related documentation is





the problem is that the shell function runs before any other commands

(i.e. immediate).

the documentation of the shell function states:

"The commands run by calls to the shell function are run when the

function calls are expanded."

and from the "reading makefiles" section i would say that this should

be deferred i.e. the commands of the recipe should be evaluated

sequently. instead the shell functions are run first:

- 2 is written to the test file

- 4 is written to the test file (overwriting 2)

after that the normal execution starts.

this leads to the output (among other things) of "1 4 4 3 4".

the expected output is "1 <file not found> 2 3 4"


could someone please explain if the observed behavior is "right" and if

we just read the docs wrong, or if they *are* wrong.



Kind regards/Mit freundlichen Grüßen, Stefan Tauner

reply via email to

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