bug-make
[Top][All Lists]
Advanced

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

makefile include dependency bug/feature


From: Albert Ting
Subject: makefile include dependency bug/feature
Date: Thu, 6 Mar 2003 19:56:10 -0800

We've encountered an interesting dependency problem.  Not sure if this is a
bug or feature.  What we're trying to do is have a makefile include a sub
makefile, with the sub-makefile automatically created based on multiple
implicit rules.  Which implicit rule "make" uses is based on the files
that exist.

Below is such an example:

 $ /bin/rm -rf test
 $ mkdir -p test/dir1
 $ touch test/dir1/file1
 $ make
   Makefile:13: test/file3: No such file or directory
   make: *** No rule to make target `test/dir2/file2', needed by `foo'.  Stop.

It sounds like "make" gets confused when a file is being used for both an
implicit rule, include file, and target dependency.  It should recognize
the first implicit rule doesn't match, and reference the second implicit
rule.

However, if we change the BAR definition to hold the absolute path, we do get
the correct behavior.

Thanks,
Albert Ting

----------------------------------------------------------------------

all:
        @echo "DONE!"

SUBDIR:=test

BAR =$(SUBDIR:%=%/dir2/file2)
#BAR =$(SUBDIR:%=$(PWD)/%/dir2/file2)

foo: $(BAR)

include test/file3

%/file3 : %/dir2/file2 %/dir1/file1
        @echo "two file dependency"

%/file3 : %/dir1/file1
        @echo "one file dependency"




reply via email to

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