"Paul D. Smith" wrote:
> 
> If what you state is actually happening, I think it's a bug (that is, a
> target that is found with a vpath path of /a/b/c/foo.x but $* is only
> "foo").

OK, I looked into this problem because I, too, suspected it was MY
problem, not GNU make's.  But unfortunately (or fortunately!) I was able
to duplicate it reliably:

Make a makefile like this in /var/tmp/tree1:

  vpath % /var/tmp/tree2

  %.class : %.java
          @echo Star: $*
          @echo Caret: $^
          @echo At: $@

Then put (empty file; contents don't matter) Foo.java in
/var/tmp/tree1.  Run make Foo.class.  You should see (as you'd expect):

  Star: Foo
  Caret: Foo.java
  At: Foo.class

Now move /var/tmp/tree1/Foo.java to /var/tmp/tree2/Foo.java (i.e. move
the source file into the vpath).  Run make Foo.class.  You see:

  Star: Foo
  Caret: /var/tmp/tree2/Foo.java
  At: Foo.class

Oopsie; "Star" should be /var/tmp/tree2/Foo.java just like "Caret", yes?

The workaround seems to be to use $(filter) or $(filter-out) on $^
depending on what you want to do with $*.

GNU make 3.78.1 on Solaris 2.7.

Cheers,
Laird

Reply via email to