The mtools set of commands have default settings in /etc/mtools.conf which can be overriden in ~/.mtoolsrc or by exporting the MTOOLSRC environment variable pointing to a configuration file:
Location of the configuration files
/etc/mtools.conf is the
system-wide configuration file, and ~/.mtoolsrc is the user's
private configuration file. If the environmental variable MTOOLSRC is set,
its contents is used as the filename for a third configuration file.
These configuration files describe the following items
You can thus just prepare an empty file and point the settings to it. No root access is needed (at least when trying on Debian 10's mtools version 4.0.23-1).
Size of image: 80*1*9*512=368640
Using dd:
dd if=/dev/zero of=/tmp/floppy.img bs=368640 count=1
(this would have worked too: dd if=/dev/zero of=/tmp/floppy.img seek=368639 count=1 bs=1)
$ file /tmp/floppy.img
/tmp/floppy.img: data
Override floppy A:'s location: create or edit the file ~/.mtoolsrc with this entry:
drive a: file="/tmp/floppy.img"
UPDATE: OP needs this to be usable in a Makefile. In this case exporting the MTOOLSRC variable to point to the relevant configuration file with above content (which could possibly also be created dynamically if there was the need) rather than using ~/.mtoolsrc is better suited.
Format:
$ mformat -t 80 -h 1 -n 9 a:
Check result:
$ file /tmp/floppy.img
/tmp/floppy.img: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "MTOO4023", sectors/cluster 2, root entries 112, sectors 720 (volumes <=32 MB), Media descriptor 0xf8, sectors/FAT 2, sectors/track 9, heads 1, serial number 0x6649c47, unlabeled, FAT (12 bit)
# mount -o loop /tmp/floppy.img /mnt
#