bugmake - Bugs: bug #21231, $(wildcard ) function sometimes...


bug #21231: $(wildcard ) function sometimes fails very strangely

Submitter:  Jun Chen <chjfth>
Submitted:  Wed 03 Oct 2007 01:51:25 AM UTC
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  3.81 Operating System:  Any
Fixed Release:  3.82 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup

Sat 13 Jun 2009 09:22:00 PM UTC, comment #3: 

Fixed.  Thanks for your report.

Paul D. Smith <psmith>
Group administrator
Tue 27 Nov 2007 01:47:43 AM UTC, comment #2: 

Thank you for your comment on Friday 11/23/07. As you said, putting out.txt in a subdir does not exhibit the problem -- that's right. However, I encountered that $(wildcard ) problem in my real-world makefiles when out.txt(other name may be used though) is put in a subdir within current dir. Since my real-world working makefiles(GnumakeUniproc) are quite complicated so that it is unsuitable to paste it here as an example, I tried to dig out the simplist case that show my problem(as my post here on Wednesday 10/03/07).

However, beside from using GnumakeUniproc, I find it's hard to forge an example that can demonstrate the $(wildcard ) problem when the file being tested by $(wildcar ) is in a subdir.

Anyhow, I think it should be a problem to fix.

(Attachment is a makefile that does show this problem, for memorial purpose.)

(file #14489)

Jun Chen <chjfth>
Fri 23 Nov 2007 03:59:54 PM UTC, comment #1: 

this appears to be normal behavior. wildcard reads from its own cache and the current dir is cached upon startup. -- put out.txt in a subdir and you will see the difference. The subdir is not cached until the wildcard is performed.

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

@echo nnn > $@

.PHONY: 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]] <<>>

then, run make again, the output is
[[out.txt]] <<out.txt>>

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

Jun Chen <chjfth>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #14489:  tt.mk added by chjfth (1KiB - text/plain)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by chjfth (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-28 psmith Fixed Release4.0 3.82
    2009-06-13 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.0
    2007-11-27 chjfth Attached File- Added tt.mk, #14489

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code