-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (56 loc) · 2.06 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: sleonard <sleonard@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/11/05 16:40:18 by sleonard #+# #+# #
# Updated: 2019/12/26 14:00:22 by sleonard ### ########.fr #
# #
# **************************************************************************** #
# PROJECT #
NAME = sleonard.filler
# DIRECTORIES #
SRC_DIR = ./sources/
LIB_DIR = ./libft/
LIB_PRINTF = ./libft/ft_printf/
OBJ_DIR = ./obj/
SRC_INC_DIR = ./includes/
LIB_INC_DIR = ./libft/includes
# FLAGS #
CFLGS = -Wall -Wextra -Werror
LFLGS = -L$(LIB_PRINTF) -lftprintf -L$(LIB_DIR) -lft
CC = clang
# LIBFT #
LIBFT = $(LIB_DIR)/libft.a
# SOURCES AND HEADERS #
SRC_FILES = algo.c block_parsing.c error.c main.c map_parsing.c \
map_processing.c parsing.c safe_malloc.c utils.c
SRCS = $(addprefix $(SRC_DIR), $(SRC_FILES))
OBJS = $(patsubst $(SRC_DIR)%.c,$(OBJ_DIR)%.o, $(SRCS))
DEPS = $(OBJS:.o=.d)
# INCLUDES #
INCL = -I$(SRC_INC_DIR) -I$(LIB_INC_DIR)
# RULES #
.PHONY: all clean fclean re
all: update $(OBJ_DIR) $(NAME)
update:
@git submodule init
@git submodule update --merge --remote
-include: $(DEPS)
$(OBJ_DIR)%.o: $(SRC_DIR)%.c | $(OBJ_DIR)
$(CC) $(CFLGS) -c -o $@ $< $(INCL)
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
$(LIBFT):
$(MAKE) -C $(LIB_DIR)
$(NAME): $(OBJS) $(LIBFT)
$(CC) $(CFLGS) -o $(NAME) $(OBJS) $(INCL) $(LFLGS)
clean:
rm -rf $(OBJ_DIR)
$(MAKE) -C $(LIB_DIR) clean
fclean: clean
rm -rf $(NAME)
$(MAKE) -C $(LIB_DIR) fclean
re: fclean all