(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 of a buggy makefile wrt parallel make: if you want your 
lib.so target to depend on *both* main.o and the generated (via chained 
rules) rsrc.res, you need to excplicitly state that, like this:

build-%/rsrc.res: build-%/rsrc.rc build-%/main.o
        cat $< >$@ || rm $@

This behavior is documented in several related notes in the Make manual
(I'm sorry I can't cite them right now, but by memory: Chained Rules, 
Pattern Intro, and most probably a few others).

(Don't use .SUFFIXES -- it's an old, deprecated way that will just make 
your makefiles harder to debug as it has different semantics.)

Also, if I may add, pattern rules are somewhat tricky, especially with 
-jN.  Do not blindly rely on the fact that make will process the 
prerequisites' rules sequentially before running the commands of that 
target.  Take a look of the short example I've posted some time ago:

  <http://permalink.gmane.org/gmane.linux.debian.devel.mentors/33162>

>  * Declare the rsrc.res intermediate file as .SECONDARY so that it's 
>  not necessary to rebuild it in the first place.

If it is really not necessary, then why you've put these rules and 
dependencies in the first place?



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to