[Vm-dev] Make question

Bert Freudenberg bert at freudenbergs.de
Tue Sep 5 18:54:03 UTC 2006


Andreas Raab schrieb:
> 
> piumarta at speakeasy.net wrote:
>>> 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.
> 
> Ouch. That stinks. But it sure as hell explains it.

Ah, it does indeed.

>> 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.
> 
> This is windows so shell commands are tricky (I'm not going to require 
> Cygwin etc) but I think I can solve this via recursive Makefile invokation.

Given your original problem ... how about this?

foo: dest/foo/test

dest/%/test: source/%/test
	@echo making $@ from $<

dest/%/test: default/%/test
	@echo making $@ from $<


This looks first for source/foo/test and then for default/foo/test.

- Bert -


More information about the Vm-dev mailing list