build: emit assembler messages as warnings

This commit is contained in:
anna 2023-05-28 19:22:25 +02:00
parent cb7eb4ec22
commit 343512ee2f
Signed by: fef
GPG key ID: 2585C2DC6D79B485

View file

@ -1,3 +1,4 @@
use std::path::PathBuf;
use std::{env, ffi::OsStr, io, io::Write, path::Path, process::Command}; use std::{env, ffi::OsStr, io, io::Write, path::Path, process::Command};
// We have to build stage 0 completely separately because it won't be part of // We have to build stage 0 completely separately because it won't be part of
@ -10,7 +11,7 @@ fn main() {
let stage0_srcs = ["src/boot/stage0.s"]; let stage0_srcs = ["src/boot/stage0.s"];
let stage0_objs = make.all(stage0_srcs); let stage0_objs = make.all(stage0_srcs);
make.link(Some("config/stage0.ld"), stage0_objs, "stage0.elf"); make.link(Some("config/stage0.ld"), stage0_objs, "stage0.elf");
make.objcopy("stage0.elf", "mbr.bin"); make.objcopy("stage0.elf", "stage0.bin");
make.end(); make.end();
} }
@ -187,9 +188,14 @@ impl Make {
eprintln!(" {cmd:?}"); eprintln!(" {cmd:?}");
let output = cmd.output().expect("failed to execute assembler"); let output = cmd.output().expect("failed to execute assembler");
self.stdout_raw(output.stdout.as_ref()); let stderr = String::from_utf8(output.stderr).unwrap();
for line in stderr.lines() {
if !line.is_empty() {
println!("cargo:warning={line}");
}
}
if !output.status.success() { if !output.status.success() {
self.stdout_raw(output.stderr.as_ref());
self.cmd_failed(&self.cmd_as, output.status.code()); self.cmd_failed(&self.cmd_as, output.status.code());
} }
} }