On Sat, Mar 21, 2009 at 12:49 AM, Harvey Chapman
<[email protected]> wrote:
> I think I may have found a bug in make 3.81. It seems that $(realpath path)
> does not work inside the commands for a target if path was created in a
> previous command for the same target. Ugh. The example will make it clearer.

Make performs its variable/function expansion pass for *all* the
commands of a rule before executing any of them.  The $(realpath)
function is expanded in the second command of the rule before the
first command is executed, so the file doesn't exist yet.  This can
also be seen in $(shell) expansions in rules.

Two solutions:
1) promote the individual commands to their own rules and express the
ordering via dependencies
2) avoid mixing non-trivial shell work with non-trivial make
expressions by pushing all the complexity
   to just one of the two (usually into the shell bits).


Philip Guenther


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

Reply via email to