about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-09-17 17:15:01 +0000
committerbors <bors@rust-lang.org>2017-09-17 17:15:01 +0000
commitcfcac37204c8dbdde192c1c9387cdbe663fe5ed5 (patch)
tree5cae2f394c461009aae2cab74dd115d67925ff23 /src
parent1cdd68922d143c6d1f18f66572251b7078e9e850 (diff)
parent4857bb7ffa7d83af4caff0a3571772c45fc8c76d (diff)
downloadrust-cfcac37204c8dbdde192c1c9387cdbe663fe5ed5.tar.gz
rust-cfcac37204c8dbdde192c1c9387cdbe663fe5ed5.zip
Auto merge of #44607 - alexcrichton:rustbuild-no-j, r=Mark-Simulacrum
rustbuild: Don't pass `-j` if called by `make`

In these situations Cargo just prints out a warning about ignoring the flag
anyway, so let `make` take care of jobs and whatnot instead of getting warnings
printed.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/builder.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 7ff0154bf8b..f9e07a70354 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -8,15 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::any::Any;
+use std::cell::RefCell;
+use std::collections::BTreeSet;
+use std::env;
 use std::fmt::Debug;
+use std::fs;
 use std::hash::Hash;
-use std::cell::RefCell;
+use std::ops::Deref;
 use std::path::{Path, PathBuf};
 use std::process::Command;
-use std::fs;
-use std::ops::Deref;
-use std::any::Any;
-use std::collections::BTreeSet;
 
 use compile;
 use install;
@@ -437,9 +438,14 @@ impl<'a> Builder<'a> {
         let out_dir = self.stage_out(compiler, mode);
         cargo.env("CARGO_TARGET_DIR", out_dir)
              .arg(cmd)
-             .arg("-j").arg(self.jobs().to_string())
              .arg("--target").arg(target);
 
+        // If we were invoked from `make` then that's already got a jobserver
+        // set up for us so no need to tell Cargo about jobs all over again.
+        if env::var_os("MAKEFLAGS").is_none() && env::var_os("MFLAGS").is_none() {
+             cargo.arg("-j").arg(self.jobs().to_string());
+        }
+
         // FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005
         // Force cargo to output binaries with disambiguating hashes in the name
         cargo.env("__CARGO_DEFAULT_LIB_METADATA", &self.config.channel);