Compiler defaults to .o when output name isn't specified

This commit is contained in:
Sasha Koshka 2024-03-28 18:16:58 -04:00
parent 15e418d8c1
commit 00110039e2
1 changed files with 9 additions and 5 deletions

View File

@ -34,6 +34,9 @@ func (this *Compiler) CompileUnit (address entity.Address) error {
// if the format isn't specified, try to get it from the filename
// extension of the input. if that isn't specified, default to .o
if this.Filetype == FiletypeUnknown {
if this.Output == "" {
this.Filetype = FiletypeObject
} else {
var ok bool
this.Filetype, ok = FiletypeFromExt (
*this.Target,
@ -42,6 +45,7 @@ func (this *Compiler) CompileUnit (address entity.Address) error {
this.Filetype = FiletypeObject
}
}
}
// if the output file is unspecified, generate a nickname from the
// input address. if that doesn't work, default to "output"