Support conditional compilation based on architecture

target_os = "x86" or target_os = "x86_64"
This commit is contained in:
Brian Anderson 2011-11-15 16:33:07 -08:00
parent 47d875e002
commit dd5512ccb0
2 changed files with 12 additions and 1 deletions

View File

@ -28,9 +28,15 @@ fn default_configuration(sess: session::session, argv0: str, input: str) ->
let mk = attr::mk_name_value_item_str;
let arch = alt sess.get_targ_cfg().arch {
session::arch_x86. { "x86" }
session::arch_x86_64. { "x86_64" }
session::arch_arm. { "arm" }
};
ret [ // Target bindings.
mk("target_os", std::os::target_os()),
mk("target_arch", "x86"),
mk("target_arch", arch),
mk("target_libc", libc),
// Build bindings.
mk("build_compiler", argv0),

View File

@ -0,0 +1,5 @@
#[cfg(target_arch = "x86")]
fn main() { }
#[cfg(target_arch = "x86_64")]
fn main() { }