]> git.dujemihanovic.xyz Git - nameless-os.git/commitdiff
Simplify Makefile
authorDuje Mihanović <duje.mihanovic@skole.hr>
Sun, 17 Oct 2021 11:19:52 +0000 (13:19 +0200)
committerDuje Mihanović <duje.mihanovic@skole.hr>
Sun, 17 Oct 2021 11:19:52 +0000 (13:19 +0200)
Makefile

index c8f15f3d53be49549e5fb28c3afa609bef1e7536..848c7959b14d9a1d439b3980c83cf7c6dedc0ce4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,8 @@ CC = i686-elf-gcc
 
 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
@@ -16,25 +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) -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