Skip to content

Commit a7d9025

Browse files
committed
let BSD to use gmake for GNU-make
the diff extends build_helper to provide an function to return the expected name of GNU-make on the host: "make" or "gmake". Fixes #38429
1 parent 9f8c1e2 commit a7d9025

File tree

7 files changed

+20
-4
lines changed

7 files changed

+20
-4
lines changed

src/Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/check.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
//! This file implements the various regression test suites that we execute on
1414
//! our CI.
1515
16+
extern crate build_helper;
17+
1618
use std::collections::HashSet;
1719
use std::env;
1820
use std::fmt;
@@ -543,7 +545,7 @@ pub fn distcheck(build: &Build) {
543545
build.run(&mut cmd);
544546
build.run(Command::new("./configure")
545547
.current_dir(&dir));
546-
build.run(Command::new("make")
548+
build.run(Command::new(build_helper::make(&build.config.build))
547549
.arg("check")
548550
.current_dir(&dir));
549551
}

src/build_helper/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ pub fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
6363
}
6464
}
6565

66+
pub fn make(host: &str) -> PathBuf {
67+
if host.contains("bitrig") || host.contains("dragonfly") ||
68+
host.contains("freebsd") || host.contains("netbsd") ||
69+
host.contains("openbsd") {
70+
PathBuf::from("gmake")
71+
} else {
72+
PathBuf::from("make")
73+
}
74+
}
75+
6676
pub fn output(cmd: &mut Command) -> String {
6777
let output = match cmd.stderr(Stdio::inherit()).output() {
6878
Ok(status) => status,

src/liballoc_jemalloc/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ fn main() {
151151
cmd.arg(format!("--build={}", build_helper::gnu_target(&host)));
152152

153153
run(&mut cmd);
154-
let mut make = Command::new("make");
154+
let mut make = Command::new(build_helper::make(&host));
155155
make.current_dir(&build_dir)
156156
.arg("build_lib_static");
157157

src/libstd/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn build_libbacktrace(host: &str, target: &str) {
104104
.env("AR", &ar)
105105
.env("RANLIB", format!("{} s", ar.display()))
106106
.env("CFLAGS", cflags));
107-
run(Command::new("make")
107+
run(Command::new(build_helper::make(host))
108108
.current_dir(&build_dir)
109109
.arg(format!("INCDIR={}", src_dir.display()))
110110
.arg("-j").arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set")));

src/tools/compiletest/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ build = "build.rs"
88
log = "0.3"
99
env_logger = { version = "0.3.5", default-features = false }
1010
serialize = { path = "../../libserialize" }
11+
build_helper = { path = "../../build_helper" }

src/tools/compiletest/src/runtest.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
extern crate build_helper;
12+
1113
use common::Config;
1214
use common::{CompileFail, ParseFail, Pretty, RunFail, RunPass, RunPassValgrind};
1315
use common::{Codegen, DebugInfoLldb, DebugInfoGdb, Rustdoc, CodegenUnits};
@@ -2108,7 +2110,7 @@ actual:\n\
21082110
}
21092111
self.create_dir_racy(&tmpdir);
21102112

2111-
let mut cmd = Command::new("make");
2113+
let mut cmd = Command::new(build_helper::make(&self.config.host));
21122114
cmd.current_dir(&self.testpaths.file)
21132115
.env("TARGET", &self.config.target)
21142116
.env("PYTHON", &self.config.docck_python)

0 commit comments

Comments
 (0)