On Mon, 2011-11-14 at 09:53 -0500, Marc Smith wrote:
> I must be missing something obvious... I'm using the shell function in
> my Makefile with a recursive variable, however, it seems the command
> in my shell function is only being evaluated once. I've tried this on
> two different Linux distributions and get the same result; from
> everything I read (even in the O'Reilly GNU Make book), this should
> not be working this way. See below for an example:
> 
> --snip--
> [marc.smith@catskill testing]$ cat Makefile
> blah = $(shell date)
> 
> all:
>         @ echo $(blah)
>         @ sleep 10
>         @ echo $(blah)
> --snip--

The behavior you're seeing is expected.

GNU make IS evaluating that function twice.  However, make expands all
the lines in a recipe before it invokes the first one.  It does not
expand them one at a time, just before it invokes them.

So even though make is running the "date" command twice, it's doing this
one right after the other so they have the same result.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psm...@gnu.org>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to