-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
117 lines (83 loc) · 3.19 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: thibaultgiraudon <thibaultgiraudon@stud +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/11/24 11:12:25 by tgiraudo #+# #+# #
# Updated: 2023/02/24 18:14:45 by thibaultgir ### ########.fr #
# #
# **************************************************************************** #
# VARIABLE
NAME = print_news
LIST_SRCS = main.c \
ft_check_country.c \
HEADERS = print_news.h
# DIRECTORY
DIR_OBJS = .objs/
DIR_SRCS = srcs/
DIR_INCS = include/
# LIB
LIBFT = -L ./libft -lft
# CONSTANT
PRINT = @printf
FLAGS = -Wall -Wextra -Werror
MAKEFLAGS += --no-print-directory
CC = gcc
OBJS = $(patsubst %.c, $(DIR_OBJS)%.o, $(SRCS))
SRCS = ${addprefix ${DIR_SRCS}, ${LIST_SRCS}}
INCLUDES = ${addprefix ${DIR_INCS}, ${HEADERS}}
# COLOR
RED = \033[1;31m
PURPLE = \033[38;5;5m
GREEN = \033[1;32m
YELLOW = \033[1;33m
SUPPR = \r\033[2K
DEFAULT = \033[0m
# RULES
${DIR_OBJS}%.o : %.c Makefile ${INCLUDES}
@mkdir -p $(shell dirname $@)
@${PRINT} "${YELLOW}${SUPPR}Creating ${NAME}'s objects : $@"
@${CC} -g3 ${FLAGS} -I ${DIR_INCS} -c $< -o $@
@${PRINT} "${GREEN}${SUPPR}Creating ${NAME}'s objects : DONE"
${NAME} : ascii lib ${OBJS}
@${PRINT} "${GREEN}${SUPPR}Creating ${NAME}'s objects : DONE"
@${PRINT} "\n${YELLOW}Compiling ${NAME}..."
@${CC} -g3 ${OBJS} ${LIBFT} -o ${NAME}
@${PRINT} "\r${GREEN}Compiling ${NAME} : DONE${DEFAULT}\n\n"
all : ${NAME}
leaks : ascii lib ${OBJS}
@${PRINT} "${GREEN}${SUPPR}Creating ${NAME}'s objects : DONE"
@${PRINT} "\n${YELLOW}Compiling ${NAME}..."
@${CC} -fsanitize=address ${OBJS} ${LIBFT} -o ${NAME}
@${PRINT} "\r${GREEN}Compiling ${NAME} : DONE${DEFAULT}\n\n"
ascii :
@${PRINT} "$$ASCII"
lib :
@${MAKE} -C ./libft
clean :
@${PRINT} "${RED}Deleting objects : DONE\n"
@rm -rf ${DIR_OBJS}
fclean : clean
@${PRINT} "${RED}Cleaning libft : DONE\n"
@${MAKE} fclean -C ./libft
@${PRINT} "${RED}Deleting executable : DONE\n\n${DEFAULT}"
@rm -f ${NAME}
re : ascii fclean all
${DIR_OBJS} :
mkdir -p ${DIR_OBJS}
define ASCII
${PURPLE}
_ _
(_) | |
_ __ _ __ _ _ __ | |_ _ __ _____ _____
| '_ \| '__| | '_ \| __| | '_ \ / _ \ \ /\ / / __|
| |_) | | | | | | | |_ | | | | __/\ V V /\__ \\
| .__/|_| |_|_| |_|\__| |_| |_|\___| \_/\_/ |___/
| |
|_|
${DEFAULT}
endef
export ASCII
.PHONY : all clean fclean re lib ascii leaks