[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: make -j2 strangely skipping dependencies
From: |
Chris Frey |
Subject: |
Re: make -j2 strangely skipping dependencies |
Date: |
Sat, 21 Jan 2012 08:49:05 -0500 |
User-agent: |
Mutt/1.4.2.2i |
Since the original commit in CVS (URL below) was meant to fix bug 3330,
I tried to fix it in another way.
http://cvs.savannah.gnu.org/viewvc/make/remake.c?root=make&r1=1.134&r2=1.135
There was a sample Makefile that triggered the bug, in that URL, posted
by Icarus Sparry. I used that as the basis for my testing.
The sample makefile triggered the bug by creating a rule that looked
like it updated lib, but didn't. This caused make -j2 to go into and
endless loop, waiting for the INTERMEDIARY binary.tmp prerequisites to finish.
Example makefile:
------------------------------------------------------------
binary: binary.tmp
@cp binary.tmp $@ ; echo Install $@
.INTERMEDIATE: binary.tmp
binary.tmp: lib
@touch $@ ; echo Link new binary in temp place
lib: obj
@if [ ! -e $@ ] ; then touch $@ ; fi ; echo $@ is manually up to date
obj:
@touch $@ ; echo Compile language file
------------------------------------------------------------
I believe that the patch below fixes 3330 properly... if check_dep() says
that no make is required, but the file (binary.tmp in this case) is still
marked as cs_deps_running, then it doesn't matter what the dependencies do,
it won't affect us even when they finish.
So this patch avoids stopping at the "prerequisites are being made" stage,
if no make is required. In the case of the example makefile, the 'lib'
file is never updated, and hence triggers the bug. But if never updated,
then it also shouldn't hold up the processing.
Below is the patch, intended to be applied in addition to my earlier one.
It seems to work for me so far. I hope other eyes can check it.
We may need a more sure way to determine if there is nothing pending,
multiple levels below. We may need a function here, which checks
all the deps below the one that 'running' cares about, and returns
whether they are cs_finished or not.
- Chris
diff --git a/remake.c b/remake.c
index 31cf831..76fa27b 100644
--- a/remake.c
+++ b/remake.c
@@ -650,7 +650,7 @@ update_file_1 (struct file *file, unsigned int depth)
DBF (DB_VERBOSE, _("Finished prerequisites of target file `%s'.\n"));
- if (running)
+ if (running && must_make)
{
set_command_state (file, cs_deps_running);
--depth;