%% Laird Nelson <[EMAIL PROTECTED]> writes:
ln> OK, I looked into this problem because I, too, suspected it was MY
ln> problem, not GNU make's. But unfortunately (or fortunately!) I was able
ln> to duplicate it reliably:
ln> Make a makefile like this in /var/tmp/tree1:
ln> vpath % /var/tmp/tree2
ln> %.class : %.java
ln> @echo Star: $*
ln> @echo Caret: $^
ln> @echo At: $@
ln> Then put (empty file; contents don't matter) Foo.java in
ln> /var/tmp/tree1. Run make Foo.class. You should see (as you'd expect):
ln> Star: Foo
ln> Caret: Foo.java
ln> At: Foo.class
Yes.
ln> Now move /var/tmp/tree1/Foo.java to /var/tmp/tree2/Foo.java (i.e. move
ln> the source file into the vpath). Run make Foo.class. You see:
ln> Star: Foo
ln> Caret: /var/tmp/tree2/Foo.java
ln> At: Foo.class
ln> Oopsie; "Star" should be /var/tmp/tree2/Foo.java just like
ln> "Caret", yes?
No.
The $* is the stem if the _target_ name, not the _prerequisite_ name.
The $^ is the list of all prerequisites.
IOW, $* is the pattern portion of _$@_, not the pattern portion of $<.
Manual sez:
`$*'
The stem with which an implicit rule matches (*note How Patterns
Match: Pattern Match.). If the target is `dir/a.foo.b' and the
target pattern is `a.%.b' then the stem is `dir/foo'. The stem is
useful for constructing names of related files.
In a static pattern rule, the stem is part of the file name that
matched the `%' in the target pattern.
Note: the target, not the prerequisite.
This is why I was suspicious about misusing VPATH; there isn't really
any way that a rule could be run with a _target_ that was vpath
expanded, given the way it works now, so $* should never expand to a
vpath pathname. Well, I take that back; you could do it if you also
defined GPATH.
Phew! Dodged another bullet! :)
--
-------------------------------------------------------------------------------
Paul D. Smith <[EMAIL PROTECTED]> Network Management Development
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions---Nortel Networks takes no responsibility for them.