diff options
author | Aiden Gall <aiden@aidengall.xyz> | 2024-05-14 19:43:28 +0100 |
---|---|---|
committer | Aiden Gall <aiden@aidengall.xyz> | 2024-05-14 19:51:05 +0100 |
commit | 93585dc4da3be099e1ffe7e757aa7caff2e1f013 (patch) | |
tree | c1335acdd74cff12e545ce386ab2dbd176eaa473 /Makefile |
initial commit
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 36 |
1 files changed, 36 insertions, 0 deletions
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 |