Support parallel make check with GNU make 4.2+

Message ID yddfu0e2m9f.fsf@CeBiTec.Uni-Bielefeld.DE
State New, archived
Headers

Commit Message

Rainer Orth July 20, 2018, 11:13 a.m. UTC
  I noticed that make -jN check would run make check-single when using GNU
make 4.2.1.

In the end, it turned out that this is due to this change from the make
4.2 NEWS file:

* The amount of parallelism can be determined by querying MAKEFLAGS, even when
  the job server is enabled (previously MAKEFLAGS would always contain only
  "-j", with no number, when job server was enabled).

The fix is trivial: just accept an optional arg to -j in Makefile.in
(saw_dash_j).  Tested on i386-pc-solaris2.11 with just make and make
-j/-jN with both make 3.82 and 4.2.1.

Ok for master?

	Rainer
  

Comments

Andreas Schwab July 20, 2018, 11:33 a.m. UTC | #1
On Jul 20 2018, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote:

> diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
> --- a/gdb/testsuite/Makefile.in
> +++ b/gdb/testsuite/Makefile.in
> @@ -140,7 +140,7 @@ installcheck:
>  # See whether -j was given to make.  Either it was given with no
>  # arguments, and appears as "j" in the first word, or it was given an
>  # argument and appears as "-j" in a separate word.
> -saw_dash_j = $(or $(findstring j,$(firstword $(MAKEFLAGS))),$(filter -j,$(MAKEFLAGS)))
> +saw_dash_j = $(or $(findstring j,$(firstword $(MAKEFLAGS))),$(filter -j%,$(MAKEFLAGS)))

Please also update the comment.

Andreas.
  
Tom Tromey July 25, 2018, 7:07 p.m. UTC | #2
>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

Rainer> The fix is trivial: just accept an optional arg to -j in Makefile.in
Rainer> (saw_dash_j).  Tested on i386-pc-solaris2.11 with just make and make
Rainer> -j/-jN with both make 3.82 and 4.2.1.

Rainer> Ok for master?

Thanks for doing this, and nice work noticing it.
This is OK if you first fix the nit that Andreas pointed out.

Tom
  

Patch

# HG changeset patch
# Parent  c46bee26ae481e40fea09b4bbdb35731ff6b354c
Support parallel make check with GNU make 4.2+

diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -140,7 +140,7 @@  installcheck:
 # See whether -j was given to make.  Either it was given with no
 # arguments, and appears as "j" in the first word, or it was given an
 # argument and appears as "-j" in a separate word.
-saw_dash_j = $(or $(findstring j,$(firstword $(MAKEFLAGS))),$(filter -j,$(MAKEFLAGS)))
+saw_dash_j = $(or $(findstring j,$(firstword $(MAKEFLAGS))),$(filter -j%,$(MAKEFLAGS)))
 
 # Try to run the tests in parallel if any -j option is given.  If RUNTESTFLAGS
 # is not empty, then by default the tests will be serialized.  This can be