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
$(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) -std=gnu89 -g -o $@ -Iinclude/arch/x86 -ffreestanding -c kernel/arch/x86/tty/tty.c
kernel/drivers/irq/i8259a.o: kernel/drivers/irq/i8259a.c
- $(CC) -std=gnu89 -g -o $@ -Iinclude/arch/x86 -ffreestanding -c kernel/drivers/irq/i8259a.c
kernel/arch/x86/irq/idt.o: kernel/arch/x86/irq/idt.c
- $(CC) -std=gnu89 -g -o $@ -Iinclude/arch/x86 -ffreestanding -c kernel/arch/x86/irq/idt.c
kernel/arch/x86/irq/sample_handler.o: kernel/arch/x86/irq/sample_handler.c
- $(CC) -std=gnu89 -g -o $@ -Iinclude/arch/x86 -ffreestanding -mgeneral-regs-only -c 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) -std=gnu89 -g -o $@ -Iinclude/arch/x86 -ffreestanding -DGIT_COMMIT=\"$(GIT_REV)\" -c kernel/kernel.c
kernel/kernel.elf: kernel/kernel.bin
$(LD) -o $@ -T kernel/linker.ld ${KERNEL_OBJ} --oformat=elf32-i386