summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpsmith <>2011-09-18 23:39:26 +0000
committerpsmith <>2011-09-18 23:39:26 +0000
commitca1d3ccd9ee4f5ae1f5e3baba786f4c0279136e3 (patch)
treeb4799a639501c94d65bd89d7af7a9113c1944e65
parentc59c21ae78b269d81f1a77d0ff4b03e7c2e57622 (diff)
downloadmake-ca1d3ccd9ee4f5ae1f5e3baba786f4c0279136e3.tar.gz
When we re-exec the master makefile in a jobserver environment, ensure
that MAKEFLAGS is set properly so the re-exec'd make runs in parallel. See Savannah bug #33873.
-rw-r--r--ChangeLog4
-rw-r--r--main.c8
-rw-r--r--tests/ChangeLog3
-rw-r--r--tests/scripts/features/parallelism17
4 files changed, 29 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e2a97869..adcab646 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2011-09-18 Paul Smith <psmith@gnu.org>
+ * main.c (main): If we're re-exec'ing and we're the master make,
+ then restore the job_slots value so it goes back into MAKEFLAGS
+ properly. See Savannah bug #33873.
+
* remake.c (library_search): STD_DIRS is computed when other
static vars like buflen etc. are computed, so it must be static
as well. See Savannah bug #32511.
diff --git a/main.c b/main.c
index 51764ddd..75eb4941 100644
--- a/main.c
+++ b/main.c
@@ -2089,6 +2089,11 @@ main (int argc, char **argv, char **envp)
++restarts;
+ /* If we're re-exec'ing the first make, put back the number of
+ job slots so define_makefiles() will get it right. */
+ if (master_job_slots)
+ job_slots = master_job_slots;
+
/* Reset makeflags in case they were changed. */
{
const char *pv = define_makeflags (1, 1);
@@ -2825,9 +2830,6 @@ define_makeflags (int all, int makefile)
&& (*(unsigned int *) cs->value_ptr ==
*(unsigned int *) cs->noarg_value))
ADD_FLAG ("", 0); /* Optional value omitted; see below. */
- else if (cs->c == 'j')
- /* Special case for `-j'. */
- ADD_FLAG ("1", 1);
else
{
char *buf = alloca (30);
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 4629b181..e2048ff4 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,8 @@
2011-09-18 Paul Smith <psmith@gnu.org>
+ * scripts/features/parallelism: On re-exec make sure we preserve
+ the value of MAKEFLAGS when necessary. See Savannah bug #33873.
+
* scripts/features/vpath3: Verify handling of -lfoo libraries
found via vpath vs. the standard directory search.
See Savannah bug #32511.
diff --git a/tests/scripts/features/parallelism b/tests/scripts/features/parallelism
index 22e4aebe..909c9794 100644
--- a/tests/scripts/features/parallelism
+++ b/tests/scripts/features/parallelism
@@ -167,6 +167,23 @@ inc.mk:
rmfiles('inc.mk');
+# TEST #11: Make sure -jN from MAKEFLAGS is processed even when we re-exec
+# See Savannah bug #33873
+
+$extraENV{MAKEFLAGS} = '-j4';
+
+run_make_test(q!
+things = thing1 thing2
+all: $(things)
+$(things):; @echo '$@ start'; sleep 1; echo '$@ end'
+-include inc.mk
+inc.mk: ; @touch $@
+!,
+ '', "thing1 start\nthing2 start\nthing1 end\nthing2 end\n");
+
+delete $extraENV{MAKEFLAGS};
+rmfiles('inc.mk');
+
if ($all_tests) {
# Implicit files aren't properly recreated during parallel builds
# Savannah bug #26864