-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·89 lines (77 loc) · 2.03 KB
/
Makefile
File metadata and controls
executable file
·89 lines (77 loc) · 2.03 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
NAME = game_2048
SRC = main.c design.c displacement.c
OBJ = $(SRC:.c=.o)
FLG = -Wall -Wextra -Werror -g3
INC = -I libft/includes/
RED = \033[0;31m
GREEN = \033[1;32m
BLUE = \033[0;34m
CYAN = \033[0;36m
CYAN_L = \033[1;36m
NC = \033[0m
HOME = "`echo $HOME`"
VALGRIND = "$(HOME)/valgrind/bin/valgrind --leak-check=full --tool=memcheck --dsymutil=yes --show-leak-kinds=all"
LIBS= -L libft/ -lft -lncurses
$(NAME): $(OBJ)
@echo "$(GREEN)== Make ==$(PURPLE)"
make -C libft
gcc $(FLG) $(INC) -c $(SRC)
gcc -o $(NAME) $(OBJ) $(LIBS)
@echo "$(GREEN)== End of compilation ==$(NC)"
all: $(NAME)
$(OBJ): $(SRC)
gcc $(FLG) $(INC) -c $(SRC)
clean:
@echo "\n $(GREEN)== Clean ==$(CYAN)"
@echo " - rm all libft/.o"
@make -C libft clean
@rm -f $(OBJ)
@echo " - rm all .o"
@echo " $(GREEN)== End of clean ==$(NC)"
fclean:
@echo "\n$(GREEN)== Fclean ==$(CYAN_L)"
make clean
@echo "$(CYAN_L)"
make -C libft fclean
@rm -rf libft.a
rm -f $(NAME)
@echo "$(GREEN)== End of fclean ==$(NC)\n"
re: fclean all
debug: fclean
@echo "\n$(GREEN)== Debug ==$(PURPLE)"
make -C libft give
cc $(FLG) $(INC) -c -g $(SRC)
cc -o $(NAME) $(OBJ) $(LIBS)
@echo "$(GREEN)== End of compilation ==$(NC)\n"
leacks:
while (test 42) do clear; leaks $(NAME); sleep 5; done
mn:
ifeq ($(N),)
@echo "\n\n$(RED)Give me a N guy! (make mn N=42)$(NC)\n"
else
@echo "\n$(GREEN)Load main$(N).z$(NC)"
rm -f main.c; cp main$(N).z main.c
make debug
endif
thread:
ifeq ($(T),)
@echo "\n\n$(RED)Give me a T guy! (make thread T=42)$(NC)\n"
else
ifeq ($(P),)
@echo "\n\n$(RED)Give me a P guy! (make thread T=42 P=/Applications)$(NC)\n"
else
@echo "\n$(GREEN)Iniatialisation du thread $(T)$(PURPLE)"
make mn N=1 && cp $(NAME) $(NAME)_$(T) && sleep 1 && clear
@echo "$(GREEN)== End of compilation ==$(NC)"
./$(NAME)_$(T) -laR $(P)
rm -f $(NAME)_$(T)
make fclean
endif
endif
leacksn:
ifeq ($(N),)
@echo "\n\n$(RED)Give me a N guy! (make leacksn N=42)$(NC)\n"
else
while (test 42) do clear; leaks $(NAME)_$(N); sleep 5; done
endif
.PHONY: all NAME debug clean fclean re