[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: possible realpath bug
From: |
Philip Guenther |
Subject: |
Re: possible realpath bug |
Date: |
Sat, 21 Mar 2009 01:30:45 -0700 |
On Sat, Mar 21, 2009 at 12:49 AM, Harvey Chapman
<address@hidden> 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