2024-06-01 03:29:45 -05:00
|
|
|
use std::path::Path;
|
|
|
|
|
2024-07-17 08:31:38 -05:00
|
|
|
use run_make_support::{rfs, rustc};
|
2024-06-01 03:29:45 -05:00
|
|
|
|
|
|
|
fn emit_and_check(out_dir: &Path, out_file: &str, format: &str) {
|
|
|
|
let out_file = out_dir.join(out_file);
|
2024-07-03 04:34:39 -05:00
|
|
|
rustc().input("foo.rs").emit(format!("{format}={}", out_file.display())).run();
|
2024-06-01 03:29:45 -05:00
|
|
|
assert!(out_file.is_file());
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2024-06-06 14:34:34 -05:00
|
|
|
let out_dir = Path::new("emit");
|
2024-06-01 03:29:45 -05:00
|
|
|
|
2024-07-17 07:42:06 -05:00
|
|
|
rfs::create_dir(&out_dir);
|
2024-06-01 03:29:45 -05:00
|
|
|
|
|
|
|
emit_and_check(&out_dir, "libfoo.s", "asm");
|
|
|
|
emit_and_check(&out_dir, "libfoo.bc", "llvm-bc");
|
|
|
|
emit_and_check(&out_dir, "libfoo.ll", "llvm-ir");
|
|
|
|
emit_and_check(&out_dir, "libfoo.o", "obj");
|
|
|
|
emit_and_check(&out_dir, "libfoo.rmeta", "metadata");
|
|
|
|
emit_and_check(&out_dir, "libfoo.rlib", "link");
|
|
|
|
emit_and_check(&out_dir, "libfoo.d", "dep-info");
|
|
|
|
emit_and_check(&out_dir, "libfoo.mir", "mir");
|
|
|
|
}
|