-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·174 lines (135 loc) · 4.19 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
##
## EPITECH PROJECT, 2022
## Makefile
## File description:
## Makefile
##
TEST_NAME = unit_tests
TEST = tests
BASE_ASM = ./asm
PARSING = ./asm/parsing
BODY = ./body
HEADER = ./header
COMPILER = ./asm/compiler
INIT = ./asm/init
DESTROY = ./asm/destroy
TRANSCRIPTION += ./asm/transcription
PARAMETER_BYTE += ./asm/transcription/parameters
DEBUG += ./asm/debug/
SRC_ASM += $(BASE_ASM)/main.c
SRC_ASM += $(PARSING)/detect_file_extesion.c
SRC_ASM += $(PARSING)/parse_reference_file.c
SRC_ASM += $(PARSING)/$(HEADER)/parse_header.c
SRC_ASM += $(PARSING)/$(HEADER)/utils_header.c
SRC_ASM += $(PARSING)/$(BODY)/get_body.c
SRC_ASM += $(PARSING)/$(BODY)/check_nb_arguments.c
SRC_ASM += $(PARSING)/$(BODY)/check_type_arguments.c
SRC_ASM += $(PARSING)/$(BODY)/add_label_to_link.c
SRC_ASM += $(PARSING)/$(BODY)/check_params.c
SRC_ASM += $(PARSING)/$(BODY)/create_champ.c
SRC_ASM += $(PARSING)/$(BODY)/check_index.c
SRC_ASM += $(COMPILER)/compiler.c
SRC_ASM += $(COMPILER)/create_cor.c
SRC_ASM += $(COMPILER)/write_into_cor.c
SRC_ASM += $(INIT)/init_asm.c
SRC_ASM += $(DESTROY)/free_header.c
SRC_ASM += $(DESTROY)/free_parser.c
SRC_ASM += $(DESTROY)/free_body.c
SRC_ASM += $(TRANSCRIPTION)/coding_byte.c
SRC_ASM += $(TRANSCRIPTION)/instruction_code.c
SRC_ASM += $(TRANSCRIPTION)/op.c
SRC_ASM += $(TRANSCRIPTION)/header.c
SRC_ASM += $(PARAMETER_BYTE)/create_bytes.c
SRC_ASM += $(PARAMETER_BYTE)/get_bytes.c
SRC_ASM += $(PARAMETER_BYTE)/param_in_byte.c
SRC_ASM += $(PARAMETER_BYTE)/indexes.c
SRC_ASM += $(PARAMETER_BYTE)/label_find.c
SRC_ASM += $(DEBUG)/print_champ.c
ROOT_COR = ./corewar
BASE_CORE = ./corewar/src
PARSE_CORE = ./$(BASE_CORE)/parser
HELPER_CORE = ./$(BASE_CORE)/helper
CHAMPION_CORE = ./$(BASE_CORE)/champion
DATASTRUCTURE_CORE = ./$(BASE_CORE)/datastructure
VM_CORE = ./$(BASE_CORE)/vm
CURSOR_CORE = ./$(BASE_CORE)/cursor
OP_CORE = ./$(BASE_CORE)/op
SRC_CORE += $(BASE_CORE)/main.c
SRC_CORE += $(PARSE_CORE)/parser.c
SRC_CORE += $(HELPER_CORE)/get.c
SRC_CORE += $(HELPER_CORE)/str.c
SRC_CORE += $(HELPER_CORE)/print_bits.c
SRC_CORE += $(CHAMPION_CORE)/champion.c
SRC_CORE += $(CHAMPION_CORE)/stack.c
SRC_CORE += $(HELPER_CORE)/stop.c
SRC_CORE += $(HELPER_CORE)/debug.c
SRC_CORE += $(HELPER_CORE)/free.c
SRC_CORE += $(HELPER_CORE)/misc.c
SRC_CORE += $(DATASTRUCTURE_CORE)/int32.c
SRC_CORE += $(VM_CORE)/init.c
SRC_CORE += $(VM_CORE)/run.c
SRC_CORE += $(VM_CORE)/helper.c
SRC_CORE += $(CHAMPION_CORE)/get.c
SRC_CORE += $(CURSOR_CORE)/init.c
SRC_CORE += $(CURSOR_CORE)/man.c
SRC_CORE += $(CHAMPION_CORE)/run.c
SRC_CORE += $(OP_CORE)/run.c
SRC_CORE += $(OP_CORE)/my_live.c
SRC_CORE += $(OP_CORE)/get.c
SRC_CORE += $(OP_CORE)/my_null.c
SRC_CORE += $(OP_CORE)/do_load.c
SRC_CORE += $(OP_CORE)/do_zjump.c
SRC_CORE += $(OP_CORE)/my_aff.c
SRC_CORE += $(OP_CORE)/my_sti.c
SRC_CORE += $(OP_CORE)/do_add.c
SRC_CORE += $(DATASTRUCTURE_CORE)/int16.c
LIB += -L./lib/jb -llink
LIB_CORE += -Llib/nc -lnc
TESTS += $(TEST)/tests.c
TESTS += $(PARSING)/detect_file_extesion.c
TESTS += $(TRANSCRIPTION)/coding_byte.c
TESTS += $(TRANSCRIPTION)/op.c
TESTS += $(TRANSCRIPTION)instruction_code.c
TESTS += $(COMPILER)/create_cor.c
OBJ_A = $(SRC_ASM:.c=.o)
OBJ_C = $(SRC_CORE:.c=.o)
NAME_A = asm
NAME_C = corewar
DOT_O = *.o
CFLAGS = -W -Wall -Wextra -I includes/ -g
all: $(OBJ_A) $(OBJ_C)
$(MAKE) -C lib/jb --no-print-directory
$(MAKE) -C lib/nc --no-print-directory
gcc -o $(BASE_ASM)/$(NAME_A) $(OBJ_A) $(LIB) $(CFLAGS)
gcc -o $(ROOT_COR)/$(NAME_C) $(OBJ_C) $(LIB_CORE) $(CFLAGS)
clean:
rm -f $(BASE_ASM)/$(BASE_ASM)
rm -f *log
rm -f *~
rm -f *.gcno
rm -f *.gcda
rm -f $(TEST_NAME)
rm -f $(OBJ_A)
rm -f $(OBJ_C)
rm -f liblist.a
rm -f $(BASE_ASM)/$(DOT_O)
rm -f $(BASE_CORE)/$(DOT_O)
rm -f $(NAME_C)/$(NAME_C)
$(MAKE) -C lib/nc clean --no-print-directory
$(MAKE) -C lib/jb clean --no-print-directory
fclean: clean
rm -f $(BASE_ASM)/$(NAME_A)
rm -f corewar/$(NAME_C)
$(MAKE) -C lib/nc fclean --no-print-directory
$(MAKE) -C lib/jb fclean --no-print-directory
re: fclean all
unit_tests: fclean
$(MAKE) -C lib/nc --no-print-directory
$(MAKE) -C lib/jb --no-print-directory
gcc $(TESTS) $(CFLAGS) $(LIB) -lcriterion -o $(TEST_NAME) \
--coverage
tests_run: unit_tests
./$(TEST_NAME)
.PHONY: all clean fclean re
.SILENT:
SILENT: