From: Duje Mihanović Date: Sun, 17 Oct 2021 11:19:52 +0000 (+0200) Subject: Simplify Makefile X-Git-Tag: 0.1.0~15 X-Git-Url: https://git.dujemihanovic.xyz/%7B%7B?a=commitdiff_plain;h=aedfdf1f1445cf9fa63fb53c42878240a9ff65ae;p=nameless-os.git Simplify Makefile --- diff --git a/Makefile b/Makefile index c8f15f3..848c795 100644 --- 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