#******************************************************************************#
#                                                                              #
#                                                         :::      ::::::::    #
#    Makefile                                           :+:      :+:    :+:    #
#                                                     +:+ +:+         +:+      #
#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
#                                                 +#+#+#+#+#+   +#+            #
#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
#*   Updated: 2025/07/15 14:44:55 by bchanot          ###   ########.fr       *#
#                                                                              #
#******************************************************************************#

NAME = ex00
MAKE_LIBS = make --no-print-directory
SRCS_DIR = srcs/
OBJS_DIR = .objects/
CC = g++ -Wall -Wextra -Werror -g
INC = -I./includes
FILES = main Zombie zombieHorde randomChump newZombie
SRCS = $(FILES)
OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
RED = \033[1;31m
BLUE = \033[1;34m
CYAN = \033[0;36m
GREEN = \033[1;32m
YELLOW = \033[1;33m
EOC = \033[0m

all: $(NAME)

$(NAME): $(OBJS)
	@echo -e "$(GREEN)Objects created.$(EOC)"
	@$(CC) $(OBJS) $(INC) -o $(NAME)
	@echo -e "$(GREEN)Compilation complete.$(EOC)"

$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
	@mkdir -p $(dir $@)
	$(CC) -c $< $(INC) -o $@

clean:
	@echo -e "$(RED)Deleting objects.$(EOC)"
	@/bin/rm -rf $(OBJS_DIR)

fclean: clean
	@echo -e "$(RED)Deleting binary.$(EOC)"
	@/bin/rm -rf $(NAME)

re: fclean all

.PHONY: all clean fclean re
