rdos/Makefile

62 lines
1.3 KiB
Makefile
Raw Normal View History

2019-09-16 12:26:48 +02:00
FLOPPY = 360
2019-03-31 15:22:24 +02:00
PROGRAMS = $(patsubst %.asm,%.com,$(wildcard programs/*.asm))
DISTFILES = rdos.sys rconfig.sys $(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
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
2019-09-24 00:05:01 +02:00
rdos.sys: kernel/*.asm lib/*.asm
$(NASM) $(NASM_ARGS) -o $@ -I kernel kernel/main.asm
2019-03-25 09:51:37 +01:00
rconfig.sys: config.txt
cp $< $@
2019-09-21 17:26:03 +02:00
debug.rom: debug/*.asm lib/*.asm
$(NASM) $(NASM_ARGS) -o $@ -I debug debug/main.asm && scripts/fix-rom.sh $@
2019-09-07 01:42:39 +02:00
boot/%.bs: boot/%.asm
$(NASM) $(NASM_ARGS) -DFLOPPY=$(FLOPPY) -o $@ $<
2019-09-18 00:41:39 +02:00
programs/%.com: programs/%.asm
$(NASM) $(NASM_ARGS) -o $@ $<
fdimage.img: boot/fat.bs $(DISTFILES)
2019-09-23 00:11:41 +02:00
mformat -C -i $@ -f $(FLOPPY) -B boot/fat.bs ::
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-09-21 20:18:20 +02:00
rm -f $$(cat .gitignore) programs/*.com boot/*.bs
qemu-floppy: fdimage.img $(ROMS)
$(QEMU) $(QEMU_ARGS) -boot c -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