From 0898753e095c6d9d8ecd8275dffb77f8e9a27f74 Mon Sep 17 00:00:00 2001 From: Zeal8bit Date: Mon, 13 Nov 2023 22:08:52 +0800 Subject: [PATCH] romdisk: modify Makefile to be compatible with more releases of z88dk-z80asm Some releases of z88dk-z80asm present a bug when using -O switch (output to directory). This commit fixes this issue by manually moving the generated files to the destination folder. --- romdisk/Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/romdisk/Makefile b/romdisk/Makefile index 2ea72e6..f17ba13 100644 --- a/romdisk/Makefile +++ b/romdisk/Makefile @@ -15,7 +15,11 @@ FILES_IN_IMG=$(BUILDIR)/$(BIN) simple.txt # If z88dk has been install through snap, the binary may be prefixed with "z88dk" # So choose any of z88dk-* or z88dk.z88dk-*, as long as one exists CC=$(shell which z88dk-z80asm z88dk.z88dk-z80asm | head -1) -ASMFLAGS=-I$(ZOS_PATH)/kernel_headers/z88dk-z80asm -O$(BUILDIR) -m -b + +# On some versions of z88dk, -Oxxx switch does not generate the init_TEXT.bin file, +# it only creates empty init.bin. Generate all the binaries in the current directory +# and move them manually +ASMFLAGS=-I$(ZOS_PATH)/kernel_headers/z88dk-z80asm -m -b .PHONY: all clean @@ -25,8 +29,10 @@ all: clean echo "Extra files detected: $(EXTRA_ROMDISK_FILES)" ) || \ echo "No extra file to pack into romdisk" @mkdir -p $(BUILDIR) - @echo "Creating romdisk..." + @echo "Creating romdisk" $(CC) $(ASMFLAGS) $(SRCS) + @echo "Moving generated files" + mv *.o ./$(BUILDIR) && mv *.map ./$(BUILDIR) && mv $(basename $(BIN))*.bin ./$(BUILDIR) @# For some reasons, z88dk-z80asm will create an empty `init.bin` file, remove it @rm -f $(BUILDIR)/$(BIN) && mv $(BUILDIR)/*_TEXT.bin $(BUILDIR)/$(BIN) @echo "Packing the files"