makefilegnu-makecircular-dependencyvpath

GNU make: Circular dependency when VPATH is specified


Does anybody can help me to understand why GNU make considers "circular dependency" in the following example. If the VPATH is not specified and the source file presents in the current directory everything is Ok.

$ cat Makefile
VPATH = src

src%.o: %.cpp
        @echo ECHO: $@: $<

lib%.o: %.cpp
        @echo ECHO: $@: $<

dll%.so: %.cpp
        @echo ECHO: $@: $<

lib%.so: lib%.o dll%.so
        @echo ECHO: $@: $<

A.exe: libA.so

%.exe: src%.o
        @echo ECHO: $@: $<

$ make
make: Circular dllA.so <- A.cpp dependency dropped.
ECHO: libA.o: src/A.cpp
ECHO: dllA.so:
ECHO: libA.so: libA.o
ECHO: srcA.o: src/A.cpp
ECHO: A.exe: srcA.o

Thank you, Alex


Solution

  • This looks like a known bug in GNUMake, fixed in version 3.82.