-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
113 lines (83 loc) · 2.51 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jjauzion <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/03/08 11:25:23 by jjauzion #+# #+# #
# Updated: 2018/03/20 16:19:42 by jjauzion ### ########.fr #
# #
# **************************************************************************** #
.PHONY: all, clean, fclean, re, LIB
SRC_NAME1 = main.c \
init.c \
parse.c \
check_name.c \
add_link.c \
add_vertex.c \
free.c \
list_fct.c \
list_fct2.c \
path_finding.c \
path_fct.c \
djikstra.c \
print.c \
run_ants_run.c \
adj_list_mgmt.c \
find_best_solution.c
SRC_NAME2 =
SRC_PATH1 = src/
SRC_PATH2 =
OBJ_PATH1 = .obj/
LIB_PATH = libft/
LDLIBS = libftprintf.a
EXT_LIB =
INC_PATH1 = libft/
INC_PATH2 = includes/
INC_NAME1 = libft.h
INC_NAME2 = lemin.h
NAME = lem-in
CC = gcc
ifdef FLAG
ifeq ($(FLAG), no)
CFLAGS =
DBFLAGS =
endif
ifeq ($(FLAG), debug)
CFLAGS = -Wall -Wextra -Werror
DBFLAGS = -g3 -fsanitize=address
endif
else
CFLAGS = -Wall -Wextra -Werror
DBFLAGS =
endif
SRC = $(addprefix $(SRC_PATH1),$(SRC_NAME1)) \
$(addprefix $(SRC_PATH2),$(SRC_NAME2))
OBJ1 = $(addprefix $(OBJ_PATH1),$(SRC_NAME1:.c=.o))
OBJ2 = $(addprefix $(OBJ_PATH1),$(SRC_NAME2:.c=.o))
INC = $(addprefix $(INC_PATH2),$(INC_NAME2)) \
$(addprefix $(INC_PATH1),$(INC_NAME1))
LDFLAGS = $(addprefix $(LIB_PATH),$(LDLIBS))
CPPFLAGS = $(addprefix -I,$(INC_PATH1)) \
$(addprefix -I,$(INC_PATH2))
all: LIB $(NAME)
$(NAME): $(LDFLAGS) $(OBJ1) $(OBJ2)
$(CC) $(DBFLAGS) $(LDFLAGS) $(EXT_LIB) $(OBJ1) $(OBJ2) -o $(NAME)
LIB:
make -C libft
$(OBJ_PATH1)%.o: $(SRC_PATH1)%.c $(INC) Makefile
@mkdir $(OBJ_PATH1) 2> /dev/null || true
$(CC) $(CFLAGS) $(DBFLAGS) -c $< $(CPPFLAGS) -o $@
clean:
make -C libft clean
rm -f $(OBJ1) $(OBJ2)
@rmdir $(OBJ_PATH1) 2> /dev/null || true
fclean: clean
make -C libft fclean
rm -fv $(NAME)
re: fclean all
norme:
norminette $(SRC)
norminette $(INC)
norminette $(LIB_PATH)