X-Git-Url: http://git.dujemihanovic.xyz/posts?a=blobdiff_plain;f=Makefile;h=c895701d2b911f6517b90be5d4b4fd8cbea6cfcb;hb=3d58037b465f917b19b0f786c334ed70e1065857;hp=9d95b1ef97134bcebc837fe4ab4cfab1e6fff45a;hpb=73dce672626ceb415b49ff059092c48a2f7c3de3;p=nameless-os.git diff --git a/Makefile b/Makefile index 9d95b1e..c895701 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,31 @@ -AS = yasm # choose yasm or nasm here -ASFLAGS = -f bin # compile a raw binary +AS = yasm +LD = i686-elf-ld +CC = i686-elf-gcc -boot: boot.s print.s - $(AS) $(ASFLAGS) -o $@ boot.s +KERNEL_OBJ = kernel/entry.o kernel/arch/x86/tty/tty.o kernel/kernel.o -clean: - -rm boot +all: boot.img + +boot.img: boot kernel/kernel.bin + cat boot kernel/kernel.bin > $@ + truncate -s1440K $@ + +boot: boot.s + $(AS) -f bin boot.s -o $@ + +kernel/kernel.bin: ${KERNEL_OBJ} + $(LD) -o $@ -T kernel/linker.ld ${KERNEL_OBJ} --oformat=binary -run: - qemu-system-i386 boot +kernel/entry.o: kernel/entry.s + $(AS) -f elf kernel/entry.s -o $@ -help: - @echo "Run 'make' to compile." - @echo "Run 'make clean' to delete compiled objects." - @echo "Run 'make run' to run the compiled object. Must have qemu-system-i386 (but x86_64 should work too)." +kernel/arch/x86/tty/tty.o: kernel/arch/x86/tty/tty.c + $(CC) -o $@ -ffreestanding -c kernel/arch/x86/tty/tty.c + +kernel/kernel.o: kernel/kernel.c + $(CC) -o $@ -Iinclude/arch/x86 -ffreestanding -c kernel/kernel.c + +clean: + rm boot kernel/kernel.bin ${KERNEL_OBJ} boot.img -.PHONY = clean run help +.PHONY: all clean