2021-12-14 18:44:39 +01:00
|
|
|
PRODUCT = rdos
|
2023-01-01 20:04:31 +01:00
|
|
|
VERSION = $(shell git log -1 --format=%cd --date=format:%Y%m%d)
|
2021-12-14 18:44:39 +01:00
|
|
|
|
2023-01-01 20:04:31 +01:00
|
|
|
PROGRAMS = hello.com sys.com
|
|
|
|
KERNEL = @$(PRODUCT).com
|
|
|
|
DISTFILES = $(KERNEL) $(PROGRAMS)
|
|
|
|
FLOPPY = 1440
|
2020-09-17 10:59:22 +02:00
|
|
|
|
2023-01-01 20:04:31 +01:00
|
|
|
# Programs used for building
|
|
|
|
AS = host/as
|
|
|
|
SYS = ./sys.elf
|
2021-02-03 01:27:44 +01:00
|
|
|
|
2023-01-01 20:04:31 +01:00
|
|
|
.PHONY: default clean qemu
|
2021-12-11 17:46:00 +01:00
|
|
|
.PRECIOUS: %.com
|
2020-03-01 17:43:23 +01:00
|
|
|
|
2023-01-01 20:04:31 +01:00
|
|
|
default: fd$(FLOPPY).img
|
2020-03-01 17:43:23 +01:00
|
|
|
|
|
|
|
# Host utils
|
2023-01-01 20:04:31 +01:00
|
|
|
%.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
|
2023-01-01 21:44:43 +01:00
|
|
|
$(AS) $@ $<
|
|
|
|
# $(NASM) $(NASM_ARGS) -Isrc -l $(@:.com=.lst) -o $@ $<
|
2020-03-01 17:43:23 +01:00
|
|
|
|
2023-01-01 20:04:31 +01:00
|
|
|
# Bootloader images
|
2020-03-30 14:13:21 +02:00
|
|
|
%.bs: boot/%.asm
|
2023-01-01 20:04:31 +01:00
|
|
|
$(AS) $@ $<
|
2020-04-06 21:20:15 +02:00
|
|
|
|
2021-02-03 01:27:44 +01:00
|
|
|
fd%.img: $(DISTFILES) $(SYS)
|
2021-12-12 12:50:32 +01:00
|
|
|
mformat -C -i $@ -f $* -v "$(PRODUCT) $(VERSION)" ::
|
2020-09-20 19:58:19 +02:00
|
|
|
mcopy -i $@ $(DISTFILES) ::
|
2021-02-18 20:38:56 +01:00
|
|
|
$(SYS) $@ $(KERNEL)
|
2020-04-21 20:22:32 +02:00
|
|
|
|
2019-03-24 19:30:49 +01:00
|
|
|
clean:
|
2023-01-01 22:41:22 +01:00
|
|
|
rm -f *.com *.bs *.0 *.lst *.img *.bin *.hex *.elf
|
2020-03-01 17:43:23 +01:00
|
|
|
|
2023-01-01 20:04:31 +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
|