summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2018-02-18 08:03:42 +0000
committerNiels Thykier <niels@thykier.net>2018-02-18 08:05:55 +0000
commitf8d7a6ead49e747430124bcea4b55ba05157d4b4 (patch)
treef8c736397e9dd221c994f9a982c30384311b60ec
parente6b3ba49d0e1504966eaeb58dca280ea3c8310bc (diff)
downloaddebhelper-f8d7a6ead49e747430124bcea4b55ba05157d4b4.tar.gz
makefile: Pass -O to make with -jX
Signed-off-by: Niels Thykier <niels@thykier.net>
-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}) {