From 93585dc4da3be099e1ffe7e757aa7caff2e1f013 Mon Sep 17 00:00:00 2001 From: Aiden Gall Date: Tue, 14 May 2024 19:43:28 +0100 Subject: initial commit --- Makefile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0dbfe31 --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +.POSIX: +.PHONY: all clean run + +# QFLAGS = -machine type=pc,accel=kvm -cpu Broadwell-v3 + +CC = x86_64-elf-gcc +CFLAGS = -Wall -Wextra -std=c99 -pedantic -O2 -pipe \ + -ffreestanding -mno-red-zone -mno-mmx -mno-sse -mno-sse2 +LDFLAGS = -Wl,-O1 -T link.ld +LDLIBS = -lgcc -nostdlib + +CSRC = kernel/main.c +FSRC = boot/boot.asm kernel/util.asm +OBJ = ${CSRC:.c=.o} ${FSRC:.asm=.o} + +all: providence.img + +boot/boot.o: boot/bios.inc boot/page.inc boot/segdesc.inc +kernel/main.o: kernel/util.h + +providence.img: ${OBJ} + ${CC} ${LDFLAGS} $^ ${LDLIBS} -o $@ + @du -b $@ + truncate -s 29696 $@ + +%.o: %.c + ${CC} ${CFLAGS} -c -o $@ $< + +%.o: %.asm + fasm $< $@ + +clean: + rm -f ${OBJ} providence.img + +run: all + qemu-system-x86_64 ${QFLAGS} -drive file=providence.img,format=raw,index=0,media=disk -- cgit v1.2.3