bug-make
[Top][All Lists]
Advanced

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

more about wildcard function


From: Toomas Rosin
Subject: more about wildcard function
Date: Mon, 07 May 2001 09:06:43 +0200

Paul Smith wrote in this list (April 30, 2001):

    GNU Make uses a directory cache in order to speed up processing.
    Because of this cache, once the directory is read it will only be
    seen (from within make) to contain changes that make knows about

I think this should be mentioned in the manual.

I have another problem with the directory cache that could be an
oversight in Make.  As far as I have understood, Make executes rules
only after reading all the Makefiles, but leaves the cached
directories open.  Because of this, these two fragments (which need
not be in the same makefile):

    ifneq ($(wildcard foo/bar/baz),)
    # do something
    endif

    # /---/

    lose:
        umount foo

give, upon executing the "lose" rule, an error (in some cases (!)):

    umount: foo: device is busy

The only sure cure that I have found, apart from altogether giving up
using the wildcard function on files under `foo', is to create nine
throwaway directories outside the `foo' filesystem (say, /tmp/1, ...,
/tmp/9) and decorate the beginning of the main Makefile(s) with
something like this:

    ifneq ($(wildcard /tmp/1/:-),)
      ifneq ($(wildcard /tmp/2/:-),)
        ifneq ($(wildcard /tmp/3/:-),)
          ifneq ($(wildcard /tmp/4/:-),)
            ifneq ($(wildcard /tmp/5/:-),)
              ifneq ($(wildcard /tmp/6/:-),)
                ifneq ($(wildcard /tmp/7/:-),)
                  ifneq ($(wildcard /tmp/8/:-),)
                    ifneq ($(wildcard /tmp/9/:-),)
                    endif
                  endif
                endif
              endif
            endif
          endif
        endif
      endif
    endif

Luckily, the value MAX_OPEN_DIRECTORIES in dir.c is only 10, so I need
only 2*9 lines.

Peace,
Toomas.



reply via email to

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