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 rules is this:
lib.so: rsrc.res main.o
cat $^ >$@ || rm $@
rsrc.res: rsrc.rc
cat $< >$@ || rm $@
rsrc.rc: rsrc.rc.in
mkdir -p `dirname $...@`
cat $< >$@ || rm $@
main.o: main.c
mkdir -p `dirname $...@`
cat $< >$@ || rm $@
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 depends on both rsrc.res and
> main.o with this rule:
>
> build-%/lib.so: build-%/rsrc.res build-%/main.o
> cat $^ >$@
Yes, but you have not stated any order of these prerequisites, so when
make is run in parallel, the first invocation satisfies them, but a
rebuild does not because there's the typical race condition.
> Maybe you meant that I should use:
>
> build-%/rsrc.res: build-%/rsrc.rc
> cat $< >$@
No, this won't work. If your rsrc.* generated files do not really
depend on main.c, but you want lib.so to take into account when your
"real" rsrc.rc.in changes you could implement another technique like a
sentinel or something.
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]