[Vm-dev] Make question

piumarta at speakeasy.net piumarta at speakeasy.net
Tue Sep 5 18:04:15 UTC 2006


> From: Andreas Raab [mailto:andreas.raab at gmx.de]
> 
> 	ifeq (source/foo/test, $(wildcard source/foo/test))
> 
> works fine, but neither do
> 
> 	ifeq (source/$*/test, $(wildcard source/foo/test))
> 	ifeq (source/foo/test, $(wildcard source/$*/test))
> 
> Something special about $* in ifeq?

The automatic variables ($@, $< $*, etc.) are only valid within the rule(s) of an implicit template.  Conditionals are not rules, so automatic variables are meaningless to (and are not defined within) them.

If you have to use automatic variables to construct the path to an optional file then I think I would suggest Dave's approach that puts the test into a shell command run from within the rule proper, where the $* makes sense and wil be correctly substituted.

(If you have a finite set of possible locations that you can enumerate, you might be able to make things easier by writing a script to do the job: 'copy_if_source_present_and_dest_missing sourceFile destFile' or somethine along those lines and then just run it for every possible candidate.)

Cheers,
Ian





More information about the Vm-dev mailing list