diff --git a/src/librustc_back/target/asmjs_unknown_emscripten.rs b/src/librustc_back/target/asmjs_unknown_emscripten.rs index d86a9b09327..942e6238573 100644 --- a/src/librustc_back/target/asmjs_unknown_emscripten.rs +++ b/src/librustc_back/target/asmjs_unknown_emscripten.rs @@ -9,11 +9,12 @@ // except according to those terms. use super::{Target, TargetOptions}; +use super::emscripten_base::{cmd}; pub fn target() -> Result { let opts = TargetOptions { - linker: "emcc".to_string(), - ar: "emar".to_string(), + linker: cmd("emcc"), + ar: cmd("emar"), dynamic_linking: false, executables: true, diff --git a/src/librustc_back/target/emscripten_base.rs b/src/librustc_back/target/emscripten_base.rs new file mode 100644 index 00000000000..0c800271d04 --- /dev/null +++ b/src/librustc_back/target/emscripten_base.rs @@ -0,0 +1,19 @@ +// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(not(windows))] +pub fn cmd(name: &str) -> String { + name.to_string() +} + +#[cfg(windows)] +pub fn cmd(name: &str) -> String { + [name, ".bat"].concat() +} diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 13333be66f5..f7ccd065601 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -58,6 +58,7 @@ mod arm_base; mod bitrig_base; mod dragonfly_base; +mod emscripten_base; mod freebsd_base; mod haiku_base; mod linux_base; diff --git a/src/librustc_back/target/wasm32_unknown_emscripten.rs b/src/librustc_back/target/wasm32_unknown_emscripten.rs index 77ab4fcae70..9cfcd5d35b1 100644 --- a/src/librustc_back/target/wasm32_unknown_emscripten.rs +++ b/src/librustc_back/target/wasm32_unknown_emscripten.rs @@ -9,11 +9,12 @@ // except according to those terms. use super::{Target, TargetOptions}; +use super::emscripten_base::{cmd}; pub fn target() -> Result { let opts = TargetOptions { - linker: "emcc".to_string(), - ar: "emar".to_string(), + linker: cmd("emcc"), + ar: cmd("emar"), dynamic_linking: false, executables: true,