-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (63 loc) · 2.14 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jrocha-v <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/05/25 10:36:01 by jrocha-v #+# #+# #
# Updated: 2023/10/31 16:01:28 by jrocha-v ### ########.fr #
# #
# **************************************************************************** #
NAME = fdf
SRCS_DIR = src
OBJS_DIR = objs
INCLUDES = includes
LIBFT = ./libs/libft/libft.a
LIBFT_DIR = ./libs/libft
LIBMLX = ./libs/minilibx-linux/libmlx.a
LIBMLX_DIR = ./libs/minilibx-linux
CC = cc
CFLAGS = -Wall -Wextra -Werror
MLX_FLAGS = -lmlx_Linux -lXext -lX11 -lm -lbsd
MK_FLAG = --no-print-directory
RM = rm -rf
SRCS = fdf_main.c \
fdf_events1.c \
fdf_events2.c \
fdf_map.c \
fdf_draw.c \
fdf_color.c \
fdf_transf1.c \
fdf_transf2.c \
fdf_utils.c \
fdf_error.c
# Substitute .c with .o
OBJS = $(SRCS:%.c=$(OBJS_DIR)/%.o)
#default target
all: $(NAME)
$(NAME): $(OBJS) $(LIBFT) $(LIBMLX)
$(CC) $(CFLAGS) $(OBJS) -L$(LIBMLX_DIR) $(MLX_FLAGS) $(LIBFT) -o $(NAME)
echo "Finished!"
#create .o files
$(OBJS_DIR)/%.o: $(SRCS_DIR)/%.c
mkdir -p $(@D)
$(CC) -I $(INCLUDES) $(CFLAGS) -c $< -o $@
$(LIBFT):
echo "Compiling necessary libs..."
$(MAKE) $(MK_FLAG) -C $(LIBFT_DIR)
$(LIBMLX):
echo "Compiling necessary libs..."
$(MAKE) $(MK_FLAG) -C $(LIBMLX_DIR)
#remove .o files
clean:
$(RM) $(OBJS_DIR)
$(MAKE) clean -C $(LIBFT_DIR)
$(MAKE) clean -C $(LIBMLX_DIR)
fclean: clean
$(RM) $(NAME) $(LIBFT) $(LIBMLX)
#reset - remove and recompile
re: fclean
$(MAKE) all
.PHONY: all clean fclean re
.SILENT: