I am having a problem with a makefile which appears to be a bug with make. Unfortunately, I can't compile make from CVS because of problems with automake on Fedora Core 4. I have tried this with the 3.81beta2 release though.

I have attached the makefile in question. To run the test, first make setup. This will create a list of source files and a dependency in a subdirectory. Next make the level4 target. Make complain about circular dependencies on dep.x. I don't see how this dependency is circular. On make 3.80, if you define funny to be 1 (make -f foo.mk level4 funny=1) the problem goes away. Not so with 3.81beta2. Also, if you change the target for %.3 or %.4 to depend on depdir/dep.x rather than picking it up from the vpath then everything works.

Can anyone shed some light on this?

Thanks,

-Pete
files = a.1 b.1 c.1 d.1

setup:
        mkdir -p depdir
        touch $(files) depdir/dep.x

command = echo $^ > $@

%.2: %.1 dep.x
        $(command)

%.3: %.2 dep.x
        $(command)

%.4: %.3
        $(command)

level4: $(files:.1=.4)

ifeq ($(funny),1)
level3: $(files:.1=.3)
endif

clean:
        rm -f $(files:.1=.2) $(files:.1=.3) $(files:.1=.4)

.PHONY: level4

vpath %.x depdir
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to