-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
88 lines (70 loc) · 1.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
#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/
# Sources
SRC_PATH = src/
SRC = fractol.c \
initialization.c \
utils.c \
events.c \
render.c \
color.c \
parse_args.c \
help_msg.c \
fractal_sets/mandelbrot.c \
fractal_sets/julia.c \
fractal_sets/burning_ship.c \
fractal_sets/tricorn.c \
fractal_sets/mandelbox.c \
color_schemes/color_interpolated.c \
color_schemes/color_special.c \
color_schemes/color_striped.c
SRCS = $(addprefix $(SRC_PATH), $(SRC))
# Objects
OBJ_PATH = obj/
OBJ = $(SRC:.c=.o)
OBJS = $(addprefix $(OBJ_PATH), $(OBJ))
all: $(MLX) $(LIBFT) $(NAME)
$(OBJ_PATH)%.o: $(SRC_PATH)%.c
@$(CC) $(CFLAGS) -c $< -o $@ $(INC)
$(OBJS): $(OBJ_PATH)
$(OBJ_PATH):
@mkdir $(OBJ_PATH)
@mkdir $(OBJ_PATH)fractal_sets/
@mkdir $(OBJ_PATH)color_schemes/
$(MLX):
@echo "Making MiniLibX..."
@make -sC $(MLX_PATH)
$(LIBFT):
@echo "Making libft..."
@make -sC $(LIBFT_PATH)
$(NAME): $(OBJS)
@echo "Compiling fractol..."
@$(CC) $(CFLAGS) -o $(NAME) $(OBJS) $(MLX) $(LIBFT) $(INC) -lXext -lX11 -lm
@echo "Fractol ready."
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
.PHONY: all re clean fclean