-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·76 lines (63 loc) · 2.26 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jaleman <jaleman@student.42.us.org> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2017/02/21 15:56:04 by jaleman #+# #+# #
# Updated: 2017/02/21 15:56:05 by jaleman ### ########.fr #
# #
# **************************************************************************** #
# Name of the program
NAME = fractol
# Compiling flags
FLAGS = -Wall -Wextra -Werror -g
# Folders
SRC_DIR = ./srcs/
OBJ_DIR = ./obj/
INC_DIR = ./includes/
LIBFT_DIR = ./libft/
MINLBX_DIR = ./minilibx/
# Source files and object files
SRC_FILES = main.c fractol_control.c fractol_draw.c \
fractol_fractals.c fractol_bonus.c
OBJ_FILES = $(SRC_FILES:.c=.o)
# Paths
SRC = $(addprefix $(SRC_DIR), $(SRC_FILES))
OBJ = $(addprefix $(OBJ_DIR), $(OBJ_FILES))
LIBFT = $(addprefix $(LIBFT_DIR), libft.a)
MINLBX = $(addprefix $(MINLBX_DIR), libmlx.a)
# Libft and Minilibx linkers
LNK = -L $(LIBFT_DIR) -lft -L $(MINLBX_DIR) \
-Ofast -lmlx -framework OpenGL -framework AppKit
# all rule
all: obj $(LIBFT) $(MINLBX) $(NAME)
obj:
@mkdir -p $(OBJ_DIR)
$(OBJ_DIR)%.o:$(SRC_DIR)%.c
@gcc $(FLAGS) -I $(MINLBX_DIR) -I $(LIBFT_DIR) -I $(INC_DIR) -o $@ -c $<
$(LIBFT):
@make -C $(LIBFT_DIR)
$(MINLBX):
@make -C $(MINLBX_DIR)
# Compiling
$(NAME): $(OBJ)
@echo "(ノ◕ヮ◕)ノ*:・゚✧ Compiling... Wait a sec."
@gcc $(OBJ) $(LNK) -lm -o $(NAME)
@echo "(•̀ᴗ•́)و $(NAME) generated!"
# clean rule
clean:
@rm -Rf $(OBJ_DIR)
@make -C $(LIBFT_DIR) clean
@make -C $(MINLBX_DIR) clean
@echo "¯\_(ツ)_/¯ Objects removed!"
# fclean rule
fclean: clean
@rm -f $(NAME)
@make -C $(LIBFT_DIR) fclean
@echo "(╯°□°)╯︵ ┻━┻ $(NAME) removed!"
# re rule
re: fclean all
# phony
.PHONY: all clean fclean re