Skip to content

Commit

Permalink
romdisk: modify Makefile to be compatible with more releases of z88dk…
Browse files Browse the repository at this point in the history
…-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.
  • Loading branch information
Zeal8bit committed Nov 13, 2023
1 parent 8860f1b commit 0898753
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions romdisk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit 0898753

Please sign in to comment.