-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (82 loc) · 2.91 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: anarebelo <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/02/22 00:12:55 by anarebelo #+# #+# #
# Updated: 2023/02/22 00:54:25 by anarebelo ### ########.fr #
# #
# **************************************************************************** #
# NAME
# **************************************************************************** #
NAME = push_swap
NAME_BONUS = checker
# FILES
# **************************************************************************** #
SRCS = push_swap.c\
errors.c\
stack.c\
s_ops.c\
p_ops.c\
r_ops.c\
rr_ops.c\
sort_large.c\
sort_small_nb.c
SRCS_BONUS = checker_bonus.c\
s_ops_bonus.c\
p_ops_bonus.c\
r_ops_bonus.c\
rr_ops_bonus.c\
errors_bonus.c\
instructions_bonus.c\
stack_bonus.c\
get_next_line_utils.c\
get_next_line.c\
OBJS =${addprefix ${OBJS_DIR}, ${SRCS:.c=.o}}
DEPS =${addprefix ${OBJS_DIR}, ${SRCS:.c=.d}}
OBJS_BONUS =${addprefix ${OBJS_DIR}, ${SRCS_BONUS:.c=.o}}
DEPS_BONUS =${addprefix ${OBJS_DIR}, ${SRCS_BONUS:.c=.d}}
# DIRECTORY
# **************************************************************************** #
OBJS_DIR = objs/
SRCS_DIR = srcs/
SRCS_BONUS_DIR = srcs_bonus/
# LIBRARIES
# **************************************************************************** #
INCLUDE = -I includes -I libft
LIB_EXE = libft/libft.a
# COMPILATION
# **************************************************************************** #
LINK = gcc
CC = gcc -c
DEPFLAGS = -MMD -MP
CFLAGS = -Wall -Wextra -Werror
RM = rm -rf
# RULES
# **************************************************************************** #
all: make_libft ${NAME}
$(OBJS_DIR)%.o: $(SRCS_DIR)%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(DEPFLAGS) $(INCLUDE) $< -o $@
$(OBJS_DIR)%.o: $(SRCS_BONUS_DIR)%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(DEPFLAGS) $(INCLUDE) $< -o $@
make_libft:
@$(MAKE) -C ./libft
${NAME}: ${OBJS}
${LINK} ${CFLAGS} ${OBJS} ${LIB_EXE} -o ${NAME}
bonus: make_libft ${NAME_BONUS}
${NAME_BONUS}: ${OBJS_BONUS}
${LINK} ${CFLAGS} ${LIB_EXE} ${OBJS_BONUS} -o ${NAME_BONUS}
clean:
${RM} ${OBJS_DIR}
$(MAKE) -C ./libft clean
fclean: clean
${RM} ${NAME} ${NAME_BONUS}
$(MAKE) -C ./libft fclean
re: fclean all
-include ${DEPS}
-include ${DEPS_BONUS}
.PHONY: all clean fclean re