[Vm-dev] Make question

Bert Freudenberg bert at freudenbergs.de
Tue Sep 5 09:14:22 UTC 2006


Andreas Raab schrieb:
> 
> Hi Folks -
> 
> I'm trying to rework the windows build structure and I'm running into a 
> problem with make. Basically, what I'm trying to do is to test whether a 
> file exists in a given location and if so, copy it, and if not, copy a 
> default from elsewhere. This should look like here:
> 
> foo.here:
> if $(file-exists locationA/foo.locA)
>     cp locationA/foo.locA foo.here
> else
>     cp locationB/foo.locB foo.here
> endif
> 
> 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.

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

- Bert -


More information about the Vm-dev mailing list