97 lines
3.6 KiB
Makefile
97 lines
3.6 KiB
Makefile
# **************************************************************************** #
|
|
# #
|
|
# ::: :::::::: #
|
|
# Makefile :+: :+: :+: #
|
|
# +:+ +:+ +:+ #
|
|
# By: lfirmin lfirmim@student.42.fr> +#+ +:+ +#+ #
|
|
# +#+#+#+#+#+ +#+ #
|
|
# Created: 2024/08/12 07:07:31 by lfirmin #+# #+# #
|
|
# Updated: 2024/11/07 07:46:53 by lfirmin ### ########.fr #
|
|
# #
|
|
# **************************************************************************** #
|
|
|
|
NAME = push_swap
|
|
PRINTF = libftprintf.a
|
|
LIBFT = libft.a
|
|
SRC_FILES = main.c op.c sort_tiny.c stack.c utils.c sort_utils.c sort.c \
|
|
calc_cheap.c calc_cheap_utils.c sort_2.c pars.c
|
|
INCLUDES_FILES = include/pushswap.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 PUSHSWAP_ART
|
|
________ ___ ___ ________ ___ ___ ________ ___ __ ________ ________
|
|
|\ __ \|\ \|\ \|\ ____\|\ \|\ \|\ ____\|\ \ |\ \|\ __ \|\ __ \\
|
|
\ \ \|\ \ \ \\\ \ \ \___|\ \ \\\ \ \ \___|\ \ \ \ \ \ \ \|\ \ \ \|\ \\
|
|
\ \ ____\ \ \\\ \ \_____ \ \ __ \ \_____ \ \ \ __\ \ \ \ __ \ \ ____\\
|
|
\ \ \___|\ \ \\\ \|____|\ \ \ \ \ \|____|\ \ \ \|\__\_\ \ \ \ \ \ \ \___||
|
|
\ \__\ \ \_______\____\_\ \ \__\ \__\____\_\ \ \____________\ \__\ \__\ \__\\
|
|
\|__| \|_______|\_________\|__|\|__|\_________\|____________|\|__|\|__|\|__|
|
|
\|_________| \|_________|
|
|
|
|
endef
|
|
export PUSHSWAP_ART
|
|
|
|
all: print_art $(NAME)
|
|
|
|
print_art:
|
|
@printf "$(CYAN)%s$(RESET)\n" "$$PUSHSWAP_ART"
|
|
|
|
$(NAME): $(OBJ) $(INCLUDES_FILES)
|
|
@printf "$(BOLD)$(WHITE)Hello Sir,\nWelcome to the $(GREEN)PUSH_SWAP$(WHITE) compilation process.\nPlease hold on as we prepare your program.\n\n$(RESET)"
|
|
@make -s -C printf_fd
|
|
@make -s -C libft
|
|
@printf "$(YELLOW)Compiling Push_swap, Please wait...$(RESET)"
|
|
@for char in $(LOADING_CHARS); do \
|
|
printf "\r$(YELLOW)Compiling Push_swap, Please wait... $$char$(RESET)"; \
|
|
sleep 0.1; \
|
|
done
|
|
@$(CC) $(CFLAGS) $(OBJ) $(INCLUDE) printf_fd/$(PRINTF) libft/$(LIBFT) -o $(NAME)
|
|
@printf "\r$(GREEN)Great news ! $(WHITE)Push_swap compiled successfully ! $(RESET)\n\n"
|
|
@printf "$(BOLD)$(WHITE)Compilation complete !\n$(GREEN)PUSH_SWAP$(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 printf_fd
|
|
@make clean -s -C libft
|
|
@$(RM) $(OBJ_DIR)
|
|
@printf "$(WHITE)Clean process completed for $(GREEN)Push_swap.$(RESET)\n"
|
|
|
|
clean1:
|
|
@$(RM) $(OBJ_DIR)
|
|
@printf "$(WHITE)Clean process completed for $(GREEN)Push_swap.$(RESET)\n"
|
|
|
|
fclean: clean1
|
|
@make fclean -s -C printf_fd
|
|
@make fclean -s -C libft
|
|
@$(RM) $(NAME)
|
|
@$(RM) $(PRINTF)
|
|
@$(RM) $(LIBFT)
|
|
@printf "$(WHITE)Full clean process completed for $(GREEN)Push_swap.$(RESET)\n"
|
|
|
|
re: fclean all
|
|
|
|
.PHONY: all clean fclean re print_art
|
|
|
|
norm:
|
|
norminette $(SRC_DIR) include/* printf_fd/* libft/*
|