summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog3
-rw-r--r--debian/control3
-rw-r--r--lib/Debian/Debhelper/Buildsystem/makefile.pm10
3 files changed, 15 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index a99e0df0..c10ad44a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,9 @@ debhelper (11.1.5) UNRELEASED; urgency=medium
is needed or not. However, the warning remains for calling
dh_testroot outside the source root (as we may need to check
the compat level in a future version of debhelper).
+ * makefile.pm: Synchronize output from make (via -O) when
+ make runs in parallel. Thanks to Goswin von Brederlow for
+ the suggestion. (Closes: #768791)
-- Niels Thykier <niels@thykier.net> Sun, 04 Feb 2018 18:03:34 +0000
diff --git a/debian/control b/debian/control
index e8965596..4da13c0f 100644
--- a/debian/control
+++ b/debian/control
@@ -30,6 +30,9 @@ Depends: autotools-dev,
dpkg-dev (>= 1.19.0.5~),
file (>= 3.23),
libdpkg-perl (>= 1.17.14),
+# makefile.pm uses -O which according to #768791 requires make (>= 4~).
+# The -O is an aid to maintainers, debhelper works perfectly fine without it.
+ make (>= 4~),
man-db,
po-debconf,
${misc:Depends},
diff --git a/lib/Debian/Debhelper/Buildsystem/makefile.pm b/lib/Debian/Debhelper/Buildsystem/makefile.pm
index 241e8b2a..296110df 100644
--- a/lib/Debian/Debhelper/Buildsystem/makefile.pm
+++ b/lib/Debian/Debhelper/Buildsystem/makefile.pm
@@ -80,7 +80,15 @@ sub do_make {
clean_jobserver_makeflags();
# Note that this will override any -j settings in MAKEFLAGS.
- unshift @_, "-j" . ($this->get_parallel() > 0 ? $this->get_parallel() : "");
+ my $parallel = $this->get_parallel();
+ if ($parallel == 0 or $parallel > 1) {
+ # We have to use the empty string for "unlimited"
+ $parallel = '' if $parallel == 0;
+ # -O is for synchronizing the output.
+ unshift(@_, "-j${parallel}", '-O');
+ } else {
+ unshift(@_, '-j1');
+ }
my @root_cmd;
if (exists($this->{_run_make_as_root}) and $this->{_run_make_as_root}) {