From 05cf0153829fa438ad965557ae8ee5844dfd9ae9 Mon Sep 17 00:00:00 2001 From: trimill Date: Sat, 27 Jan 2024 01:16:48 -0500 Subject: [PATCH] add system includes from include --- Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9e081c5..13ad832 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,3 @@ -CC=cc -LD=ld - -CFLAGS=-ffreestanding -g -Wall -Wextra -pedantic -lgcc - SRC_DIR=src INCLUDE_DIR=include BUILD_DIR=build @@ -10,10 +5,17 @@ BUILD_DIR=build K_BIN_NAME=kernel.bin ISO_NAME=os_image.iso +CC=cc +LD=ld + +CFLAGS=-ffreestanding -g -Wall -Wextra -pedantic -lgcc -isystem $(INCLUDE_DIR) + + C_SRC=$(shell find $(SRC_DIR) -type f -name "*.c") C_OBJ=$(patsubst %.c,$(BUILD_DIR)/%.o,$(C_SRC)) -H_SRC=$(shell find $(SRC_DIR) -type f -name "*.h") $(shell find $(INCLUDE_DIR) -type f -name "*.h") +H_SRC=$(shell find $(SRC_DIR) -type f -name "*.h") +H_INCLUDE=$(shell find $(INCLUDE_DIR) -type f -name "*.h") A_SRC=$(shell find $(SRC_DIR) -type f -name "*.S") A_OBJ=$(patsubst %.S,$(BUILD_DIR)/%.S.o,$(A_SRC)) @@ -33,7 +35,7 @@ $(C_OBJ): $(BUILD_DIR)/%.o : %.c @mkdir -p $(@D) $(CC) -c $(CFLAGS) -o $@ $< -$(BUILD_DIR)/$(K_BIN_NAME): $(SRC_DIR)/arch/amd64/linker.ld $(A_OBJ) $(C_OBJ) $(H_SRC) +$(BUILD_DIR)/$(K_BIN_NAME): $(SRC_DIR)/arch/amd64/linker.ld $(A_OBJ) $(C_OBJ) $(H_SRC) $(H_INCLUDE) @mkdir -p $(@D) $(LD) -nmagic -o $(BUILD_DIR)/$(K_BIN_NAME) -T $(SRC_DIR)/arch/amd64/linker.ld $(A_OBJ) $(C_OBJ)