make falling over builtin rules ?

2009-03-16 Thread Stefan Seefeld
I have run into a situation where GNU make complains about circular 
dependencies, where there are none:


---

all: src.cu.o


src.cu.o: %.cu.o: %.cu
@echo compiling...

---

will result in the message:

make: Circular src.cu - src.cu.o dependency dropped.
compiling...

When I replace '.cu' by '.cc', the warning / error message goes away.
It also goes away if I disable builtin rules (via -r).

Can you please confirm whether this is a GNU make bug, or user error ?

Thanks,
Stefan


--
Stefan Seefeld
CodeSourcery
ste...@codesourcery.com
(650) 331-3385 x718


___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


Re: make falling over builtin rules ?

2009-03-16 Thread Philip Guenther
On Mon, Mar 16, 2009 at 6:13 AM, Stefan Seefeld ste...@codesourcery.com wrote:
 I have run into a situation where GNU make complains about circular
 dependencies, where there are none:
...
 src.cu.o: %.cu.o: %.cu
       �...@echo compiling...

 will result in the message:

 make: Circular src.cu - src.cu.o dependency dropped.
 compiling...

 When I replace '.cu' by '.cc', the warning / error message goes away.
 It also goes away if I disable builtin rules (via -r).

 Can you please confirm whether this is a GNU make bug, or user error ?

User error.  Generating ${base}.o from ${base} (where base=src.cu in
this case) is a reverse of the normal logic that ${base} is the
executable generated from ${base}.o.  So make is correct: there is
circular dependency.

The correct thing to do is not use the .o suffix in a way that
conflicts with the precedents going back to Unix version 7.

For example, instead of using .cu.o and .cu, use .cuo and .cu.


Philip Guenther


___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make