makefile thoughts
Nicholas Clark
nick at ccl4.org
Mon Jan 4 16:04:48 UTC 2010
On Mon, Jan 04, 2010 at 09:55:50AM -0500, Andy Dougherty wrote:
> It's a race condition. It's present in trunk too. The problem is the
> makefile rule:
>
> $(INC_DIR)/oplib/ops.h lib/Parrot/OpLib/core.pm : [etc.]
> $(PERL) $(BUILD_TOOLS_DIR)/ops2pm.pl @no_lines_flag@ $(OPS_FILES)
>
> The single tool, ops2pm.pl, generates two files, ops.h and core.pm.
> However, make doesn't know that. It sees two separate targets and can
> consider running ops2pm.pl for each. Accordingly, ops2pm.pl can get
> run twice by a parallel make. Normally, that's not a problem unless
> both instances happen to be running at the same time. In that case,
> the output files can get messed up. That's what happened to me above.
Ah. Interesting. I wasn't aware of that. I had assumed that a rule of the
form
target1 target2: ...
action with parameters
meant that targets 1 and 2 were built together by 1 invocation of action,
not that action was capable of building either, and hence had to be run
twice
(and TFM isn't that easy to R, and my book on make was lost when boo.com went
bust, and was never replaced)
That would mean that this rule in perl 5 is wrong:
lib/Config_git.pl git_version.h: $(MINIPERL_EXE) make_patchnum.pl
$(MINIPERL) make_patchnum.pl
http://perl5.git.perl.org/perl.git/blob/HEAD:/Makefile.SH#l562
and likely several others.
Nicholas Clark
More information about the parrot-dev
mailing list