# **************************************************************************** # # # # ::: :::::::: # # Makefile :+: :+: :+: # # +:+ +:+ +:+ # # By: gbrochar +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/12/17 19:47:03 by gbrochar #+# #+# # # Updated: 2020/12/23 10:49:53 by gbrochar ### ########.fr # # # # **************************************************************************** # NAME = scop SRC_FILE = main.c \ parse_file.c \ parse_line.c \ env.c \ mat4_transpose.c \ mat4_multiply.c \ OBJ_FILE = $(SRC_FILE:.c=.o) INC_FILE = scop.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)) LIB = 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) $(INC) @$(CC) $(CFLAGS) -c $(SRC) -I $(INC_DIR) @mv $(OBJ_FILE) $(OBJ_DIR) @$(CC) $(CFLAGS) $(OBJ) -o $(NAME) $(LIB) @echo -e "$(GREEN)[OK]$(WHITE) $(NAME)" $(OBJ_DIR)%.o: $(SRC_DIR)%.c inc/ @if [ ! -d ./obj ]; then \ mkdir -p ./obj; \ fi; @$(CC) $(CFLAGS) -I $(INC_DIR) -o $@ -c $< @echo -e "$(CYAN)[CC]$(WHITE) $<" clean: @rm -rf $(OBJ_DIR) @echo -e "$(RED)[REMOVED]$(WHITE) obj files" fclean: clean @rm -f $(NAME) @echo -e "$(RED)[REMOVED]$(WHITE) $(NAME)" re: fclean all .PHONY: all clean fclean re