help-make
[Top][All Lists]
Advanced

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

Re: HELP! $(wildcard ) function failed very strangely


From: Paul Smith
Subject: Re: HELP! $(wildcard ) function failed very strangely
Date: Sun, 30 Sep 2007 11:25:30 -0400

On Sun, 2007-09-30 at 16:48 +0200, Kristof Provost wrote:
> On 2007-09-30 13:39:47 (+0000), Chen??????Jun?????? <address@hidden> wrote:
> > 
> > Further more, you said "The $(wildcard ) is evaluated when the rule is
> > parsed", while I find the gnu official manual does not say that. According
> > to "3.9 How make Reads a Makefile", expansion of the $(wildcard ) function,
> > like other functions, is deferred when the commands for the rule(prj_count) 
> > are
> > to be executed. 
> The commands are deferred, but the expansion of the variables is not.

No, that's not true at all.  No part of the recipe is expanded until the
rule is actually ready to be run by make.  The manual is quite clear
about this and, really, it has to be this way since otherwise variables
like $@, or even more obviously $^, can't be handled correctly.

I believe this is a real bug.  There are situations where
$(wildcard ...) won't return the same content as actually exists in the
directory, because make does directory caching as a speed improvement,
and the cache can become out of date with respect to the actual
directory if you have rules that are building files behind make's back.
But this example doesn't do that: the file that is created is a real
target and there's nothing tricky about it, so make should have added
that file to its cache after the rule was completed and the wildcard
function should have found it there.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.us
 "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]