Skip to content

Commit 424067c

Browse files
author
bors-servo
authored
Auto merge of #123 - Eijebong:makeflags, r=nox
Set MAKEFLAGS to CARGO_MAKEFLAGS for the make command <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/mozjs/123) <!-- Reviewable:end -->
2 parents 887845a + 5c90aa4 commit 424067c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

build.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,22 @@ fn main() {
3434
make = OsStr::new("mozmake").to_os_string();
3535
}
3636

37-
let result = Command::new(make)
38-
.args(&["-R", "-f", "makefile.cargo"])
37+
let mut cmd = Command::new(make);
38+
39+
// We're using the MSYS make which doesn't work with the mingw32-make-style
40+
// MAKEFLAGS, so remove that from the env if present.
41+
if cfg!(windows) {
42+
cmd.env_remove("MAKEFLAGS").env_remove("MFLAGS");
43+
} else if let Some(makeflags) = env::var_os("CARGO_MAKEFLAGS") {
44+
cmd.env("MAKEFLAGS", makeflags);
45+
}
46+
47+
let result = cmd.args(&["-R", "-f", "makefile.cargo"])
3948
.stdout(Stdio::inherit())
4049
.stderr(Stdio::inherit())
4150
.status()
4251
.expect("Failed to run `make`");
52+
4353
assert!(result.success());
4454
println!("cargo:rustc-link-search=native={}/js/src", out_dir);
4555
println!("cargo:rustc-link-lib=static=js_static"); // Must come before c++

makefile.cargo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ SRC_DIR = $(shell pwd)
126126
.PHONY : all maybe-configure
127127

128128
all: maybe-configure
129-
cd $(OUT_DIR) && $(MAKE) -f Makefile -j$(NUM_JOBS)
129+
cd $(OUT_DIR) && $(MAKE) -f Makefile
130130

131131
# Only touch and run configure if we need to, to avoid unnecessary rebuilds.
132132
# The second two time checks handle the case of configure.in and configure having

0 commit comments

Comments
 (0)