rustc: Append platform exe suffix to output files

Closes #15828
This commit is contained in:
Alex Crichton 2014-07-20 12:08:09 -07:00
parent df997e53af
commit 6ebbc6c4a3
2 changed files with 14 additions and 4 deletions

View File

@ -937,7 +937,16 @@ pub fn filename_for_input(sess: &Session,
config::CrateTypeStaticlib => {
out_filename.with_filename(format!("lib{}.a", libname))
}
config::CrateTypeExecutable => out_filename.clone(),
config::CrateTypeExecutable => {
match sess.targ_cfg.os {
abi::OsWin32 => out_filename.with_extension("exe"),
abi::OsMacos |
abi::OsLinux |
abi::OsAndroid |
abi::OsFreebsd |
abi::OsiOS => out_filename.clone(),
}
}
}
}

View File

@ -2,8 +2,9 @@
all:
[ `$(RUSTC) --print-crate-name crate.rs` = "foo" ]
[ `$(RUSTC) --print-file-name crate.rs` = "foo" ]
[ `$(RUSTC) --print-file-name --crate-type=lib --test crate.rs` = "foo" ]
[ `$(RUSTC) --print-file-name --test lib.rs` = "mylib" ]
[ `$(RUSTC) --print-file-name crate.rs` = "$(call BIN,foo)" ]
[ `$(RUSTC) --print-file-name --crate-type=lib \
--test crate.rs` = "$(call BIN,foo)" ]
[ `$(RUSTC) --print-file-name --test lib.rs` = "$(call BIN,mylib)" ]
$(RUSTC) --print-file-name lib.rs
$(RUSTC) --print-file-name rlib.rs