diff --git a/share/machdeps/make_machdep/make_machdep.py b/share/machdeps/make_machdep/make_machdep.py
index 810acc91eb8719bcfd81dfe1c815176aef76cc9c..a5fbaa1eaea6968ae5676a05cb8240eda4173fb4 100755
--- a/share/machdeps/make_machdep/make_machdep.py
+++ b/share/machdeps/make_machdep/make_machdep.py
@@ -245,6 +245,7 @@ for (f, typ) in source_files:
     if args.verbose:
         print(f"[INFO] running command: {' '.join(cmd)}")
     proc = subprocess.run(cmd, capture_output=True)
+    Path(f).with_suffix(".o").unlink(missing_ok=True)
     if typ == "has__builtin_va_list":
         # Special case: compilation success determines presence or absence
         machdep["has__builtin_va_list"] = proc.returncode == 0