rdos/Makefile

43 lines
1022 B
Makefile
Raw Normal View History

PRODUCT = rdos
VERSION = $(shell git log -1 --format=%cd --date=format:%Y%m%d)
PROGRAMS = hello.com sys.com
KERNEL = @$(PRODUCT).com
DISTFILES = $(KERNEL) $(PROGRAMS)
FLOPPY = 1440
# Programs used for building
2020-03-01 17:43:23 +01:00
NASM = nasm
NASM_ARGS = -s --before "cpu 8086" -DPRODUCT=$(PRODUCT) -DVERSION=$(VERSION)
AS = host/as
SYS = ./sys.elf
.PHONY: default clean qemu
2021-12-11 17:46:00 +01:00
.PRECIOUS: %.com
2020-03-01 17:43:23 +01:00
default: fd$(FLOPPY).img
2020-03-01 17:43:23 +01:00
# Host utils
%.elf: host/%.c
2020-03-01 17:43:23 +01:00
$(CC) -o $@ $<
# COM programs
2021-12-11 17:46:00 +01:00
%.com: src/%.asm src/*.inc
$(AS) $@ $<
# $(NASM) $(NASM_ARGS) -Isrc -l $(@:.com=.lst) -o $@ $<
2020-03-01 17:43:23 +01:00
# Bootloader images
%.bs: boot/%.asm
$(AS) $@ $<
fd%.img: $(DISTFILES) $(SYS)
mformat -C -i $@ -f $* -v "$(PRODUCT) $(VERSION)" ::
mcopy -i $@ $(DISTFILES) ::
2021-02-18 20:38:56 +01:00
$(SYS) $@ $(KERNEL)
clean:
rm -f *.com *.bs *.0 *.lst *.img *.bin *.hex *.elf
2020-03-01 17:43:23 +01:00
qemu: fd$(FLOPPY).img
qemu-system-i386 $(shell test -w /dev/kvm && echo --enable-kvm) $(shell test -n "$DISPLAY" || echo --display curses) -boot a -drive file=fd$(FLOPPY).img,format=raw,index=0,if=floppy