rustc: add --print target-spec option
This option provides the user the ability to dump the configuration that is in use by rustc for the target they are building for. Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
This commit is contained in:
parent
8285ab5c99
commit
ff112644de
2 changed files with 9 additions and 0 deletions
|
|
@ -308,6 +308,7 @@ pub enum PrintRequest {
|
|||
TargetFeatures,
|
||||
RelocationModels,
|
||||
CodeModels,
|
||||
TargetSpec,
|
||||
}
|
||||
|
||||
pub enum Input {
|
||||
|
|
@ -1141,6 +1142,9 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
|
|||
let mut print_opts = vec!["crate-name", "file-names", "sysroot", "cfg",
|
||||
"target-list", "target-cpus", "target-features",
|
||||
"relocation-models", "code-models"];
|
||||
if nightly_options::is_nightly_build() {
|
||||
print_opts.push("target-spec-json");
|
||||
}
|
||||
|
||||
vec![
|
||||
opt::flag_s("h", "help", "Display this message"),
|
||||
|
|
@ -1471,6 +1475,8 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
|
|||
"target-features" => PrintRequest::TargetFeatures,
|
||||
"relocation-models" => PrintRequest::RelocationModels,
|
||||
"code-models" => PrintRequest::CodeModels,
|
||||
"target-spec-json" if nightly_options::is_unstable_enabled(matches)
|
||||
=> PrintRequest::TargetSpec,
|
||||
req => {
|
||||
early_error(error_format, &format!("unknown print request `{}`", req))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ use rustc_metadata::locator;
|
|||
use rustc_metadata::cstore::CStore;
|
||||
use rustc::util::common::time;
|
||||
|
||||
use serialize::json::ToJson;
|
||||
|
||||
use std::cmp::max;
|
||||
use std::cmp::Ordering::Equal;
|
||||
use std::default::Default;
|
||||
|
|
@ -584,6 +586,7 @@ impl RustcDefaultCalls {
|
|||
println!("{}", targets.join("\n"));
|
||||
},
|
||||
PrintRequest::Sysroot => println!("{}", sess.sysroot().display()),
|
||||
PrintRequest::TargetSpec => println!("{}", sess.target.target.to_json().pretty()),
|
||||
PrintRequest::FileNames |
|
||||
PrintRequest::CrateName => {
|
||||
let input = match input {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue