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) 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 $@
I don't understand you here. The above rule states that rsrc.res depends
on main.o which is not the case. Also, nowhere does it mention the
target lib.so file so I don't see how it's relevant to that file.
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 $^ >$@
And no, I'm not making any asumption on the order in which they will be
built since it does not matter, main.o and rsrc.res can be built totally
independently as can be seen from their respective build rules.
Maybe you meant that I should use:
build-%/rsrc.res: build-%/rsrc.rc
cat $< >$@
However I tried that before and it does not help.
> 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.
I am not making any such assumption.
> * 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?
I have added the .SECONDARY line after discovering make was misbehaving,
as a *workaround* for that bug. So I did not add them 'in the first
place' but rather 'as a last resort'.
--
Francois Gouget <[email protected]> http://fgouget.free.fr/
Hiroshima '45 - Czernobyl '86 - Windows '95
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]