X-Git-Url: http://git.dujemihanovic.xyz/posts?a=blobdiff_plain;f=Makefile;h=848c7959b14d9a1d439b3980c83cf7c6dedc0ce4;hb=aedfdf1f1445cf9fa63fb53c42878240a9ff65ae;hp=5d9822946a116ea2bce52b0cef027cdbf59832d9;hpb=3568adbeba1623a28e80fa3680a2286fd48b0ed3;p=nameless-os.git diff --git a/Makefile b/Makefile index 5d98229..848c795 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,11 @@ 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) + +CFLAGS = -std=gnu89 -g -Iinclude/arch/x86 -ffreestanding -DGIT_COMMIT=\"$(GIT_REV)\" + +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 @@ -14,16 +18,21 @@ boot/x86/boot: boot/x86/boot.s boot/x86/a20.s boot/x86/protected.s boot/x86/prin $(AS) -f bin boot/x86/boot.s -o $@ kernel/kernel.bin: ${KERNEL_OBJ} - $(LD) -o $@ -T kernel/linker.ld ${KERNEL_OBJ} + $(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) -g -o $@ -Iinclude/arch/x86 -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) -g -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