Skip to content

Commit

Permalink
build.rs: Fold more work into nasm().
Browse files Browse the repository at this point in the history
Prepare for removing the `compile()` function.
  • Loading branch information
briansmith committed Oct 5, 2023
1 parent 12176e1 commit 9da9702
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,8 @@ fn compile(b: &mut cc::Build, p: &Path, target: &Target, include_dir: &Path, out
if !matches!(p.extension(), Some(e) if e == "asm") {
let _ = b.file(p);
} else {
let out_file = obj_path(out_dir, p);
let cmd = nasm(p, &target.arch, include_dir, &out_file);
run_command(cmd);
let _ = b.object(out_file);
let obj = nasm(p, &target.arch, include_dir, out_dir);
let _ = b.object(obj);
}
}

Expand Down Expand Up @@ -618,7 +616,9 @@ fn configure_cc(c: &mut cc::Build, target: &Target, include_dir: &Path) {
}
}

fn nasm(file: &Path, arch: &str, include_dir: &Path, out_file: &Path) -> Command {
fn nasm(file: &Path, arch: &str, include_dir: &Path, out_dir: &Path) -> PathBuf {
let out_file = obj_path(out_dir, file);

let oformat = match arch {
"x86_64" => "win64",
"x86" => "win32",
Expand All @@ -644,7 +644,8 @@ fn nasm(file: &Path, arch: &str, include_dir: &Path, out_file: &Path) -> Command
.arg("-Xgnu")
.arg("-gcv8")
.arg(file);
c
run_command(c);
out_file
}

fn run_command_with_args<S>(command_name: S, args: &[String])
Expand Down

0 comments on commit 9da9702

Please sign in to comment.