-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
112 lines (79 loc) · 2.27 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
##
## EPITECH PROJECT, 2023
## Makefiles
## File description:
## solostumper
##
MAIN = main.c \
ARENA = src/arena.c \
BONUS = bonus/print_arena.c \
SRC = src/error_handling.c \
src/open_file.c \
src/corewar.c \
src/load_in_arena.c \
PARSING = src/parsing/parsing.c \
src/parsing/champion_parsing.c \
src/parsing/organized_champs.c \
src/parsing/sort_champions.c \
INSTRUCTION = src/instruct/parse_instruct.c \
src/instruct/op.c \
src/instruct/actions_instruction.c \
src/instruct/cond_instruction.c \
src/instruct/load_instruction.c \
src/instruct/no_coding_byte_instruction.c \
src/instruct/parse_param_from_arena.c \
src/instruct/my_uint8_ndup.c \
src/instruct/my_corcpy.c \
src/instruct/change_carry.c \
SRCTEST = tests/test.c \
OBJ = $(MAIN:.c=.o) $(ARENA:.c=.o) $(SRC:.c=.o) $(PARSING:.c=.o)\
$(INSTRUCTION:.c=.o)
OBJTEST = $(SRCTEST:.c=.o)
OBJBONUS = $(MAIN:.c=.o) $(BONUS:.c=.o) $(SRC:.c=.o) $(PARSING:.c=.o)\
$(INSTRUCTION:.c=.o)
NAME = corewar
NAMEBONUS = corewar_bonus
NAMETEST = unit_tests
CFLAGS = -Wall -Wextra -g3
CPPFLAGS = -I./include
LDFLAGS = -L./lib/my
LDLIBS = -lmy
CC = gcc
all: buildlib $(NAME)
$(NAME): $(OBJ)
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
bonus: buildlib $(OBJBONUS)
$(CC) $(LDFLAGS) -o $(NAMEBONUS) $(OBJBONUS) $(LDLIBS) -lncurses
buildlib:
make -C ./lib/my
buildlibtest:
make -C ./lib/my CFLAGS='$(CFLAGS) --coverage'
buildtest: CFLAGS += --coverage
buildtest: buildlibtest $(OBJTEST)
$(CC) $(LDFLAGS) -o $(NAMETEST) $(OBJTEST) $(LDLIBS) \
--coverage -lcriterion
clean:
rm -f $(OBJ)
find . -name "*~" -delete
find . -name "#*#" -delete
find . -name "vgcore*" -delete
find . -name "*.gcno" -delete
find . -name "*.gcda" -delete
find . -name "*.gcov" -delete
find . -name "coding-style-reports.log" -delete
fclean: clean cleantest
rm -f $(NAME)
rm -f $(NAMEBONUS)
make fclean -C ./lib/my
cleantest:
rm -f $(NAMETEST)
rm -f $(OBJTEST)
re: fclean all
valgrind: buildlib $(OBJ)
$(CC) -g3 $(LDFLAGS) -o $(NAME) $(OBJ) $(LDLIBS)
unit_tests: buildtest
run_tests:
./unit_tests
gcovr
.PHONY: all clean fclean re valgrind unit_tests run_tests cleantest
buildlibtest buildtest buildlib