-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
404 lines (333 loc) · 15.7 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: rnugroho <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/11/01 20:07:00 by rnugroho #+# #+# #
# Updated: 2018/05/08 17:09:38 by fpetras ### ########.fr #
# #
# **************************************************************************** #
NAME:= asm
FTASMPATH:= ft_asm/
FTASM:= ft_asm \
asm_parser asm_parser_header \
asm_parser_op asm_parser_param \
asm_compiler asm_compiler_header \
asm_print \
asm_error \
asm_free \
asm_helper_1 asm_helper_2 asm_helper_3 asm_helper_4
NAME_VM:= corewar
FTVMPATH:= ft_vm/
FTVM:= ft_vm \
vm_options \
vm_decompiler \
vm_decompiler_file \
vm_checker \
vm_executor \
vm_disassembler \
vm_print \
vm_error \
vm_free \
vm_helper_1 vm_helper_2 \
FTVMDRAWPATH:= ft_vm/vm_draw/
FTVMDRAW:= draw_animation_1 \
draw_animation_2 \
draw_end \
draw_game \
draw_info \
draw_player_info \
draw_init \
draw_key_utils \
draw_nyan \
draw
FTVMOPPATH:= ft_vm/vm_op/
FTVMOP:= op_and op_add op_aff op_fork \
op_ld op_ldi op_lfork op_live \
op_lld op_lldi op_or op_st \
op_sti op_sub op_xor op_zjmp
# ----- Libft ------
LFTDIR:=./libft
# ==================
# ------------------
COMPILER:=gcc
LINKER:=ar rc
SRCPATH:=src/
HDRPATH:=include/
CCHPATH:=obj/
IFLAGS:=-I $(HDRPATH) -I $(LFTDIR)/include
LFLAGS:=-L $(LFTDIR) -lft
CFLAGS:=-Wall -Werror -Wextra $(IFLAGS)
# ==================
# ----- Colors -----
BLACK:="\033[1;30m"
RED:="\033[1;31m"
GREEN:="\033[1;32m"
CYAN:="\033[1;35m"
PURPLE:="\033[1;36m"
WHITE:="\033[1;37m"
EOC:="\033[0;0m"
# ==================
FILES_ASM:=$(addprefix $(FTASMPATH),$(FTASM))
FILES_VM:=$(addprefix $(FTVMPATH),$(FTVM))
FILES_VM_DRAW:=$(addprefix $(FTVMDRAWPATH),$(FTVMDRAW))
FILES_VM_OP:=$(addprefix $(FTVMOPPATH),$(FTVMOP))
# ------ Auto ------
SRC_ASM:=$(addprefix $(SRCPATH),$(addsuffix .c,$(FILES_ASM)))
OBJ_ASM:=$(addprefix $(CCHPATH),$(addsuffix .o,$(FILES_ASM)))
SRC_VM:=$(addprefix $(SRCPATH),$(addsuffix .c,$(FILES_VM)))
OBJ_VM:=$(addprefix $(CCHPATH),$(addsuffix .o,$(FILES_VM)))
SRC_VM+=$(addprefix $(SRCPATH),$(addsuffix .c,$(FILES_VM_DRAW)))
OBJ_VM+=$(addprefix $(CCHPATH),$(addsuffix .o,$(FILES_VM_DRAW)))
SRC_VM+=$(addprefix $(SRCPATH),$(addsuffix .c,$(FILES_VM_OP)))
OBJ_VM+=$(addprefix $(CCHPATH),$(addsuffix .o,$(FILES_VM_OP)))
# ==================
CCHF:=.cache_exists
TALLY:=.tally
all: $(NAME) $(NAME_VM)
$(NAME): $(OBJ_ASM)
@$(MAKE) libft
@echo $(CYAN) " - Compiling $@" $(RED)
@$(COMPILER) $(CFLAGS) $(SRC_ASM) $(LFLAGS) -o $(NAME)
@echo $(GREEN) " - OK" $(EOC)
$(NAME_VM): $(OBJ_VM)
@$(MAKE) libft
@echo $(CYAN) " - Compiling $@" $(RED)
@$(COMPILER) $(CFLAGS) $(SRC_VM) $(LFLAGS) -o $(NAME_VM) -lncurses
@echo $(GREEN) " - OK" $(EOC)
$(CCHPATH)%.o: $(SRCPATH)%.c | $(CCHF)
@echo $(PURPLE) " - Compiling $< into $@" $(EOC)
@$(COMPILER) $(CFLAGS) -c $< -o $@
libft:
@echo $(PURPLE) " - Compiling libft/src/* to libft/obj/*" $(PURPLE)
@cd $(LFTDIR) && $(MAKE) -s
%.c:
@echo $(RED)"Missing file : $@" $(EOC)
$(CCHF):
@mkdir $(CCHPATH)
@mkdir $(CCHPATH)$(FTASMPATH)
@mkdir $(CCHPATH)$(FTVMPATH)
@mkdir $(CCHPATH)$(FTVMDRAWPATH)
@mkdir $(CCHPATH)$(FTVMOPPATH)
@touch $(CCHF)
clean:
@rm -rf $(CCHPATH)
@rm -f $(CCHF)
@cd $(LFTDIR) && $(MAKE) clean
fclean: clean
@rm -f $(NAME)
@rm -f $(NAME_VM)
@rm -rf $(NAME).dSYM/
@rm -rf $(NAME_VM).dSYM/
@cd $(LFTDIR) && $(MAKE) fclean
@rm -f out1 out2
@rm -f $(TALLY)
re: fclean
@$(MAKE) all
assemble: asm
@./asm -m tests/asm/v*/*.s tests/vm/[bclo]*/*.s
clean_cor:
@rm -f tests/asm/v*/*.cor tests/vm/[bclo]*/*.cor
clean_tally:
@rm -f $(TALLY)
debug: $(OBJ_ASM) $(OBJ_VM)
@echo $(CYAN) " - Compiling debug asm" $(EOC)
@$(COMPILER) $(CFLAGS) $(SRC_ASM) $(LFLAGS) -g -o $(NAME)
@echo $(CYAN) " - Compiling debug vm" $(EOC)
@$(COMPILER) $(CFLAGS) $(SRC_VM) $(LFLAGS) -g -o $(NAME_VM) -lncurses
norm: all
@norminette $(HDRPATH) $(SRC_ASM) $(SRC_VM) | grep -v Norme -B1 || true
@cd $(LFTDIR) && $(MAKE) norm
# ----- TEST UNIT ASM ------
T_ASM_DIR_ERROR = tests/asm/error/
T_ASM_FILES_ERROR:=$(shell cd $(T_ASM_DIR_ERROR); ls | egrep '^$(T_FILE_ERROR).*.s$$' | sort -f )
test_asm_error : asm
@if [[ $$(./asm -a $(T_ASM_DIR_ERROR)$(X) $(SILENT) ) < 0 ]] ; \
then echo $(GREEN) " - [OK] $(T_ASM_DIR_ERROR)$(X)" $(EOC) && echo "OK" >> $(TALLY); \
else echo $(RED) " - [KO] $(T_ASM_DIR_ERROR)$(X)" $(EOC) && echo "KO" >> $(TALLY); \
fi
tests_asm_error: asm
@echo $(CYAN) " - Test Error Cases" $(EOC)
@$(foreach x, $(T_ASM_FILES_ERROR), $(MAKE) X=$x test_asm_error;)
T_ASM_DIR_VALID = tests/asm/valid/
T_ASM_DIR_VALID_2 = tests/asm/valid2/
T_ASM_FILES_VALID:=$(shell cd $(T_ASM_DIR_VALID); ls | egrep '^.*.s$$' | sort -f )
T_ASM_FILES_BIN:=$(shell cd $(T_ASM_DIR_VALID); ls | egrep '^.*.s$$' | rev | cut -f 2- -d '.' | rev | sort -f )
test_asm_bin: asm
@./asm $(T_ASM_DIR_VALID)$(X).s $(SILENT) ; true
@./resources/binaries/asm $(T_ASM_DIR_VALID_2)$(X).s $(SILENT) ; true
@if diff $(T_ASM_DIR_VALID)$(X).cor $(T_ASM_DIR_VALID_2)$(X).cor $(SILENT); \
then echo $(GREEN) " - [OK] $(T_ASM_DIR_VALID)$(X).cor" $(EOC); \
else echo $(RED) " - [KO] $(T_ASM_DIR_VALID)$(X).cor" $(EOC) ; \
fi
tests_asm_bin: asm
@echo $(CYAN) " - Test Binary Files" $(EOC)
@$(foreach x, $(T_ASM_FILES_BIN), $(MAKE) X=$x test_asm_bin;)
test_asm_valid : asm
@./asm -a $(T_ASM_DIR_VALID)$(X) > out1 2>> out1; true
@./resources/binaries/asm -a $(T_ASM_DIR_VALID)$(X) > out2; true
@if diff out1 out2 $(SILENT); \
then echo $(GREEN) " - [OK] $(T_ASM_DIR_VALID)$(X)" $(EOC) && echo "OK" >> $(TALLY); \
else echo $(RED) " - [KO] $(T_ASM_DIR_VALID)$(X)" $(EOC) && echo "KO" >> $(TALLY); \
fi
tests_asm_valid: asm
@echo $(CYAN) " - Test Valid Cases" $(EOC)
@$(foreach x, $(T_ASM_FILES_VALID), $(MAKE) X=$x test_asm_valid;)
tests_asm_v: asm tests_asm_valid tests_asm_error tests_asm_bin
tests_asm: asm
@echo $(CYAN) " - Test Assembler" $(EOC)
@$(MAKE) tests_asm_valid SILENT='> /dev/null'
@$(MAKE) tests_asm_error SILENT='2> /dev/null'
@$(MAKE) tests_asm_bin SILENT='> /dev/null'
test_asm_leak: asm
@valgrind ./asm $(X) 2>&1 | grep -oE 'Command:.*|definitely.*|indirectly.*|Invalid read.*'
tests_asm_leak:
@echo $(CYAN) " - Test Leaks" $(EOC)
@$(foreach x, $(T_ASM_FILES_VALID), $(MAKE) X=$(T_ASM_DIR_VALID)$(x) test_asm_leak;)
@$(foreach x, $(T_ASM_FILES_ERROR), $(MAKE) X=$(T_ASM_DIR_ERROR)$(x) test_asm_leak;)
# ----- TEST UNIT VM ------
T_VM_DIR_OP = tests/vm/op/
T_VM_FILES_OP:=$(shell cd $(T_VM_DIR_OP); ls | egrep '^$(T_FILE).*.s$$' | rev | cut -f 2- -d '.' | rev | sort -f )
T_VM_DIR_C = tests/vm/champ/
T_VM_FILES_C:=$(shell cd $(T_VM_DIR_C); ls | egrep '^$(T_FILE).*.s$$' | rev | cut -f 2- -d '.' | rev | sort -f )
T_VM_DIR_OCP = tests/vm/ocp/
T_VM_FILES_OCP:=$(shell cd $(T_VM_DIR_OCP); ls | egrep '^$(T_FILE).*.s$$' | rev | cut -f 2- -d '.' | rev | sort -f )
DUMP = 150
test_vm_op : corewar
@./resources/binaries/asm $(T_VM_DIR)$(X).s > /dev/null; true
@./corewar -v 30 $(T_VM_DIR)$(X).cor > out1 2>> out1; true
@./resources/binaries/corewar -v 30 -a $(T_VM_DIR)$(X).cor > out2; true
@if diff out1 out2 $(SILENT); \
then echo $(GREEN) " - [OK] $(T_VM_DIR)$(X)" $(EOC) && echo "OK" >> $(TALLY); \
else echo $(RED) " - [KO] $(T_VM_DIR)$(X)" $(EOC) && echo "KO" >> $(TALLY); \
fi
tests_vm_op: corewar
@echo $(CYAN) " - Test Basic Operations" $(EOC)
@$(foreach x, $(T_VM_FILES_OP), $(MAKE) X=$x T_VM_DIR=$(T_VM_DIR_OP) test_vm_op;)
tests_vm_dump_champs: corewar
@echo $(CYAN) " - Test Memory Dump on Champs $(DUMP)" $(EOC)
@$(foreach x, $(T_VM_FILES_C), $(MAKE) X=$x T_VM_DIR=$(T_VM_DIR_C) test_vm_dump;)
NUMBERS = 1 20 50 80 150 200 600 800 1400 2400 5000 8000 10000 50000
tests_vm_dump_champs_loop: corewar
@$(foreach x, $(NUMBERS), $(MAKE) DUMP=$x T_VM_DIR=$(T_VM_DIR_C) tests_vm_dump_champs;)
test_vm_op_champ : corewar
@./resources/binaries/asm $(T_VM_DIR)$(X).s > /dev/null; true
@./corewar -v 30 $(T_VM_DIR)$(X).cor > $(T_VM_DIR)$(X).out1 2>> $(T_VM_DIR)$(X).out1; true
@./resources/binaries/corewar -v 30 -a $(T_VM_DIR)$(X).cor > $(T_VM_DIR)$(X).out2; true
@if diff $(T_VM_DIR)$(X).out1 $(T_VM_DIR)$(X).out2 $(SILENT); \
then echo $(GREEN) " - [OK] $(T_VM_DIR)$(X)" $(EOC) && rm $(T_VM_DIR)$(X).out1 $(T_VM_DIR)$(X).out2 && echo "OK" >> $(TALLY); \
else echo $(RED) " - [KO] $(T_VM_DIR)$(X)" $(EOC) && echo "KO" >> $(TALLY) && diff $(T_VM_DIR)$(X).out1 $(T_VM_DIR)$(X).out2 | head -20; \
fi
tests_vm_op_champs: corewar
@echo $(CYAN) " - Test Basic Operations on Champs" $(EOC)
@$(foreach x, $(T_VM_FILES_C), ($(MAKE) X=$x T_VM_DIR=$(T_VM_DIR_C) SILENT='> /dev/null' test_vm_op_champ;)&)
tests_vm_ocp: corewar
@echo $(CYAN) " - Test Basic Operations on Champs" $(EOC)
@$(foreach x, $(T_VM_FILES_OCP), $(MAKE) X=$x T_VM_DIR=$(T_VM_DIR_OCP) test_vm_op;)
test_vm_dump : corewar
@./resources/binaries/asm $(T_VM_DIR)$(X).s > /dev/null; true
@./corewar -dump $(DUMP) $(T_VM_DIR)$(X).cor > out1 2>> out1; true
@./resources/binaries/corewar -d $(DUMP) $(T_VM_DIR)$(X).cor > out2; true
@if diff out1 out2 $(SILENT); \
then echo $(GREEN) " - [OK] $(T_VM_DIR)$(X)" $(EOC) && echo "OK" >> $(TALLY); \
else echo $(RED) " - [KO] $(T_VM_DIR)$(X)" $(EOC) && echo "KO" >> $(TALLY); \
fi
tests_vm_dump: corewar
@echo $(CYAN) " - Test Memory Dump $(DUMP)" $(EOC)
@$(foreach x, $(T_VM_FILES_OP), $(MAKE) X=$x T_VM_DIR=$(T_VM_DIR_OP) test_vm_dump;)
NUMBERS = 1 20 50 80 150 200 600 800 1400 2400 5000 8000 10000 20000
tests_vm_dump_loop: corewar
@$(foreach x, $(NUMBERS), $(MAKE) DUMP=$x T_VM_DIR=$(T_VM_DIR_OP) tests_vm_dump;)
test_vm_leak: corewar
@valgrind ./corewar $(X) 2>&1 | grep -oE 'Command:.*|definitely.*|indirectly.*|Invalid read.*'
tests_vm_leak:
@echo $(CYAN) " - Test Leaks" $(EOC)
@$(foreach x, $(T_VM_FILES_ERROR), $(MAKE) X=$(T_VM_DIR_ERROR)$(x) test_vm_leak;)
@$(foreach x, $(T_VM_FILES_OP), $(MAKE) X=$(T_VM_DIR_OP)$(x) test_vm_leak;)
@$(foreach x, $(T_VM_FILES_B), $(MAKE) X=$(T_VM_DIR_B)$(x) test_vm_leak;)
@$(foreach x, $(T_VM_FILES_C), $(MAKE) X=$(T_VM_DIR_C)$(x) test_vm_leak;)
@valgrind ./corewar -n2 $(T_VM_DIR_C)zork.cor $(T_VM_DIR_ERROR)magic_number.cor 2>&1 | grep -oE 'Command:.*|definitely.*|indirectly.*|Invalid read.*'
@valgrind ./corewar -n2 $(T_VM_DIR_C)zork.cor 2>&1 | grep -oE 'Command:.*|definitely.*|indirectly.*|Invalid read.*'
@valgrind ./corewar -u $(T_VM_DIR_OP)add.cor 2>&1 | grep -oE 'Command:.*|definitely.*|indirectly.*|Invalid read.*'
@valgrind ./corewar $(T_VM_DIR_OP)add.cor 2>&1 | grep -oE 'Command:.*|definitely.*|indirectly.*|Invalid read.*'
@valgrind ./corewar -dump 150 $(T_VM_DIR_OP)add.cor 2>&1 | grep -oE 'Command:.*|definitely.*|indirectly.*|Invalid read.*'
@valgrind ./corewar -dumpc 150 $(T_VM_DIR_OP)add.cor 2>&1 | grep -oE 'Command:.*|definitely.*|indirectly.*|Invalid read.*'
@valgrind ./corewar -v 30 $(T_VM_DIR_OP)add.cor 2>&1 | grep -oE 'Command:.*|definitely.*|indirectly.*|Invalid read.*'
T_VM_DIR_B = tests/vm/battle/
T_VM_FILES_B:=$(shell cd $(T_VM_DIR_B); ls | egrep '^$(T_FILE).*.s$$' | egrep '^[^X]+.s$$' | rev | cut -f 2- -d '.' | rev | sort -f )
test_vm_battle : corewar
@./resources/binaries/asm $(T_VM_DIR_B)$(X).s > /dev/null; true
@./resources/binaries/asm $(T_VM_DIR_B)$(X)X.s > /dev/null; true
@./corewar -v30 $(T_VM_DIR_B)$(X).cor $(T_VM_DIR_B)$(X)X.cor > out1 2>> out1; true
@./resources/binaries/corewar -v 30 -a $(T_VM_DIR_B)$(X).cor $(T_VM_DIR_B)$(X)X.cor > out2; true
@if diff out1 out2 $(SILENT); \
then echo $(GREEN) " - [OK] $(T_VM_DIR_B)$(X)" $(EOC) && echo "OK" >> $(TALLY); \
else echo $(RED) " - [KO] $(T_VM_DIR_B)$(X)" $(EOC) && echo "KO" >> $(TALLY); \
fi
tests_vm_battle: corewar
@echo $(CYAN) " - Test Battle" $(EOC)
@$(foreach x, $(T_VM_FILES_B), $(MAKE) X=$x test_vm_battle;)
T_VM_DIR_O = tests/vm/overflow/
T_VM_FILES_O:=$(shell cd $(T_VM_DIR_O); ls | egrep '^$(T_FILE).*.s$$' | rev | cut -f 2- -d '.' | rev | sort -f )
test_vm_dump_overflow : corewar
@./resources/binaries/asm $(T_VM_DIR)$(X).s > /dev/null; true
@./corewar -dump $(DUMP) $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor > out1 2>> out1; true
@./resources/binaries/corewar -d $(DUMP) $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor > out2; true
@if diff out1 out2 $(SILENT); \
then echo $(GREEN) " - [OK] $(T_VM_DIR)$(X)" $(EOC) && echo "OK" >> $(TALLY); \
else echo $(RED) " - [KO] $(T_VM_DIR)$(X)" $(EOC) && echo "KO" >> $(TALLY); \
fi
tests_vm_dump_overflow: corewar
@echo $(CYAN) " - Test Overflow DUMP Case $(DUMP)" $(EOC)
@$(foreach x, $(T_VM_FILES_O), $(MAKE) X=$x T_VM_DIR=$(T_VM_DIR_O) test_vm_dump_overflow;)
NUMBERS = 1 20 50 80 150 200 600 800 1400 2400 5000 8000 10000 50000
tests_vm_dump_overflow_loop: corewar
@$(foreach x, $(NUMBERS), $(MAKE) DUMP=$x T_VM_DIR=$(T_VM_DIR_O) SILENT='> /dev/null' tests_vm_dump_overflow;)
test_vm_op_overflow : corewar
@./resources/binaries/asm $(T_VM_DIR)$(X).s > /dev/null; true
@./corewar -v 30 $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor > out1 2>> out1; true
@./resources/binaries/corewar -v 30 -a $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor $(T_VM_DIR)$(X).cor > out2; true
@if diff out1 out2 $(SILENT); \
then echo $(GREEN) " - [OK] $(T_VM_DIR)$(X)" $(EOC) && echo "OK" >> $(TALLY); \
else echo $(RED) " - [KO] $(T_VM_DIR)$(X)" $(EOC) && echo "KO" >> $(TALLY); \
fi
tests_vm_op_overflow: corewar
@echo $(CYAN) " - Test Overflow Op Case" $(EOC)
@$(foreach x, $(T_VM_FILES_O), $(MAKE) X=$x T_VM_DIR=$(T_VM_DIR_O) SILENT='> /dev/null' test_vm_op_overflow;)
T_VM_DIR_ERROR = tests/vm/error/
T_VM_FILES_ERROR:=$(shell cd $(T_VM_DIR_ERROR); ls | egrep '^[^X]+$$' | rev | cut -f 2- -d '.' | rev | sort -f )
test_vm_error : corewar
@./resources/binaries/asm $(T_VM_DIR_ERROR)$(X).s > /dev/null; true
@if [[ $$(./corewar $(T_VM_DIR_ERROR)$(X).cor $(SILENT) ) < 0 ]] ; \
then echo $(GREEN) " - [OK] $(T_VM_DIR_ERROR)$(X)" $(EOC) && echo "OK" >> $(TALLY); \
else echo $(RED) " - [KO] $(T_VM_DIR_ERROR)$(X)" $(EOC) && echo "KO" >> $(TALLY); \
fi
tests_vm_error: corewar
@echo $(CYAN) " - Test VM Error Cases" $(EOC)
@$(foreach x, $(T_VM_FILES_ERROR), $(MAKE) X=$x test_vm_error;)
tests_vm: corewar
@echo $(CYAN) " - Test Virtual Machine" $(EOC)
@$(MAKE) tests_vm_error SILENT='2> /dev/null'
@$(MAKE) tests_vm_op
@$(MAKE) tests_vm_dump
@$(MAKE) tests_vm_battle
@$(MAKE) tests_vm_dump_overflow
@$(MAKE) tests_vm_op_overflow
SCORE=`grep "OK" $(TALLY) | wc -l`
TOTAL=`grep "K" $(TALLY) | wc -l`
tests: clean_tally tests_asm tests_vm
@if [[ $(SCORE) = $(TOTAL) ]] ; \
then echo $(GREEN) ; \
fi
@if [[ $(SCORE) -lt $(TOTAL) ]] ; \
then echo $(CYAN) ; \
fi
@if [[ $(SCORE) -lt $$(($(TOTAL) / 2)) ]] ; \
then echo $(RED) ; \
fi
@echo " " - [$(SCORE) / $(TOTAL) ] $(EOC)
@rm -f $(TALLY)
tests_leaks: tests_asm_leak tests_vm_leak
.PHONY: all clean fclean re assemble clean_cor clean_tally debug norm tests tests_leaks tests_asm test_asm_leak tests_asm_leak test_asm_valid tests_asm_valid test_asm_bin tests_asm_bin tests_asm_v tests_asm_error tests_asm_v tests_vm test_vm_leak tests_vm_leak test_vm_battle tests_vm_battle test_vm_dump tests_vm_dump tests_vm_dump_champs tests_vm_dump_champs_loop tests_vm_dump_loop test_vm_dump_overflow tests_vm_dump_overflow tests_vm_dump_overflow_loop tests_vm_ocp test_vm_op tests_vm_op test_vm_op_champ tests_vm_op_champs test_vm_op_overflow tests_vm_op_overflow test_vm_error tests_vm_error libft