-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
58 lines (43 loc) · 1.4 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
GREEN = \033[0;32m
RED = \033[0;31m
RESET = \033[0m
CC = cc
CFLAGS = -Wall -Werror -Wextra
LIBFT_PATH = include/libft
MLX_PATH = include/minilibx
SRC_DIR = src
OBJ_DIR = obj
INCLUDE_DIR = include
SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
OBJ_FILES = $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRC_FILES))
LIBFT = $(LIBFT_PATH)/libft.a
MLX = $(MLX_PATH)/libmlx.a
NAME = fractol
all: $(NAME)
$(NAME): $(OBJ_FILES) $(LIBFT) $(MLX)
@$(CC) $(CFLAGS) -o $@ $^ -L$(LIBFT_PATH) -lft -L$(MLX_PATH) -lmlx -framework OpenGL -framework AppKit
@echo "$(NAME): $(GREEN)object files were created$(RESET)"
@echo "$(NAME): $(GREEN)$(NAME) was created$(RESET)"
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(OBJ_DIR)
@$(CC) $(CFLAGS) -I$(INCLUDE_DIR) -I$(LIBFT_PATH) -I$(MLX_PATH) -c -o $@ $<
@echo "$(NAME): $(GREEN)$(OBJ_DIR) was created$(RESET)"
$(LIBFT):
@$(MAKE) -C $(LIBFT_PATH)
@echo "$(NAME): $(GREEN)$(LIBFT) was created$(RESET)"
$(MLX):
@$(MAKE) -C $(MLX_PATH)
@echo "$(NAME): $(GREEN)$(MLX) was created$(RESET)"
clean:
@$(MAKE) -C $(LIBFT_PATH) clean
@$(MAKE) -C $(MLX_PATH) clean
@rm -r $(OBJ_DIR)
@echo "$(NAME): $(RED)$(OBJ_DIR) was deleted$(RESET)"
@echo "$(NAME): $(RED)object files were deleted$(RESET)"
fclean: clean
@$(MAKE) -C $(LIBFT_PATH) fclean
@echo "$(NAME): $(RED)$(LIBFT) was deleted$(RESET)"
@rm $(NAME)
@echo "$(NAME): $(RED)$(NAME) was deleted$(RESET)"
re: fclean all
.PHONY: all clean fclean re