97 lines
3.5 KiB
Makefile
97 lines
3.5 KiB
Makefile
# **************************************************************************** #
|
|
# #
|
|
# ::: :::::::: #
|
|
# Makefile :+: :+: :+: #
|
|
# +:+ +:+ +:+ #
|
|
# By: lfirmin lfirmim@student.42.fr> +#+ +:+ +#+ #
|
|
# +#+#+#+#+#+ +#+ #
|
|
# Created: 2024/08/12 07:07:31 by lfirmin #+# #+# #
|
|
# Updated: 2024/08/12 09:15:05 by lfirmin ### ########.fr #
|
|
# #
|
|
# **************************************************************************** #
|
|
|
|
NAME = so_long
|
|
LIBFT = libft.a
|
|
GNL = gnl.a
|
|
FT_PRINTF_FD = libftprintf.a
|
|
SRC_FILES = main.c pars_map.c pars_map_2.c pars_map_3.c utils.c utils_2.c utils_3.c utils_4.c
|
|
INCLUDES_FILES = include/so_long.h
|
|
SRC_DIR = srcs/
|
|
SRC = $(addprefix $(SRC_DIR), $(SRC_FILES))
|
|
OBJ_DIR = obj/
|
|
OBJ = $(addprefix $(OBJ_DIR), $(SRC_FILES:.c=.o))
|
|
CC = cc
|
|
CFLAGS = -Wall -Werror -Wextra -g3
|
|
INCLUDE = -I include
|
|
RM = rm -rf
|
|
MKDIR = mkdir -p
|
|
|
|
GREEN = \033[0;32m
|
|
YELLOW = \033[0;33m
|
|
CYAN = \033[0;36m
|
|
RESET = \033[0m
|
|
BOLD = \033[1m
|
|
WHITE = \033[0;97m
|
|
|
|
LOADING_CHARS = ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏
|
|
|
|
define SO_LONG_ART
|
|
▗▄▄▖ ▗▄▖ ▗▖ ▗▄▖ ▗▖ ▗▖ ▗▄▄▖
|
|
▐▌ ▐▌ ▐▌ ▐▌ ▐▌ ▐▌▐▛▚▖▐▌▐▌
|
|
▝▀▚▖▐▌ ▐▌ ▐▌ ▐▌ ▐▌▐▌ ▝▜▌▐▌▝▜▌
|
|
▗▄▄▞▘▝▚▄▞▘▄▄▄▄▖▐▙▄▄▖▝▚▄▞▘▐▌ ▐▌▝▚▄▞▘
|
|
|
|
|
|
endef
|
|
export SO_LONG_ART
|
|
|
|
all: print_art $(NAME)
|
|
|
|
print_art:
|
|
@printf "$(YELLOW)%s$(RESET)\n" "$$SO_LONG_ART"
|
|
|
|
$(NAME): $(OBJ) $(INCLUDES_FILES)
|
|
@printf "$(BOLD)$(WHITE)Welcome to the $(GREEN)SO_LONG$(WHITE) compilation process.\nPlease hold on as we prepare your program.\n\n$(RESET)"
|
|
@make -s -C libft
|
|
@make -s -C minilibx-linux
|
|
@make -s -C gnl
|
|
@make -s -C ft_printf_fd
|
|
@printf "$(YELLOW)Compiling So_long, Please wait...$(RESET)"
|
|
@for char in $(LOADING_CHARS); do \
|
|
printf "\r$(YELLOW)Compiling So_long, Please wait... $$char$(RESET)"; \
|
|
sleep 0.1; \
|
|
done
|
|
@$(CC) $(CFLAGS) $(OBJ) $(INCLUDE) -L minilibx-linux -lmlx -lXext -lX11 -lm -lz libft/$(LIBFT) gnl/$(GNL) ft_printf_fd/$(FT_PRINTF_FD) -o $(NAME)
|
|
@printf "\r$(GREEN)Great news ! $(WHITE)SO_LONG compiled successfully ! $(RESET)\n\n"
|
|
@printf "$(BOLD)$(WHITE)Compilation complete !\n$(GREEN)So_long$(WHITE) is ready to use !\n"
|
|
|
|
$(OBJ_DIR)%.o: $(SRC_DIR)%.c
|
|
@$(MKDIR) $(OBJ_DIR)
|
|
@$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
|
|
|
|
clean:
|
|
@make clean -s -C libft
|
|
@make clean -s -C gnl
|
|
@make clean -s -C ft_printf_fd
|
|
@$(RM) $(OBJ_DIR)
|
|
@printf "$(WHITE)Clean process completed for $(GREEN)So_long.$(RESET)\n"
|
|
|
|
clean1:
|
|
@$(RM) $(OBJ_DIR)
|
|
@printf "$(WHITE)Clean process completed for $(GREEN)So_long$(RESET)\n"
|
|
|
|
fclean: clean1
|
|
@make fclean -s -C libft
|
|
@make fclean -s -C gnl
|
|
@make fclean -s -C ft_printf_fd
|
|
@$(RM) $(NAME)
|
|
@$(RM) $(PRINTF)
|
|
@$(RM) $(LIBFT)
|
|
@printf "$(WHITE)Full clean process completed for $(GREEN)So_long.$(RESET)\n"
|
|
|
|
re: fclean all
|
|
|
|
.PHONY: all clean fclean re print_art clean1 norminette
|
|
|
|
norminette:
|
|
norminette srcs/* include/* libft/*.c libft/*.h gnl/*/*.c gnl/*/*.h ft_printf_fd/*.c ft_printf_fd/*.h | grep "Error"
|