Small dol split output adjustments

This commit is contained in:
Luke Street 2023-08-05 18:35:11 -04:00
parent 2ccb5f7b36
commit fefe4a36f0
1 changed files with 2 additions and 5 deletions

View File

@ -204,7 +204,7 @@ fn split(args: SplitArgs) -> Result<()> {
// Create out dirs // Create out dirs
let asm_dir = args.out_dir.join("asm"); let asm_dir = args.out_dir.join("asm");
let include_dir = args.out_dir.join("include"); let include_dir = args.out_dir.join("include");
let obj_dir = args.out_dir.clone(); let obj_dir = args.out_dir.join("obj");
DirBuilder::new().recursive(true).create(&include_dir)?; DirBuilder::new().recursive(true).create(&include_dir)?;
fs::write(include_dir.join("macros.inc"), include_str!("../../assets/macros.inc"))?; fs::write(include_dir.join("macros.inc"), include_str!("../../assets/macros.inc"))?;
@ -218,14 +218,12 @@ fn split(args: SplitArgs) -> Result<()> {
}; };
} }
let mut rsp_file = BufWriter::new(File::create(args.out_dir.join("rsp"))?); let mut units_file = BufWriter::new(File::create(args.out_dir.join("units.txt"))?);
let mut units_file = BufWriter::new(File::create(args.out_dir.join("units"))?);
for unit in &obj.link_order { for unit in &obj.link_order {
let object = file_map let object = file_map
.get(unit) .get(unit)
.ok_or_else(|| anyhow!("Failed to find object file for unit '{unit}'"))?; .ok_or_else(|| anyhow!("Failed to find object file for unit '{unit}'"))?;
let out_path = obj_dir.join(obj_path_for_unit(unit)); let out_path = obj_dir.join(obj_path_for_unit(unit));
writeln!(rsp_file, "{}", out_path.display())?;
writeln!(units_file, "{}:{}", out_path.display(), unit)?; writeln!(units_file, "{}:{}", out_path.display(), unit)?;
if let Some(parent) = out_path.parent() { if let Some(parent) = out_path.parent() {
DirBuilder::new().recursive(true).create(parent)?; DirBuilder::new().recursive(true).create(parent)?;
@ -235,7 +233,6 @@ fn split(args: SplitArgs) -> Result<()> {
file.write_all(object)?; file.write_all(object)?;
file.flush()?; file.flush()?;
} }
rsp_file.flush()?;
units_file.flush()?; units_file.flush()?;
// Generate ldscript.lcf // Generate ldscript.lcf