Wed 03 Oct 2007 01:51:25 AM UTC, original submission:
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 and on Windows(MSVC-built), both produce the same result.
Reference mailling list item: http://lists.gnu.org/archive/html/help-make/2007-09/msg00060.html
|