[Vm-dev] Make question

Andreas Raab andreas.raab at gmx.de
Tue Sep 5 09:21:35 UTC 2006


Bert Freudenberg wrote:
>> I think you get the idea. My problem is that I can't seem to find a 
>> reliable way of expressing the line
>>
>> if $(file-exists locationA/foo.locA)
>>
>> in any reasonable way (i.e., by using make's functions). Any ideas how 
>> to convince make to determine whether the file exists or not?
> 
> I think you have to use the $(wildcard ...) function to test for file 
> existence.

That's what I tried but I couldn't get it to work. It seems that no 
variation of

ifneq (,$(wildcard locationA/foo.locA))
	@echo foo.locA exists
else
	@echo foo.locA does NOT exist
endif

works properly due to the way the "failure" case needs to be specified 
(i.e., the result of the $wildcard function is not just "empty").

> Alternatively, you could specify a vpath 
> (http://www.gnu.org/software/make/manual/html_node/Directory-Search.html)

Tried that, too, but there is a real problm if foo.locA exists in 
multiple places (and it's hard to rule out that it exists *somewhere* in 
the search path). If it does, it will be picked up not only from 
locationA but possibly also from some other locations.

Cheers,
   - Andreas



More information about the Vm-dev mailing list