X-Git-Url: http://git.dujemihanovic.xyz/projects?a=blobdiff_plain;f=Makefile;h=9d1c34475a160d1bb3af2d6fd2ff3f28feb0169e;hb=63853960825f007827a79f704d291c372c807096;hp=9d95b1ef97134bcebc837fe4ab4cfab1e6fff45a;hpb=73dce672626ceb415b49ff059092c48a2f7c3de3;p=nameless-os.git diff --git a/Makefile b/Makefile index 9d95b1e..9d1c344 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/x86/boot kernel/kernel.bin + cat boot/x86/boot kernel/kernel.bin > $@ + truncate -s1440K $@ + +boot/x86/boot: boot/x86/boot.s boot/x86/a20.s boot/x86/protected.s + $(AS) -f bin boot/x86/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) -g -o $@ -ffreestanding -c kernel/arch/x86/tty/tty.c + +kernel/kernel.o: kernel/kernel.c + $(CC) -g -o $@ -Iinclude/arch/x86 -ffreestanding -c kernel/kernel.c + +clean: + rm boot/x86/boot kernel/kernel.bin ${KERNEL_OBJ} boot.img -.PHONY = clean run help +.PHONY: all clean