<p>So there seems to be this problem with GNU Make's $(wildcard) function keeping a directory open on Windows. See (unasnwered) post "<a href="http://www.cygwin.com/ml/cygwin/2003-06/msg01182.html" rel="nofollow noreferrer">make is holding a directory open</a>". Google does not provide much information on the topic.</p>

<p>In short: the Makefile uses the $(wildcard) function at some point, and keeps a directory open, which typically prevents the "make clean" rule to do its work correctly. Re-running "make clean" a second time usually solves it.</p>

<p>I'm using GNU Make version 3.81 under a standard DOS-Box. The author of the post linked to above is using Cygwin.</p>

<p>Has anyone found a fix for this?</p>

Sounds like a file descriptor leak, all right -- harmless for very-short-lived processes (like make) on UNIX, but a right PITA on Windows.
As this is allegedly a bug in make, as opposed to a problem with its usage, it should be addressed first by validating that it still exists when built from source on the newest upstream version, and then by
filing a bug report
with the GNU make project (or with any distributor with whom you have an appropriate support contract), or diving into the source and attempting to fix it yourself.
It wouldn't hurt to try to reproduce on Linux -- checking for file descriptor leaks are much easier here, as one can just look at
```
/proc/self/fd
```
(or, for a child of make,
```
/proc/$PPID/fd
```
) for things that don't belong.