[Top][All Lists]

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

problem with $(wildcard ,,,)

From: Nic Ferrier
Subject: problem with $(wildcard ,,,)
Date: Thu, 26 Apr 2001 22:08:46 +0100

I think I've found a problem with version 3.79.1 of make. The problem
also exists with 3.78.1

The problem is that the $(wildcard) function doesn't always work. If
the file that is tested only exists as the result of an operation
performed by a pre-requisite it does not return the file.

Here's an example. First the Makefile:

#start of makefile
.PHONY: test

test: a.file
       echo $(wildcard somefile)

a.file: some.file
       echo wildcard-fn-test > somefile

#end of makefile

This creates the file "somefile" when a.file is out of date. But if
"somefile" does not exist before the "a.file" rule is executed the
$(wildcard) function returns nothing, indicating that "somefile" does
not exist.

That's obviously not correct.

If you create the test file, like so:

  echo test > some.file

and then run the above Makefile, you'll see this output:

  echo wildcard-fn-test > somefile

The final echo is coming from the command belonging to the "test"
rule. If the wildcard function worked correctly it should output:

  echo somefile

If you run the Makefile for a second time you will see that it now
works. This is because the file "somefile" definitely does exist now.

This is causing me a very real problem as I'm using a test of a file
created by a sub-rule to do a java compilation. Getting make to work
with java is difficult, and if the $(wildcard) function worked I would
have a practical solution.

Nic Ferrier

reply via email to

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