-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (69 loc) · 2.46 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
89
90
91
92
93
94
95
96
97
98
99
100
101
##
## EPITECH PROJECT, 2019
## PSU_mysh_2019
## File description:
## Makefile
##
SUCCESS = /bin/echo -e "\x1b[1m\x1b[33m\#\#\x1b[32m $1\x1b[0m"
WARNING = /bin/echo -e "\x1b[1m\x1b[33m\#\#\x1b[33m $1\x1b[0m"
ATTENTION = /bin/echo -e "\x1b[1m\x1b[33m\#\#\x1b[31m $1\x1b[0m"
ERROR = /bin/echo -e "\x1b[1m\x1b[33m\#\#\x1b[31m $1\x1b[0m"
DONE = /bin/echo -e "\x1b[1m\x1b[33m\#\#\x1b[34m $1\x1b[0m"
## ========================================================================== ##
PATH_INIT = ./sources/initialisation/
INIT = basics.c \
main.c
## ========================================================================== ##
PATH_ERROR = ./sources/error/
ERROR = error_handling.c \
## ========================================================================== ##
PATH_PROCESS = ./sources/process/
PROCESS = shell_loop.c \
process_fct.c \
process_ftc2.c
## ========================================================================== ##
PATH_DISPLAY = ./sources/display/
DISPLAY = display_prompt.c
## ========================================================================== ##
SRC = $(addprefix $(PATH_INIT), $(INIT)) \
$(addprefix $(PATH_ERROR), $(ERROR)) \
$(addprefix $(PATH_PROCESS), $(PROCESS)) \
$(addprefix $(PATH_DISPLAY), $(DISPLAY))
.PHONY: all, fclean, clean, re, library, tests_run
BIN = mysh
CC = @gcc
INCLUDE_DIR = ./include
CFLAGS = -g -I./include/ -D_GNU_SOURCE
LDFLAGS = -lm -lcsfml-graphics -lcsfml-window -lcsfml-system -lcsfml-audio
FLAGS = $(CFLAGS) -I$(INCLUDE_DIR) -lm -L./lib -lmy -Llib -lmy_printf
UT_SRC = $(SRC)
UT_OBJ = $(UT_SRC:.c=.o)
UT_FLAGS = $(CFLAGS) -lcriterion -lgcov --coverage $(FLAGS)
all: library $(BIN)
library:
@$(MAKE) -C ./lib/my/
@$(MAKE) -C ./lib/my_printf/
$(BIN): $(SRC)
@$(CC) -o $(BIN) $(SRC) $(FLAGS) $(LDFLAGS) $(CFLAGS)
@$(call SUCCESS, "The binary has been created correctly.")
clean: clean_lib_obj
@$(RM) *.vgcore
@$(RM) *.gc*
@$(call DONE, "[ DONE 100% ]")
clean_lib:
@$(MAKE) clean_lib -C ./lib/my/
@$(MAKE) clean_lib -C ./lib/my_printf/
clean_lib_obj:
@$(MAKE) clean -C ./lib/my/
@$(MAKE) clean -C ./lib/my_printf/
fclean: clean clean_lib
@$(RM) $(BIN)
@$(call SUCCESS, "[ DONE ] All library cleaned.")
re: fclean all
run:
./$(BIN) game_map/game
valgrind:
valgrind ./$(BIN) game_map/game
tests_run:
gcc -o $(UT_FLAGS) $(UT_OBJ)
./units