help-make
[Top][All Lists]
Advanced

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

Re: VPATH as a pattern variable


From: Martin DAnjou
Subject: Re: VPATH as a pattern variable
Date: Fri, 06 Apr 2007 11:33:00 -0400

>On Thu, 2007-04-05 at 13:12 -0400, Martin DAnjou wrote:
>> I do not understand why I get "no rule to make target" with this
>> makefile:
>
>> d_%.v: VPATH=src_dir
>
>VPATH settings in target-specific variables are not currently valid.  I
>believe there was an enhancement request about this at one point, but I
>couldn't find it in a quick search through the bug database.
>
>However, why not just use:
>
>       vpath d_%.v src_dir
>
>?  Doesn't this do the same thing?

Thanks Paul. Here is the complete solution for reference.
Now I cannot type "make all" anymore, I have to specify the target
"make comp_default" or "make comp_special" on the command line,
which in my case is not a big deal.

.SECONDEXPANSION:

comp_default_src=d_f.v
comp_special_src=d_f.v

comp_default_dir=src_dir1
comp_special_dir=src_dir2

vpath %.v $($(MAKECMDGOALS)_dir)

d_%.v: %.v
   touch $@
   echo Made $@

comp_%: $$(comp_$$*_src)
   echo Done

all: comp_default comp_special

I guess the real solution for GNUMake would be to have the concept
used in ANTLR: variables defined for a particular rule foo can be passed
"down" to rule(s) bar baz ...  invoked in order to complete the calling
rule foo. It is some sort of dynamic scoping if you will.

Thanks,
Martin




reply via email to

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