-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
123 lines (98 loc) · 3.99 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
118
119
120
121
122
123
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# PROGRAMS #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
NAME = push_swap
CHECKER = checker
INCLUDES_DIR = includes
HEAD = -I./$(LIBFT_DIR) -I./$(INCLUDES_DIR)
SRCS_DIR = srcs
OBJS_DIR = .objs
CC = clang
CFLAGS = -Wall -Werror -Wextra
DFLAGS = -g #-fsanitize=address
LFLAGS = -L./libft -lft
RM = /bin/rm -rf
LIBFT_DIR = libft
LIBFT = $(LIBFT_DIR)/libft.a
SRCS_STACK_FILES = stack/unify_args.c \
stack/validate_params.c \
stack/build_stacks.c \
stack/operations.c \
stack/is_sorted.c \
stack/clear_stacks.c \
stack/debug.c \
stack/op_swap.c \
stack/op_push.c \
stack/op_rotate.c \
stack/op_reverse_rotate.c
SRCS_STACK = $(addprefix $(SRCS_DIR)/,$(SRCS_STACK_FILES))
OBJS_STACK = $(patsubst $(SRCS_DIR)%.c, $(OBJS_DIR)%.o, $(SRCS_STACK))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# PUSH SWAP #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
SRCS_PUSH_SWAP_FILES = push_swap.c \
algorithm/sort_small_list.c \
algorithm/markup_head.c \
algorithm/smallest_action.c \
algorithm/align_stack_a.c \
algorithm/atribute_and_operate.c \
algorithm/utils.c
SRCS_PUSH_SWAP = $(addprefix $(SRCS_DIR)/,$(SRCS_PUSH_SWAP_FILES))
OBJS_PUSH_SWAP = $(patsubst $(SRCS_DIR)%.c, $(OBJS_DIR)%.o, $(SRCS_PUSH_SWAP))
all: $(NAME)
$(NAME) : $(LIBFT) $(OBJS_STACK) $(OBJS_PUSH_SWAP)
@$(CC) $(OBJS_PUSH_SWAP) $(OBJS_STACK) $(HEAD) $(DFLAGS) $(CFLAGS) $(LFLAGS) -o $@
$(OBJS_DIR)/%.o: $(SRCS_DIR)/%.c
@mkdir -p $(OBJS_DIR)/stack
@mkdir -p $(OBJS_DIR)/algorithm
@$(CC) $(DFLAGS) $(CFLAGS) $(HEAD) -c $< -o $@
@echo -n "$< "
@tput setaf 28; echo "✔"
@tput sgr0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # CHECKER #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
SRCS_CHECKER_FILES = checker_bonus.c
SRCS_CHECKER = $(addprefix $(SRCS_DIR)/,$(SRCS_CHECKER_FILES))
OBJS_CHECKER = $(patsubst $(SRCS_DIR)%.c, $(OBJS_DIR)%.o, $(SRCS_CHECKER))
bonus: $(CHECKER)
$(CHECKER) : $(LIBFT) $(OBJS_STACK) $(OBJS_CHECKER)
@$(CC) $(OBJS_CHECKER) $(OBJS_STACK) $(HEAD) $(DFLAGS) $(CFLAGS) $(LFLAGS) -o $@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# LIBFT #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
$(LIBFT):
@make --no-print-directory -C $(LIBFT_DIR)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# CLEAN AND FCLEAN #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
clean:
@make --no-print-directory clean -C $(LIBFT_DIR)
@$(RM) $(OBJS_DIR)
@tput bold
@echo "Deleting objects ..."
@tput sgr0
fclean: clean
@make --no-print-directory fclean -C $(LIBFT_DIR)
@$(RM) $(STACK)
@$(RM) $(CHECKER)
@$(RM) $(NAME)
@tput bold
@echo "Deleting $(NAME) and $(CHECKER) binarys ..."
@tput sgr0
re: fclean all
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# NORM #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
norm:
@tput bold; tput rev
@echo "\n*~*~*~* NORMINETTE *~*~*~*"
@echo ""
@tput sgr0
@norminette 2>&1 | grep "Error" | tee norm.txt
@bash .norm.sh norm.txt
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# TEST #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
test:
@ ./test.sh