-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
148 lines (123 loc) · 3.11 KB
/
Makefile
File metadata and controls
148 lines (123 loc) · 3.11 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
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
##
## EPITECH PROJECT, 2024
## Project
## File description:
## Makefile
##
.PHONY: all clean fclean re lib unit_tests tests_run coverage
SRC = src/main.c \
src/dyna_champ.c \
src/destroy_champ.c \
src/dump.c \
src/dyna_process.c \
src/destroy_process.c \
src/destroy_corewar.c \
src/get_champ_index.c \
src/get_value.c \
src/get_value_mod.c \
src/op.c \
src/sort_champs_by_id.c \
src/commands/add.c \
src/commands/aff.c \
src/commands/and.c \
src/commands/fork.c \
src/commands/lfork.c \
src/commands/ld.c \
src/commands/ldi.c \
src/commands/live.c \
src/commands/lld.c \
src/commands/lldi.c \
src/commands/or.c \
src/commands/st.c \
src/commands/sti.c \
src/commands/sub.c \
src/commands/xor.c \
src/commands/zjump.c \
src/opcode/opcode.c \
src/parser/check_collisions.c \
src/parser/get_default_corewar.c \
src/parser/multiple_free_areas.c \
src/parser/one_free_area.c \
src/parser/parse_file.c \
src/parser/parser.c \
src/parser/set_champs_pc.c \
src/parser/sort_free_areas.c \
src/parser/sort_unset_champs.c \
src/parser/write_champs_in_arena.c \
NO_BONUS_SRC = src/corewar.c
BONUS_SRC = bonus/display.c \
bonus/bonus_corewar.c
TEST_SRC = src/dyna_champ.c \
src/destroy_champ.c \
src/dump.c \
src/dyna_process.c \
src/destroy_process.c \
src/destroy_corewar.c \
src/get_champ_index.c \
src/get_value.c \
src/get_value_mod.c \
src/op.c \
src/sort_champs_by_id.c \
src/commands/add.c \
src/commands/aff.c \
src/commands/and.c \
src/commands/fork.c \
src/commands/lfork.c \
src/commands/ld.c \
src/commands/ldi.c \
src/commands/live.c \
src/commands/lld.c \
src/commands/lldi.c \
src/commands/or.c \
src/commands/st.c \
src/commands/sti.c \
src/commands/sub.c \
src/commands/xor.c \
src/commands/zjump.c \
src/opcode/opcode.c \
src/parser/check_collisions.c \
src/parser/get_default_corewar.c \
src/parser/multiple_free_areas.c \
src/parser/one_free_area.c \
src/parser/parse_file.c \
src/parser/parser.c \
src/parser/set_champs_pc.c \
src/parser/sort_free_areas.c \
src/parser/sort_unset_champs.c \
src/parser/write_champs_in_arena.c \
src/corewar.c
TEST_FILE = tests/test_corewar.c
OBJ = $(SRC:.c=.o)
BONUS_OBJ = $(BONUS_SRC:.c=.o)
NO_BONUS_OBJ = $(NO_BONUS_SRC:.c=.o) $(OBJ)
NAME = corewar
CFLAGS = -I./include
LIBS = -L lib/my -lmy
BONUS_LIBS = -L lib/my -lmy -lncurses
ERRORSFLAGS = -W -Wall -Werror -Wextra
all: lib $(NAME)
lib:
$(MAKE) -C lib/my
$(NAME): $(NO_BONUS_OBJ)
gcc $(ERRORSFLAGS) -o $(NAME) $(CFLAGS) $(NO_BONUS_OBJ) $(LIBS)
bonus: lib $(OBJ) $(BONUS_OBJ)
gcc $(ERRORSFLAGS) -o $(NAME) $(CFLAGS) $(OBJ) $(BONUS_OBJ) $(BONUS_LIBS)
unit_tests: lib
gcc -o unit_tests $(CFLAGS) $(TEST_SRC) $(TEST_FILE) $(LIBS) \
--coverage -lcriterion
tests_run: unit_tests
./unit_tests
coverage: tests_run
gcovr --exclude ./tests
gcovr --exclude ./tests --txt-metric=branch
clean:
rm -f $(OBJ)
rm -f $(BONUS_OBJ)
rm -f $(NO_BONUS_OBJ)
rm -f *.gcno
rm -f *.gcda
rm -f unit_tests
fclean: clean
rm -f $(NAME)
$(MAKE) -C lib/my fclean
re: fclean all