On 2007-09-30 16:54:28 (+0800), Chen Jun (????)
<chenjun mail.nlscan.com> 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
_______________________________________________
Help-make mailing list
Help-make gnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
|