help-make
[Top][All Lists]
Advanced

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

On-the-fly patsubst when setting VPATH?


From: medellre
Subject: On-the-fly patsubst when setting VPATH?
Date: Tue, 19 Jun 2001 16:39:49 +0000

Hello,

Is there any way to "trick" VPATH or the "vpath" 
directive into doing a bit of pattern substitution with 
the target it's trying to match?

Scenario as follows:

Have written some makefiles to hierarchically compile a 
java project. Have a requirement that all compiled files 
be redirected to an alternate location.

The following rule triggers compilation of the files

$(this)/java_classes: $($(this).javaClassFiles)

...where "this" holds the value of the current target 
needing to be made and the prereq is defined as:

$(this).javaClassFiles              :=  $(addsuffix 
.class,$(basename $($(this).javaFiles)))

The actual target needing to be made is what's giving me 
probs. I have a generic %.class:%.java rule. However, the 
target being looked for is always a "fully-qualified" 
path. Compiling on NT it looks like 
C:/Workspace/src/com/blah/blah/File.class. I cannot seem 
to get the 'vpath' directive however to pickup .class 
files in the alternate location 
Z:/RemoteInstall/release/com/blah/blah/File.class. If I 
strip the "path" from my rules and make the target simply 
File.class then a vpath directive of:

vpath %.class Z:/RemoteInstall/release 

WILL work. But I am doing some hierarchical things where 
the full-path matters and trying to get things to work in 
that manner would require a major overhaul.

So the question is, how can I "on-the-fly" change the 
target make is looking for 
from:

C:/Workspace/src/com/blah/blah/File.class

to just:

File.class 

...so that the 'vpath' directive will work? Or am I just 
not getting my pattern match correct? I've tried 
everything and it seems that if I keep the target as

C:/Workspace/src/com/blah/blah/File.class

 that vpath will want to subsitute that exact string into 
any pattern match I specify in vpath. I.e. I cannot just 
have:

vpath %.class Z:/RemoteInstall/release

because this will mean that for the target to be found by 
vpath that what the target should actually be is:

Z:/RemoteInstall/releaseC:/Workspace/src/com/blah/blah/Fi
le.class

which obviously doesn't exist. Everything I've tried does 
not seem to work and I either get all .java files 
compiled everytime or I get make to complain about not 
finding a rule for files of the type: 
Z:/RemoteInstal/release/com/blah/blah/File.java

What am I missing?

Rene R. Medellin
Systems Engineer
UBS Warburg



reply via email to

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