-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
112 lines (88 loc) · 2.62 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: mvomiero <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/02/20 15:13:55 by mvomiero #+# #+# #
# Updated: 2023/03/02 18:03:51 by mvomiero ### ########.fr #
# #
# **************************************************************************** #
#Program name
NAME = fractol
# Compiler
CC = gcc
CFLAGS = -Werror -Wextra -Wall
# Minilibx
MLX_PATH = minilibx-linux/
MLX_NAME = libmlx.a
MLX = $(MLX_PATH)$(MLX_NAME)
# Libft
LIBFT_PATH = libft/
LIBFT_NAME = libft.a
LIBFT = $(LIBFT_PATH)$(LIBFT_NAME)
# Includes
INC = -I ./includes/\
-I ./libft/\
-I ./minilibx-linux/
HEADERS = ./includes/
# Sources
SRC_PATH = src/
SRC = exit.c \
fractol.c \
initialization.c \
msg.c \
parsing_args.c \
utils.c \
fract_mandelbrot.c \
render.c \
key_events.c \
color.c \
color_utils.c \
fract_julia.c \
mouse_events_zoom.c
SRCS = $(addprefix $(SRC_PATH), $(SRC))
# Objects
OBJ_PATH = obj/
OBJ = $(SRC:.c=.o)
OBJS = $(addprefix $(OBJ_PATH), $(OBJ))
all: $(MLX) $(LIBFT) $(OBJ_PATH) $(NAME)
$(NAME): $(OBJS)
@echo "Compiling fractol..."
@-$(CC) $(CFLAGS) -o $(NAME) $(OBJS) $(LIBFT) $(MLX) $(INC) -lXext -lX11 -lm
@echo "\n\t\033[35;1;3mFractol ready\033[0m\n"
$(OBJ_PATH)%.o: $(SRC_PATH)%.c
# @echo "Compiling object files"
@$(CC) $(CFLAGS) -c $< -o $@ $(INC)
$(OBJ_PATH):
@echo "Generating obj folder"
@mkdir $(OBJ_PATH)
$(MLX):
@echo "Making MiniLibX..."
@make -sC $(MLX_PATH)
$(LIBFT):
@echo "Making libft..."
@make -sC $(LIBFT_PATH)
bonus: all
clean:
@echo "Removing .o object files..."
@rm -rf $(OBJ_PATH)
@make clean -C $(MLX_PATH)
@make clean -C $(LIBFT_PATH)
fclean: clean
@echo "Removing fractol..."
@rm -f $(NAME)
@rm -f $(LIBFT_PATH)$(LIBFT_NAME)
re: fclean all
valgrind:
valgrind --leak-check=full --track-origins=yes --show-leak-kinds=all \
./fractol
man:
man minilibx-linux/man/man1/mlx.1
run: all
./fractol mandelbrot
norminette_check:
norminette ./src
norminette -R CheckForbiddenSourceHeader ./includes
.PHONY: all re clean fclean