From 836eea81e1ac7b04be58ec07906bfb436802db98 Mon Sep 17 00:00:00 2001 From: David GAILLETON Date: Mon, 17 Nov 2025 13:15:58 +0100 Subject: [PATCH] Set .o and .d in .build folder --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b51ec84..3a85689 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ NAME= libftprintf.a SRC_DIR= src INC_DIR= include LIBFT_DIR= libft +BUILD_DIR= .build SRC= $(SRC_DIR)/ft_printf.c \ $(SRC_DIR)/ft_putnbr_base.c \ @@ -13,8 +14,8 @@ SRC= $(SRC_DIR)/ft_printf.c \ $(SRC_DIR)/print_str.c \ $(SRC_DIR)/print_unsigned.c \ -OBJ= $(SRC:.c=.o) -DEP= $(SRC:.c=.d) +OBJ= $(SRC:%.c=$(BUILD_DIR)/%.o) +DEP= $(SRC:%.c=$(BUILD_DIR)/%.d) CC= cc CFLAGS= -Wall -Wextra -Werror -I$(INC_DIR) -I$(LIBFT_DIR) -MMD -MP @@ -27,7 +28,8 @@ $(NAME): $(OBJ) cp $(LIBFT_DIR)/libft.a $(NAME) $(AR) $(NAME) $(OBJ) -%.o: %.c +$(BUILD_DIR)/%.o: %.c + @mkdir -p $(dir $@) $(CC) $(CFLAGS) -c $< -o $@ clean: