-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
117 lines (86 loc) · 2.54 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: skpn <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/04/02 21:32:05 by sikpenou #+# #+# #
# Updated: 2020/04/14 14:59:12 by skpn ### ########.fr #
# #
# **************************************************************************** #
NAME = lem-in
CC = $(COMPILER) $(COMPILATION_FLAGS) $(DEBUG_FLAGS) $(INCLUDE_FLAGS)
COMPILER = clang
COMPILATION_FLAGS = -Wall -Werror -Wextra
DEBUG_FLAGS = -g3 -fsanitize=address -fsanitize=leak
INCLUDE_FLAGS = $(foreach dir, $(INC_DIR), -I $(dir) )
INC_DIR = $(shell find . -name 'inc' -type d)
SRC_DIR = $(shell find src -mindepth 1 -type d)
LIB_DIR = $(shell find lib -mindepth 1 -maxdepth 1 -type d)
OBJ_DIR = obj
OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.c=.o))
SRCS += \
main_lem.c \
SRCS += \
exit_lem.c \
free_lem_paths.c \
init_lem_structs.c \
init_lem_structs_display.c
SRCS += \
get_anthill.c \
get_rooms.c \
get_tubes.c \
parser_lem.c
SRCS += \
set_graph.c \
set_lvl.c \
SRCS += \
clean_graph.c \
load_balancing.c \
manage_config.c \
seek_paths.c \
try_path.c \
update_best_config.c
SRCS += \
display_lem.c \
set_display.c
SRCS += \
debug_lem.c \
debug_lem_paths.c \
debug_lem_rooms.c
INCS += \
lem_in.h \
libft.h
LIBS += \
libft.a
vpath %.c $(SRC_DIR)
vpath %.h $(INC_DIR)
vpath %.a $(LIB_DIR)
all: $(NAME)
$(NAME): $(LIBS) $(OBJS) Makefile
/bin/echo compiling $(NAME)
$(CC) -o $(NAME) $(OBJS) lib/libft/libft.a
$(OBJ_DIR)/%.o : %.c $(INCS) $(LIBS) Makefile
mkdir -p $(OBJ_DIR)
$(CC) -o $@ -c $<
$(LIBS): FORCE
make -C $(LIB_DIR)
clean: FORCE
make -C $(LIB_DIR) clean
rm -rf $(OBJS)
fclean: clean FORCE
make -C $(LIB_DIR) fclean
rm -rf $(NAME)
re: fclean all FORCE
make -C $(LIB_DIR)
show:
echo "comp : $(CC)\n"
echo "src_dir: $(SRC_DIR)\n"
echo "inc_dir: $(INC_DIR)\n"
echo "lib_dir: $(LIB_DIR)\n"
echo "srcs : $(SRCS)\n"
echo "incs : $(INCS)\n"
echo "libs : $(LIBS)\n"
FORCE:
.SILENT: