[Top][All Lists]

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

Re: Missing Something Obvious

From: Paul Smith
Subject: Re: Missing Something Obvious
Date: Mon, 14 Nov 2011 10:17:06 -0500

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--
> address@hidden 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 <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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