-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
86 lines (70 loc) · 2.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
PUSH_SWAP = push_swap
CHECKER = checker
CC = gcc
CFLAGS = -Wall -Werror -Wextra
LIBRARIES = -L./libft -lft
INCLUDES = -I./includes
LIBFT = ./libft/libft.a
HEADER = ./includes/push_swap.h
SOURCES_DIR = srcs/
SOURCES_LIST_PS = push_swap.c \
parsing_input_data.c \
input_validation.c \
create_stack_a.c \
create_data.c \
create_result.c \
add_command.c \
commands_1.c \
commands_2.c \
utils.c \
utils_stack_1.c \
utils_stack_2.c \
private_sort.c \
insert_sort_1.c \
insert_sort_2.c \
insert_sort_count_score.c \
quick_sort.c \
sort_half_stack_a_1.c \
sort_half_stack_a_2.c \
output_result.c \
get_result.c \
free_all.c
SOURCES_PS = $(addprefix $(SOURCES_DIR), $(SOURCES_LIST_PS))
SOURCES_LIST_CHECKER = checker.c \
parsing_input_data.c \
input_validation.c \
create_stack_a.c \
commands_1.c \
commands_2.c \
utils_stack_1.c \
utils_stack_2.c \
utils.c \
free_all.c
SOURCES_CHECKER = $(addprefix $(SOURCES_DIR), $(SOURCES_LIST_CHECKER))
OBJECTS_LIST_PS = ${patsubst %.c, %.o, ${SOURCES_LIST_PS}}
OBJECTS_LIST_CHECKER = ${patsubst %.c, %.o, ${SOURCES_LIST_CHECKER}}
all : ${PUSH_SWAP}
${PUSH_SWAP} : Makefile $(HEADER) $(LIBFT) $(OBJECTS_LIST_PS)
@${CC} ${CFLAGS} -o $@ ${OBJECTS_LIST_PS} ${LIBRARIES} ${INCLUDES}
@printf "'${PUSH_SWAP}' was compiled\n"
$(LIBFT) : ./libft/Makefile ./libft/libft.h ./libft/*.c
@make -C ./libft
@make bonus -C ./libft
@printf "libft was compiled\n"
%.o : $(addprefix $(SOURCES_DIR), %.c)
$(CC) -c $(CFLAGS) $< -o $@ $(INCLUDES)
bonus : ${CHECKER}
${CHECKER} : Makefile $(HEADER) ${LIBFT} $(OBJECTS_LIST_CHECKER)
@${CC} ${CFLAGS} ${OBJECTS_LIST_CHECKER} -o ${CHECKER} ${LIBRARIES} ${INCLUDES}
@printf "'${CHECKER}' was compiled\n"
clean :
@make clean -C ./libft
@rm -rf $(OBJECTS_LIST_PS) $(OBJECTS_LIST_CHECKER)
@printf "command 'clean' was done\n"
fclean : clean
@make fclean -C ./libft
@rm -rf ${PUSH_SWAP} ${CHECKER}
@printf "command 'fclean' was done\n"
re : fclean all
@printf "command 're' was done\n"
.PHONY: all clean fclean re