rdos/Makefile

76 lines
1.6 KiB
Makefile
Raw Normal View History

2019-09-16 12:26:48 +02:00
FLOPPY = 360
2019-10-27 19:59:42 +01:00
2019-10-28 11:49:42 +01:00
BDOS = 0xF000
BDOSIMG = bdos/8086.bin
2019-10-28 11:49:42 +01:00
BIOS = 0xF800
BIOSIMG = bios/8086.bin
2019-10-18 16:43:28 +02:00
PROGRAMS = $(patsubst %.asm,%.com,$(wildcard com/*.asm))
DISTFILES = $(PROGRAMS)
ROMS =
QEMU_ARCH = $(shell uname -m)
QEMU = qemu-system-$(QEMU_ARCH)
QEMU_ARGS = $(addprefix --option-rom ,$(ROMS))
NASM = nasm
NASM_ARGS = -s -Ilib -Plib/nasmcomp.asm -w-macro-params
2019-10-28 11:49:42 +01:00
NASM_ARGS += -DBDOS=$(BDOS) -DBIOS=$(BIOS)
EMUL = utils/emul
ifdef KVM
QEMU_ARGS += --enable-kvm
endif
ifdef DEBUG
ROMS += rom/debug.rom
NASM_ARGS += -l $(basename $@).lst
endif
ifndef DISPLAY
QEMU_ARGS += --display curses
endif
.PHONY: default clean qemu-rom qemu-floppy
default: fdimage.img
2019-10-18 16:43:28 +02:00
# Boot sectors
boot/%.bs: boot/%.asm
$(NASM) $(NASM_ARGS) -DFLOPPY=$(FLOPPY) -o $@ $<
2019-09-18 00:41:39 +02:00
2019-10-18 16:43:28 +02:00
# BIOS option roms
rom/%.rom: rom/%.asm
$(NASM) $(NASM_ARGS) -o $@ $< && utils/fix-rom.sh $@
2019-10-18 16:43:28 +02:00
# Regular COM programs
com/%.com: com/%.asm
$(NASM) $(NASM_ARGS) -o $@ $<
bdos/%.bin: bdos/%.asm lib/*.asm
$(NASM) $(NASM_ARGS) -o $@ -I bdos $<
bios/%.bin: bios/%.asm
$(NASM) $(NASM_ARGS) -o $@ $<
fdimage.img: boot/fat.bs $(BDOSIMG) $(BIOSIMG) $(DISTFILES)
mformat -R 9 -C -i $@ -f $(FLOPPY) -B boot/fat.bs ::
dd if=$(BDOSIMG) bs=512 seek=1 count=4 conv=notrunc of=$@
dd if=$(BIOSIMG) bs=512 seek=5 count=4 conv=notrunc of=$@
mcopy -i $@ $(DISTFILES) ::
2019-09-18 00:41:39 +02:00
hdimage.img: boot/mbr.bs fdimage.img
cat boot/mbr.bs fdimage.img >$@
clean:
find -name '*.lst' -delete
2019-10-18 16:43:28 +02:00
rm -f $$(cat .gitignore) boot/*.bs com/*.com rom/*.rom utils/emul
qemu-floppy: fdimage.img $(ROMS)
2019-10-19 14:47:23 +02:00
$(QEMU) $(QEMU_ARGS) -boot a -fda fdimage.img
2019-09-18 00:41:39 +02:00
qemu-hdd: hdimage.img $(ROMS)
2019-09-18 00:41:39 +02:00
$(QEMU) $(QEMU_ARGS) -boot c -hda hdimage.img