-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
78 lines (59 loc) · 2.67 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: hanmpark <hanmpark@student.42nice.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/12/17 11:59:19 by hanmpark #+# #+# #
# Updated: 2024/03/10 21:54:57 by hanmpark ### ########.fr #
# #
# **************************************************************************** #
# **************************************************************************** #
# SOURCES / OBJECTS #
# **************************************************************************** #
SRCS_PATH = ./src/
SRCS_SRCS = ${addprefix ${SRCS_PATH}, main.c \
init_data.c \
parse_month.c \
utils.c}
GNL_PATH = ${SRCS_PATH}gnl/
SRCS_GNL = ${addprefix ${GNL_PATH}, get_next_line.c \
get_next_line_utils.c}
CALCULATE_PATH = ${SRCS_PATH}calculate/
SRCS_CALCULATE = ${addprefix ${CALCULATE_PATH}, calculate_logs.c \
get_logs.c \
current_time.c \
calculate_average.c}
PRINT_PATH = ${SRCS_PATH}print/
SRCS_PRINT = ${addprefix ${PRINT_PATH}, print_logtime.c \
check_logtime.c \
progress_bar.c}
SRCS = ${SRCS_GNL} ${SRCS_API} ${SRCS_CALCULATE} ${SRCS_PRINT} ${SRCS_LOG} ${SRCS_SRCS}
OBJS = ${SRCS:.c=.o}
# *************************************************************************** #
# COMPILER #
# *************************************************************************** #
CC = gcc
CFLAGS = -Wall -Wextra -Werror
ifdef DEBUG
CFLAGS += -fsanitize=address -g
endif
HEADER_PATH = ./inc/
%.o:%.c ${HEADER_PATH}
@${CC} ${CFLAGS} -c -I ${HEADER_PATH} $< -o ${<:.c=.o}
# *************************************************************************** #
# RULES #
# *************************************************************************** #
NAME = calculator
all: ${NAME}
${NAME}: ${OBJS}
@${CC} ${CFLAGS} ${OBJS} -o ${NAME}
debug:
@${MAKE} DEBUG=1
clean:
@rm -f ${OBJS}
fclean: clean
@rm -f ${NAME}
re: fclean all
.PHONY: all clean fclean re debug