NAME = libftprintf.a SRC_FILE = ft_printf.c \ ft_parser.c \ ft_int_case.c \ ft_char_case.c \ ft_str_case.c \ ft_ui_case.c \ ft_x_case.c \ ft_ptr_case.c \ ft_percent_case.c \ ft_printf_memset.c \ OBJ_FILE = $(SRC_FILE:.c=.o) INC_FILE = ft_printf.h \ SRC_DIR = src/ OBJ_DIR = obj/ INC_DIR = inc/ SRC = $(addprefix $(SRC_DIR), $(SRC_FILE)) OBJ = $(addprefix $(OBJ_DIR), $(OBJ_FILE)) INC = $(addprefix $(INC_DIR), $(INC_FILE)) CC = gcc CFLAGS = -Wall -Werror -Wextra GREEN = \033[32m RED = \033[31m ORANGE = \033[33m PURPLE = \033[35m CYAN = \033[36m WHITE = \033[0m all: $(NAME) $(NAME): $(OBJ) $(INC) @echo -e "$(PURPLE)[MAKE]$(WHITE) libft" @make --no-print-directory -C ./libft @cp libft/libft.a $(NAME) @ar -rcs $(NAME) $(OBJ) @ranlib $(NAME) @echo -e "$(GREEN)[OK]$(WHITE) $(NAME)" $(OBJ_DIR)%.o: $(SRC_DIR)%.c libft/ $(INC) @if [ ! -d ./obj ]; then \ mkdir -p ./obj; \ fi; @$(CC) $(CFLAGS) -I $(INC_DIR) -I libft/inc -o $@ -c $< @echo -e "$(CYAN)[CC]$(WHITE) $<" clean: @make --no-print-directory -C libft clean @echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)" @rm -rf $(OBJ_DIR) fclean: clean @make --no-print-directory -C libft fclean @echo -e "$(RED)[DELETE]$(WHITE) $(NAME)" @rm -f $(NAME) re: fclean all .PHONY: all clean fclean re