From fbf131b5c043b27e0b1543374bb144e3e426f723 Mon Sep 17 00:00:00 2001 From: Tyler Murphy <=> Date: Sun, 16 Jul 2023 02:54:32 -0400 Subject: initial --- kernel/Makefile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 kernel/Makefile (limited to 'kernel/Makefile') diff --git a/kernel/Makefile b/kernel/Makefile new file mode 100644 index 0000000..999498b --- /dev/null +++ b/kernel/Makefile @@ -0,0 +1,28 @@ +include ../.env + +C_SRC = $(shell find src -type f -name "*.c") +C_OBJ = $(patsubst %.c,bin/%.o, $(C_SRC)) + +ASM_SRC = $(shell find src -type f -name "*.asm") +ASM_OBJ = $(patsubst %.asm,bin/%.o, $(ASM_SRC)) + +CFLAGS += -Iinclude -Isrc -I../libk/include -std=gnu17 + +.PHONY: all + +all: bin/kernel.bin + +$(C_OBJ): bin/%.o : %.c + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(ASM_OBJ): bin/%.o : %.asm + @mkdir -p $(@D) + $(AS) $< -f elf -o $@ + +bin/kernel.bin: $(C_OBJ) $(ASM_OBJ) + @mkdir -p $(@D) + $(LD) -o bin/kernel.bin -T linker.ld $(C_OBJ) $(ASM_OBJ) ../libk/bin/libk.a $(LDFLAGS) + +clean: + rm -fr bin -- cgit v1.2.3-freya