-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
86 lines (71 loc) · 2.33 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jsebasti <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/11/12 17:21:25 by jsebasti #+# #+# #
# Updated: 2023/04/13 18:07:20 by jsebasti ### ########.fr #
# #
# **************************************************************************** #
NAME = fdf
INC_DIR = inc/
MKFL = Makefile
OBJ_DIR = obj/
# ----Libraryes----
PW_HEADER = $(INC_DIR)/fdf.h
LIB = Libs/Libft/libft.a
LIB_M = Libs/Libft/
PRINTF = Libs/printf/libftprintf.a
PRINTF_M = Libs/printf/
MLX = Libs/minilibx_macos/libmlx.a
MLX_M = Libs/minilibx_macos
# =============
# -------------
RM = rm -rf
MP = mkdir -p
CFLAGS = -Werror -Wextra -Wall -O2 #-fsanitize=address
MLX_FLAGS = -lmlx -L $(MLX_M) -framework OpenGL -framework AppKit
LIBC = ar -rcs
# =============
SRC = src/fdf.c \
src/fdf_utils.c \
src/draw_map.c \
src/draw_utils.c \
src/draw_utils2.c \
src/rotations.c \
src/read_and_load.c \
src/init_and_views.c \
src/dyn_rot.c \
src/events_and_redraw.c \
# -------------
OBJ = $(addprefix $(OBJ_DIR), $(SRC:.c=.o))
DEP = $(addsuffix .d, $(basename $(OBJ)))
# =============
$(OBJ_DIR)%.o: %.c $(MKFL)
@$(MP) $(dir $@)
$(CC) $(CFLAGS) -Imlx -MMD -I $(INC_DIR) -c $< -o $@
all:
@$(MAKE) -C $(MLX_M)
@$(MAKE) -C $(LIB_M)
@$(MAKE) -C $(PRINTF_M)
@$(MAKE) $(NAME)
$(NAME):: $(OBJ) $(LIB) $(PRINTF) $(MLX)
$(CC) $(CFLAGS) $(MLX_FLAGS) $(OBJ) $(LIB) $(PRINTF) $(MLX) -o $(NAME)
$(NAME)::
@echo "Hello, FdF already compiled 😇"
-include $(DEP)
clean:
@$(MAKE) clean -C $(LIB_M)
@$(MAKE) clean -C $(PRINTF_M)
@$(MAKE) clean -C $(MLX_M)
$(RM) $(OBJ_DIR)
fclean: clean
@$(MAKE) fclean -C $(LIB_M)
@$(MAKE) fclean -C $(PRINTF_M)
$(RM) $(NAME)
re:
@$(MAKE) fclean
@$(MAKE)
.PHONY: all clean fclean re