help-make
[Top][All Lists]
Advanced

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

HELP! $(wildcard ) function failed very strangely


From: Chen Jun (陈军)
Subject: HELP! $(wildcard ) function failed very strangely
Date: Sun, 30 Sep 2007 16:54:28 +0800

 

Hi, everyone,

    I encountered a strange situation recently, $(wildard ) function seems failing to work. See my code below:

========================================================
all: first_target
outfile = out.txt
$(outfile):
    @echo nnn > $@
.PHONY: prj_count
prj_count:
    @echo "[[$(outfile)]] <<$(wildcard $(outfile))>> "

.PHONY: first_target
first_target: $(outfile) prj_count
    @echo "[DONE]"
========================================================
First, delete out.txt and run make on that makefile, the output is
 
[[out.txt]] <<>>
[DONE]
  
then, run make again, the output is
 
[[out.txt]] <<out.txt>>
[DONE]
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 ?
 
I've tested it on make 3.80 & 3.81 on Linux, both produce the same result.
 
Thanks in advance.
 
                 Chen Jun (陈军)
                       address@hidden
                       2007-09-30

reply via email to

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