# **************************************************************************** # # # # ::: :::::::: # # Makefile :+: :+: :+: # # +:+ +:+ +:+ # # By: gbrochar +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/12/17 19:47:03 by gbrochar #+# #+# # # Updated: 2020/12/17 20:06:15 by gbrochar ### ########.fr # # # # **************************************************************************** # NAME = scop SRC_FILE = main.c \ OBJ_FILE = $(SRC_FILE:.c=.o) SRC_DIR = src/ OBJ_DIR = obj/ SRC = $(addprefix $(SRC_DIR), $(SRC_FILE)) OBJ = $(addprefix $(OBJ_DIR), $(OBJ_FILE)) LIB = libft/libft.a CC = gcc CFLAGS = -Wall -Werror -Wextra RED = \033[31m GREEN = \033[32m YELLOW = \033[33m BLUE = \033[34m CYAN = \033[36m WHITE = \033[0m all: $(NAME) $(NAME): $(OBJ) @make -C libft @$(CC) $(CFLAGS) -c $(SRC) @mv $(OBJ_FILE) $(OBJ_DIR) @$(CC) $(CFLAGS) $(OBJ) -o $(NAME) $(LIB) @echo "$(GREEN)[OK]$(WHITE) $(NAME)" $(OBJ_DIR)%.o: $(SRC_DIR)%.c libft/ @if [ ! -d ./obj ]; then \ mkdir -p ./obj; \ fi; @$(CC) $(CFLAGS) -I libft/ -o $@ -c $< @echo "$(CYAN)[CC]$(WHITE) $<" clean: @make -C libft clean @rm -rf $(OBJ_DIR) fclean: clean @make -C libft fclean @rm -f $(NAME) re: fclean all .PHONY: all clean fclean re