-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (78 loc) · 2.96 KB
/
Copy pathMakefile
File metadata and controls
95 lines (78 loc) · 2.96 KB
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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: asuc <asuc@student.42angouleme.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/08/12 17:42:16 by asuc #+# #+# #
# Updated: 2024/02/01 21:04:42 by asuc ### ########.fr #
# #
# **************************************************************************** #
BGreen = $(shell echo "\033[1;32m")
RESET = $(shell echo "\033[0m")
BRed = $(shell echo "\033[1;31m")
BCyan = $(shell echo "\033[1;36m")
Green = $(shell echo "\033[0;32m")
NAME = fractol
COMP = clang
CFLAGS = -Wall -Werror -Wextra
libft = Libft/
SRC = srcs/color.c \
srcs/fractol.c \
srcs/hook_key.c \
srcs/iter_change.c \
srcs/mandelbrot.c \
srcs/moves.c \
srcs/zoom.c \
srcs/julia.c \
srcs/burningship.c \
srcs/pixel_change.c \
srcs/change_color.c \
srcs/utils.c \
srcs/fractol_utils.c \
srcs/fractol_color.c \
srcs/check_input.c \
srcs/error.c
MacroLibX = MacroLibX/
# on ajoute un message jsute avant de faire la compilation de tout les OBJ
OBJ = $(SRC:.c=.o)
TOTAL = $(words $(OBJ))
CURR = 0
define update_progress
$(eval CURR=$(shell echo $$(($(CURR)+1))))
@echo -n "\033[1A\033[K"
@echo -n "$(Green)[`echo "scale=2; $(CURR)/$(TOTAL)*100" | bc`%] Compiling $< \n$(RESET)"
endef
all : $(NAME)
%.o : %.c
@if [ $(CURR) -eq 0 ]; then \
echo "\n$(BCyan)Compiling object files for $(NAME)...$(RESET)\n"; \
fi
@$(COMP) -gdwarf-4 -fPIE $(CFLAGS) -o $@ -c $<
@$(B)
@$(call update_progress)
start :
@echo "$(BCyan)Compilation Start$(NAME)$(RESET)\n\n"
$(NAME) : $(OBJ)
@make --quiet --no-print-directory -C $(libft)
@make --quiet --no-print-directory -j -C $(MacroLibX)
@cp $(libft)libft.a libft.a
@clang -gdwarf-4 -fPIE $(CFLAGS) -o $(NAME) $(OBJ) libft.a MacroLibX/libmlx.so -lSDL2 -lm
@echo "\n$(BGreen)Compilation Final $(NAME)$(RESET)"
clean :
@make clean --quiet --no-print-directory -C $(libft)
@make clean --quiet --no-print-directory -C $(MacroLibX)
@rm -f $(OBJ)
@echo "$(BRed)Erase all .o files$(RESET)"
fclean : clean
@make fclean --quiet --no-print-directory -C $(libft)
@make fclean --quiet --no-print-directory -C $(MacroLibX)
@rm -f $(NAME) libft.a
@echo "$(BRed)Erase $(NAME), libft.a and $(MacroLibX)$(RESET)"
test : re
@./$(NAME) mandelbrot
valrindTest : all
@valgrind --suppressions=MacroLibX/valgrind.supp --leak-check=full --show-reachable=yes ./$(NAME) julia
re : fclean all
.PHONY: all fclean clean re