rdos/Makefile
Ain d1dab01633 Rename rdos.sys to rdos.bin
*.sys is meant for DOS-like driver binaries. I actually have a flat
binary with a specific load offset.
2019-09-29 21:26:59 +00:00

61 lines
1.3 KiB
Makefile

FLOPPY = 360
PROGRAMS = $(patsubst %.asm,%.com,$(wildcard programs/*.asm))
DISTFILES = rdos.bin $(PROGRAMS)
ROMS =
QEMU_ARCH = $(shell uname -m)
QEMU = qemu-system-$(QEMU_ARCH)
QEMU_ARGS = $(addprefix --option-rom ,$(ROMS))
NASM = nasm
NASM_ARGS = -s -I lib
EMUL = utils/emul
ifdef KVM
QEMU_ARGS += --enable-kvm
endif
ifdef DEBUG
ROMS += 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
rdos.bin: kernel/*.asm lib/*.asm
$(NASM) $(NASM_ARGS) -o $@ -I kernel kernel/main.asm
debug.rom: debug/*.asm lib/*.asm
$(NASM) $(NASM_ARGS) -o $@ -I debug debug/main.asm && utils/fix-rom.sh $@
boot/%.bs: boot/%.asm
$(NASM) $(NASM_ARGS) -DFLOPPY=$(FLOPPY) -o $@ $<
programs/%.com: programs/%.asm
$(NASM) $(NASM_ARGS) -o $@ $<
fdimage.img: boot/fat.bs $(DISTFILES)
mformat -C -i $@ -f $(FLOPPY) -B boot/fat.bs ::
mcopy -i $@ $(DISTFILES) ::
hdimage.img: boot/mbr.bs fdimage.img
cat boot/mbr.bs fdimage.img >$@
clean:
find -name '*.lst' -delete
rm -f $$(cat .gitignore) programs/*.com boot/*.bs utils/emul
qemu-floppy: fdimage.img $(ROMS)
$(QEMU) $(QEMU_ARGS) -boot c -fda fdimage.img
qemu-hdd: hdimage.img $(ROMS)
$(QEMU) $(QEMU_ARGS) -boot c -hda hdimage.img