-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
190 lines (168 loc) · 3.84 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: thakala <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/03/24 11:07:24 by thakala #+# #+# #
# Updated: 2022/04/06 10:41:37 by thakala ### ########.fr #
# #
# **************************************************************************** #
NAME = fdf
MATH_LIB = m
FILES = \
fdf \
event_handlers \
error \
hooks \
draw \
init \
parse \
validate \
coordinates \
utilities \
mouse_handlers \
rotators \
manipulate \
pixel_put \
swap \
project \
colours \
init_public
LIBFT_NAME = libft
LIBFT_DIR = libft
LIBFT_OBJECTS_DIR = $(LIBFT_DIR)/objects
LIBFT_OBJECT_PATHS = $(addsuffix .o, $(addprefix $(LIBFT_OBJECTS_DIR), \
ft_abs \
ft_atoi \
ft_bzero \
ft_isalnum \
ft_isalpha \
ft_isascii \
ft_isdigit \
ft_isprint \
ft_isspace \
ft_itoa \
ft_lstadd \
ft_lstdel \
ft_lstdelone \
ft_lstiter \
ft_lstmap \
ft_lstnew \
ft_lstpop \
ft_memalloc \
ft_memccpy \
ft_memchr \
ft_memcmp \
ft_memcpy \
ft_memdel \
ft_memdup \
ft_memjoin \
ft_memmove \
ft_memrplc \
ft_memset \
ft_putchar \
ft_putchar_fd \
ft_putendl \
ft_putendl_fd \
ft_putnbr \
ft_putnbr_fd \
ft_putstr \
ft_putstr_fd \
ft_sign \
ft_strcat \
ft_strchr \
ft_strclr \
ft_strcmp \
ft_strcpy \
ft_strcspn \
ft_strdel \
ft_strdup \
ft_strequ \
ft_striter \
ft_striteri \
ft_strjoin \
ft_strlcat \
ft_strlcpy \
ft_strlen \
ft_strmap \
ft_strmapi \
ft_strncat \
ft_strncmp \
ft_strncpy \
ft_strnequ \
ft_strnew \
ft_strnstr \
ft_strpbrk \
ft_strrchr \
ft_strsep \
ft_strsplit \
ft_strspn \
ft_strspnsep \
ft_strstr \
ft_strsub \
ft_strtrim \
ft_tolower \
ft_toupper \
get_next_line))
SOURCES = sources
OBJECTS = objects
INCLUDES = includes
FOLDER_LIST = \
$(SOURCES) \
$(OBJECTS) \
$(INCLUDES)
H_FILES = fdf
C_PATHS = $(addsuffix .c, $(addprefix $(SOURCES)/, $(FILES)))
H_PATHS = $(addsuffix .h, $(addprefix $(INCLUDES)/, $(H_FILES))) \
$(LIBFT_DIR)/includes/libft.h \
$(LIBFT_DIR)/includes/get_next_line.h
INCLUSIONS = $(foreach inc, $(INCLUDES), -I $(inc)) \
-I $(LIBFT_DIR)/includes
O_PATHS = $(addsuffix .o, $(addprefix $(OBJECTS)/, $(FILES)))
CC = clang
CC_FLAGS = -Wall -Wextra -Werror -Wconversion
LIBFT_FLAGS = -lft -Llibft
MLX_FLAGS = -lmlx -framework OpenGL -framework AppKit
.PHONY: all
all: CC_FLAGS := $(CC_FLAGS) -O3 -flto
all: $(NAME)
.PHONY: all-debug
all-debug: $(NAME)
$(NAME): .pre_requisites $(O_PATHS) Makefile
touch .pre_requisites
$(CC) $(CC_FLAGS) -l$(MATH_LIB) $(MLX_FLAGS) $(LIBFT_FLAGS) \
$(O_PATHS) -o $(NAME)
$(O_PATHS): $(OBJECTS)/%.o:$(SOURCES)/%.c $(H_PATHS) Makefile
$(CC) $(CC_FLAGS) $(INCLUSIONS) -c $< -o $@
.pre_requisites: $(LIBFT_NAME) $(FOLDER_LIST) $(H_PATHS) $(C_PATHS)
.PHONY: $(LIBFT_NAME)
$(LIBFT_NAME):
make -C $(LIBFT_DIR)
$(FOLDER_LIST):
mkdir -p $@
$(H_PATHS):
touch $@
$(C_PATHS):
touch $@
.PHONY: clean
clean:
/bin/rm -f $(O_PATHS)
make -C $(LIBFT_DIR) clean
.PHONY: fclean
fclean: clean
/bin/rm -f $(NAME) .pre_requisites
/bin/rm -rf $(OBJECTS)
make -C $(LIBFT_DIR) fclean
.PHONY: re
re: fclean all
CMD_LINE_ARG = eval_tests/test_maps/42.fdf
run: all
-norminette
@echo "\033[0;31mWARNING: norminette errors possibly IGNORED\033[0m\n"
./fdf $(CMD_LINE_ARG)
.PHONY: debug
debug: CC_FLAGS := $(CC_FLAGS) -g
debug: NAME := $(NAME)-debug
debug: all-debug