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: Kristof Provost
Subject: Re: HELP! $(wildcard ) function failed very strangely
Date: Sun, 30 Sep 2007 12:01:20 +0200
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

On 2007-09-30 16:54:28 (+0800), Chen Jun (????) <address@hidden> wrote:
> Result of the first run is strange. When target prj_count is being made,
> out.txt should have been generated on my disk(because $(outfile) had been made
> before), then WHY $(wildcard out.txt) gives me null result ?
The $(wildcard ) is evaluated when the rule is parsed, not when it's
executed. At that point the out.txt file doesn't exist yet so it doesn't
match anything.

Try something like this:

MATCH = $(wildcard out.txt)
rule: out.txt
    echo $(MATCH)

out.txt:
    touch $@ 


Also note that it's a bad idea to rely on the order or your
prerequisites, as you seem to do in first_target. If make is executed
with -j it's possible the prj_count target will be executed before the
$(outfile) target. If prj_count requires $(outfile) to be built it
should be listed as a prerequisite.

Regards,
Kristof

Attachment: signature.asc
Description: Digital signature


reply via email to

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