[z88dk-dev] z80asm: cannot specify name of generated object file

Bridge to the z88dk-developers mailing list
Post Reply
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

[z88dk-dev] z80asm: cannot specify name of generated object file

Post by alvin »

When assembling to a single object file there is no way to control the output filename.

z80asm thing.asm
will always generate thing.o

I'd like to be able to do this:

z80asm thing.asm -o c:\temp\..\zcc0000.o

Line 39 of options_def.h hints that this was considered but never implemented:
OPT_VAR( char *, consol_obj_file, NULL) /* set by -o and no -b */

Because z80asm will search for includes from the .asm file's location, zcc needs to assemble .asm source files in their original source directories and we don't want to pollute the source directories with temporary files.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Line 39 of options_def.h hints that this was considered but never implemented:
OPT_VAR( char *, consol_obj_file, NULL) /* set by -o and no -b */
The line you refer was recently introduced to support the consolidated object file; the -o option for naming the binary is used to name the consolidated object, which is produced at the link phase by reading all the object files from the input assembly files.
As z80asm does process a list of asm files in one go, e.g. to link a binary or build a library, the object file has to be determined from the source name.
Another possibility is to distinguish between two cases: if there is only one source file use the output filename. If there are many source files, ignore the output filename. Except for the consolidated object, libraries and binaries which are intended to combine many files into one.
The problem you mention: could it be solved by passing an extra -I option to z80asm with the original source directory of the source?
For now, zcc is copying .asm files to the temp dir before assembling so the .o is created in the temp dir. The include path will not resolve properly if the .asm file was not originally sitting in the cwd but nobody's complained about this in the last decade at least :P

But yes that can be done. There is a second issue with this where we've already created the include path string that is properly sequenced in the order the user wants. So adding a new include path at the point of assembling won't necessarily honour that sequence without some other changes.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Post Reply