]> git.dujemihanovic.xyz Git - nameless-os.git/blobdiff - Makefile
Remove unused protected-mode print routine
[nameless-os.git] / Makefile
index c895701d2b911f6517b90be5d4b4fd8cbea6cfcb..848c7959b14d9a1d439b3980c83cf7c6dedc0ce4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,30 +2,42 @@ AS = yasm
 LD = i686-elf-ld
 CC = i686-elf-gcc
 
-KERNEL_OBJ = kernel/entry.o kernel/arch/x86/tty/tty.o kernel/kernel.o
+GIT_REV = $(shell git rev-parse --short HEAD)
 
-all: boot.img
+CFLAGS = -std=gnu89 -g -Iinclude/arch/x86 -ffreestanding -DGIT_COMMIT=\"$(GIT_REV)\"
 
-boot.img: boot kernel/kernel.bin
-       cat boot kernel/kernel.bin > $@
+KERNEL_OBJ = kernel/entry.o kernel/arch/x86/tty/tty.o kernel/drivers/irq/i8259a.o kernel/arch/x86/irq/idt.o kernel/arch/x86/irq/sample_handler.o kernel/kernel.o
+
+all: boot.img kernel/kernel.elf
+
+boot.img: boot/x86/boot kernel/kernel.bin
+       cat boot/x86/boot kernel/kernel.bin > $@
        truncate -s1440K $@
 
-boot: boot.s
-       $(AS) -f bin boot.s -o $@
+boot/x86/boot: boot/x86/boot.s boot/x86/a20.s boot/x86/protected.s boot/x86/print.s
+       $(AS) -f bin boot/x86/boot.s -o $@
 
 kernel/kernel.bin: ${KERNEL_OBJ}
-       $(LD) -o $@ -T kernel/linker.ld ${KERNEL_OBJ} --oformat=binary
+       $(LD) -o $@ -T kernel/linker.ld ${KERNEL_OBJ}
 
 kernel/entry.o: kernel/entry.s
        $(AS) -f elf kernel/entry.s -o $@
 
 kernel/arch/x86/tty/tty.o: kernel/arch/x86/tty/tty.c
-       $(CC) -o $@ -ffreestanding -c kernel/arch/x86/tty/tty.c
+
+kernel/drivers/irq/i8259a.o: kernel/drivers/irq/i8259a.c
+
+kernel/arch/x86/irq/idt.o: kernel/arch/x86/irq/idt.c
+
+kernel/arch/x86/irq/sample_handler.o: kernel/arch/x86/irq/sample_handler.c
+       $(CC) $(CFLAGS) -mgeneral-regs-only -c kernel/arch/x86/irq/sample_handler.c -o $@
 
 kernel/kernel.o: kernel/kernel.c
-       $(CC) -o $@ -Iinclude/arch/x86 -ffreestanding -c kernel/kernel.c
+
+kernel/kernel.elf: kernel/kernel.bin
+       $(LD) -o $@ -T kernel/linker.ld ${KERNEL_OBJ} --oformat=elf32-i386
 
 clean:
-       rm boot kernel/kernel.bin ${KERNEL_OBJ} boot.img
+       rm boot/x86/boot kernel/kernel.bin kernel/kernel.elf ${KERNEL_OBJ} boot.img
 
 .PHONY: all clean