help-make
[Top][All Lists]
Advanced

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

-j 2 exposes problem with pattern rule


From: John Breitenbach
Subject: -j 2 exposes problem with pattern rule
Date: Thu, 20 Aug 2009 14:55:08 -0400
User-agent: Thunderbird 2.0.0.12 (X11/20080213)

Hi,
I'm hoping for an explanation for some strange behavior that I see when attempting a parallel build. Its not the classic race condition, but rather something wrong with my pattern rule. Hopefully this will
be an obvious problem with a nice solution.

My pattern rule reads like this:

lf/% af/% nf/% pf/%:
   do_stuff()

My intent is to invoke the same function for any make target with one of the 4 subdirs listed above. There are dependencies between them. e.g., lf/abc depends on af/abc and nf/aaa. af/abc depends on pf/ppp while nf/aaa depends on pf/p1... Thus there are opportunities for parallel.
But the "notdir" part of the targets DO repeat in af and lf.

This works fine with -j 1 builds - everything builds in order as needed. However, I run into a problem with -j 2. I think there is a problem when I have lf/abc dependent on af/abc using the pattern rule above. make builds af/abc in parallel with nf/aaa. af/abc finishes, and then nf/aaa finishes and make thinks its done! It never attempts to build lf/abc ... again only with multiple jobs.

Here's the last bit of make's -d output - after af/abc finishes.

Reaping winning child 0x09b975f8 PID 27863
Removing child 0x09b975f8 PID 27863 from chain.
Released token for child 0x09b975f8 (af/abc).
Live child 0x09b968e8 (nf/aaa) PID 22912
Considering target file `lf/abc'.
File `lf/abc' was considered already.
Live child 0x09b968e8 (nf/aaa) PID 22912


Thanks for reading.




reply via email to

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