-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
151 lines (133 loc) · 4.21 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
##
## EPITECH PROJECT, 2022
## Makefile
## File description:
## Makefile (version: 2.1.0)
##
## ? system value
###########################################
INC_FLAGS = -I./include
CFLAGS = $(INC_FLAGS)
EpiTools_PATH = path-to/EpiTools
CODING_STYLE_CODE_LOCATION = path-to/coding-style-checker/coding-style.sh
PROGRAM_NAME = ExempleProgramName
## ! WARNING: do not modify, this part of the Makefile
## ! (this part is auto-generated by EpiForge from EpiTools)
## ? compilation file list
############################################
SRC = program_main.c \
src/exemple_system/exemple_file.c
TESTS =
############################################
OBJ = $(SRC:.c=.o)
TESTS_OBJ = $(TESTS:.c=.o)
###########################################
## ? basic compilation code
############################################
all: $(OBJ) ./main.o
@echo "Default Compiling..."
@echo "-------------------------------------------"
-@gcc $(INC_FLAGS) -o $(PROGRAM_NAME) $(OBJ) ./main.o
@echo "-------------------------------------------"
@echo ""
debug: $(OBJ)
@echo "Compiling with debug flags..."
@echo "-------------------------------------------"
-@gcc $(INC_FLAGS) -g -o debug $(SRC) ./main.c
@echo "-------------------------------------------"
@echo ""
############################################
## ? clean rules
############################################
clean:
@echo "Cleaning object files..."
@rm -f $(OBJ:.o=.gcno)
@rm -f $(OBJ:.o=.gcda)
@rm -f $(OBJ)
@rm -f ./main.o
@rm -f ./*.gcno
@rm -f ./*.gcda
fclean: clean
@echo "Cleaning binary files..."
@rm -f ./$(PROGRAM_NAME)
@rm -f ./debug
############################################
## ? recompile rule
############################################
re: fclean all
############################################
## ? EpiTools
############################################
.ONESHELL:
generate:
@echo "Regenerating Makefile..."
@echo "-------------------------------------------"
@if python3 $(EpiTools_PATH)/EpiForge.py ; then \
: ; \
else \
echo "cannot execute because of error"; \
fi
@echo "-------------------------------------------"
@echo ""
check_functions:
@echo "Checking functions..."
@echo "-------------------------------------------"
@if python3 $(EpiTools_PATH)/EpiCheck.py ; then \
: ; \
else \
echo "cannot execute because of error"; \
fi
@echo "-------------------------------------------"
@echo ""
check_style:
@echo "Checking coding style..."
@echo "-------------------------------------------"
@echo "scanning files..."
@$(CODING_STYLE_CODE_LOCATION) . . >/dev/null 2>&1
@echo "parsing logs..."
@echo ""
@python3 $(EpiTools_PATH)/EpiStyle.py ./coding-style-reports.log
@rm ./coding-style-reports.log
@echo "-------------------------------------------"
@echo ""
check_memory: fclean debug
@echo "Running memory tests..."
@echo "-------------------------------------------"
@if valgrind --tool=memcheck --leak-check=full --error-exitcode=1 \
./debug your_arguments ; then \ # ! replace your_arguments by your program arguments to tests
cat valgrind-reports.log; \
else \
echo "cannot execute because of error"; \
fi
@rm -f valgrind-reports.log
@echo "-------------------------------------------"
@echo ""
check_coverage: $(OBJ)
@echo "Running coverage tests..."
@echo "-------------------------------------------"
@if gcc -fno-builtin -W -Wall -o ./test.out $(OBJ) $(TESTS) \
--coverage -lcriterion; then \
./test.out; \
gcovr --exclude tests/; \
else \
echo "cannot execute because of error"; \
fi
@echo "-------------------------------------------"
@echo ""
############################################
## ? marvin integration
############################################
tests_run:
@gcc $(INC_FLAGS) -fno-builtin -W -Wall -o ./debug $(SRC) $(TESTS) \
--coverage -lcriterion -L/opt/homebrew/lib
@ ./debug
@gcovr --exclude tests/
marvin_env:
@echo "executing marvin environment..."
@echo "-------------------------------------------"
docker run --rm -it -v "$(shell pwd)":/test/ \
-w /test epitechcontent/epitest-docker zsh
@echo "-------------------------------------------"
@echo ""
############################################
.PHONY: all clean flcean re tests_run tests coverage style debug