-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
171 lines (144 loc) · 3.88 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: bwan-nan <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/06/06 20:37:34 by bwan-nan #+# #+# #
# Updated: 2019/06/26 11:49:20 by bwan-nan ### ########.fr #
# #
# **************************************************************************** #
PUSH_SWAP = push_swap
CHECKER = checker
LIB = $(LPATH)libft.a
# Reset
NC=\033[0m
# Regular Colors
BLACK=\033[0;30m
RED=\033[0;31m
GREEN =\033[32m
YELLOW=\033[0;33m
BLUE=\033[0;34m
PURPLE=\033[0;35m
CYAN=\033[0;36m
WHITE=\033[0;37m
CC = Clang
COMPILE = $(CC) -c
DEBUG = $(CC) -g
MKDIR = mkdir -p
CLEANUP = rm -rf
WFLAGS += -Wall
WFLAGS += -Werror
WFLAGS += -Wextra
DFLAGS = -fsanitize=address
IFLAGS = -I $(IPATH) -I $(LIPATH)
CFLAGS = $(WFLAGS) $(IFLAGS)
OPATH = obj/
SPATH = src/
IPATH = inc/
LPATH = libft/
LIPATH = libft/inc/
INCS += push_swap.h
INCS += libft.h
INCS += ft_printf.h
INCS += output.h
INCS += strings.h
INCS += binary.h
INCS += conversions.h
INCS += lists.h
SRCS += push_swap.c
SRCS += glob.c
SRCS += create_stacks.c
SRCS += create_list.c
SRCS += sort_list.c
SRCS += split_list.c
SRCS += copy_list.c
SRCS += sort_top3.c
SRCS += sort_a.c
SRCS += sort_b.c
SRCS += instructions1.c
SRCS += instructions2.c
SRCS += get_functions.c
SRCS += aux.c
SRCS += display.c
SRCS += checker.c
SRCS += exec.c
SRCS_CH += checker.c
SRCS_CH += create_stacks.c
SRCS_CH += create_list.c
SRCS_CH += copy_list.c
SRCS_CH += get_functions.c
SRCS_CH += glob.c
SRCS_CH += exec.c
SRCS_CH += instructions1.c
SRCS_CH += instructions2.c
SRCS_CH += aux.c
SRCS_CH += display.c
SRCS_PS += push_swap.c
SRCS_PS += glob.c
SRCS_PS += create_stacks.c
SRCS_PS += create_list.c
SRCS_PS += sort_list.c
SRCS_PS += split_list.c
SRCS_PS += copy_list.c
SRCS_PS += sort_top3.c
SRCS_PS += sort_a.c
SRCS_PS += sort_b.c
SRCS_PS += instructions1.c
SRCS_PS += instructions2.c
SRCS_PS += get_functions.c
SRCS_PS += aux.c
SRCS_PS += display.c
ARG = 8 9 5 3 2 -1 6
DSYMP = $(PUSH_SWAP).dSYM
DSYMC = $(CHECKER).dSYM
DSYM = $(DSYMC) + $(DSYMP)
OBJS = $(patsubst %.c, $(OPATH)%.o, $(SRCS))
OBJS_CH = $(patsubst %.c, $(OPATH)%.o, $(SRCS_CH))
OBJS_PS = $(patsubst %.c, $(OPATH)%.o, $(SRCS_PS))
vpath %.c src/tools/
vpath %.c src/tools/instructions
vpath %.c src/checker/
vpath %.c src/push_swap/
vpath %.c src/push_swap/init
vpath %.c src/push_swap/sort
vpath %.c src/push_swap/tools
vpath %.h inc/
vpath %.h libft/inc/
all : $(LIB) $(PUSH_SWAP) $(CHECKER)
run : all
./$(PUSH_SWAP) $(ARG)
$(PUSH_SWAP): $(LIB) $(OPATH) $(OBJS_PS) $(INCS)
$(CC) -o $@ $< $(OBJS_PS)
printf "$(GREEN)$@ is ready.\n$(NC)"
$(CHECKER): $(LIB) $(OPATH) $(OBJS_CH) $(INCS)
$(CC) -o $@ $< $(OBJS_CH)
printf "$(GREEN)$@ is ready.\n$(NC)"
$(OBJS) : $(OPATH)%.o : %.c $(INCS)
$(COMPILE) $(CFLAGS) $< -o $@
printf "$(CYAN)Compiling $<\n$(NC)"
$(LIB) : FORCE
$(MAKE) -C $(LPATH)
$(LIBDB) :
$(MAKE) -C $(LPATH) debug
$(OPATH):
$(MKDIR) $@
clean :
$(MAKE) -C $(LPATH) clean
$(CLEANUP) $(OBJS)
$(CLEANUP) $(OPATH)
$(CLEANUP) $(DSYM)
printf "$(RED)All objects removed from Libft\n$(NC)"
printf "$(RED)All objects removed from Push_swap\n$(NC)"
fclean : clean
$(MAKE) -C $(LPATH) fclean
$(CLEANUP) $(OPATH)
$(CLEANUP) $(PUSH_SWAP)
$(CLEANUP) $(CHECKER)
printf "$(RED)$(PUSH_SWAP) deleted\n$(NC)"
printf "$(RED)$(CHECKER) deleted\n$(NC)"
re: fclean all
.PHONY: all clean fclean debug
.SILENT:
FORCE: