Bug#530855: make -j2 fails to rebuild intermediate file

2009-05-29 Thread Francois Gouget
On Fri, 29 May 2009, Yavor Doganov wrote: Francois Gouget wrote: But let's say we have something like this: %.o: %.c foo.h some command Now N.o would still depend on N.c and ultimately on N.y, but it would also depend on foo.h. And you're telling me that because of this

Bug#530855: make -j2 fails to rebuild intermediate file

2009-05-29 Thread Francois Gouget
Here is a simplified Makefile showing this bug: cat Makefile EOF %.bar: %.c foo.h cat $^ $@ || rm $@ foo.h: foo.h.in cat $^ $@ || rm $@ EOF cat main.y EOF %% command: q { return 1; } ; %% EOF echo bar foo.h.in # Again the initial build is

Bug#530855: make -j2 fails to rebuild intermediate file

2009-05-29 Thread Yavor Doganov
Francois Gouget wrote: Make in fact sees the first prerequisite of your rule, and knows how to rebuild it... What does this have to do with things being parallel or not? Nothing, indeed. It should have nothing to do with that; it seems that during the dependency check with -j2 make

Bug#530855: make -j2 fails to rebuild intermediate file

2009-05-28 Thread Francois Gouget
Package: make Version: 3.81-5 Severity: normal I stumbled on a problem with make -j2. Here is how to reproduce the problem: # First create some files: cat Makefile EOF ALL=foo bar and much more build-%/lib.so: build-%/rsrc.res build-%/main.o cat $^ $@ || rm $@ # .SECONDARY:

Bug#530855: make -j2 fails to rebuild intermediate file

2009-05-28 Thread Yavor Doganov
(Note: I'm not the Debian `make' package maintainer, just a random user.) On Thu, May 28, 2009 at 11:32:23AM +0200, Francois Gouget wrote: # - make forgot to rebuild the build-foo/rsrc.res intermediate file! No, make just (rightfully) considered it exists. Your snippet is a classic example

Bug#530855: make -j2 fails to rebuild intermediate file

2009-05-28 Thread Francois Gouget
On Thu, 28 May 2009, Yavor Doganov wrote: (Note: I'm not the Debian `make' package maintainer, just a random user.) On Thu, May 28, 2009 at 11:32:23AM +0200, Francois Gouget wrote: # - make forgot to rebuild the build-foo/rsrc.res intermediate file! No, make just (rightfully)

Bug#530855: make -j2 fails to rebuild intermediate file

2009-05-28 Thread Yavor Doganov
On Thu, May 28, 2009 at 05:04:30PM +0200, Francois Gouget wrote: build-%/rsrc.res: build-%/rsrc.rc build-%/main.o cat $ $@ || rm $@ I don't understand you here. Let me try to help you understand: The equivalent of your example if we don't take into account the complexity of pattern

Bug#530855: make -j2 fails to rebuild intermediate file

2009-05-28 Thread Francois Gouget
On Thu, 28 May 2009, Yavor Doganov wrote: [...] This works perfectly well with parallel make, because these are not pattern rules. You are assuming that make behaves exactly in the same logical way with pattern rules, which is not the case. Note that I already stated that lib.so

Bug#530855: make -j2 fails to rebuild intermediate file

2009-05-28 Thread Yavor Doganov
On Thu, May 28, 2009 at 06:10:01PM +0200, Francois Gouget wrote: On Thu, 28 May 2009, Yavor Doganov wrote: Yes, but you have not stated any order of these prerequisites [...] That's were you lost me. Sorry, my explanation was confusing. Make treats intermediate files differently and does

Bug#530855: make -j2 fails to rebuild intermediate file

2009-05-28 Thread Francois Gouget
On Thu, 28 May 2009, Yavor Doganov wrote: [...] Doesn't the above rule mean that before rebuilding lib.so we must have both build-%/rsrc.res and build-%/main.o? In general -- yes, but this is not guaranteed. Make simply decides it can go on without rsrc.res here: , (make)Chained

Bug#530855: make -j2 fails to rebuild intermediate file

2009-05-28 Thread Yavor Doganov
Francois Gouget wrote: But let's say we have something like this: %.o: %.c foo.h some command Now N.o would still depend on N.c and ultimately on N.y, but it would also depend on foo.h. And you're telling me that because of this extra dependency, make would be right to try to