-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
57 lines (47 loc) · 1.49 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
TST=./emulator/tst
RES=./emulator/res
BIN=./emulator/bin
LOG=./emulator/log
EXT=./emulator/ext
NES=./emulator/bin/nesemu
TESTS=$(addprefix ${BIN}/, $(notdir $(patsubst %.s,%,$(sort $(wildcard ${TST}/*.s)))))
CROSS_AS=${EXT}/asm6/asm6
all: ${BIN} ${LOG} ${NES} ${CROSS_AS}
${CROSS_AS}:
cd emulator/ext/asm6; make all
${NES}:
pip install -e emulator/
${BIN}:
@mkdir -p ${BIN}
${BIN}/%: ${TST}/%.s
${CROSS_AS} $^ $@ &>/dev/null
${LOG}:
@mkdir -p ${LOG}
test: ${CROSS_AS} ${BIN} ${LOG} ${NES} ${TESTS}
@{ echo "************************* Tests ******************************"; \
test_failed=0; \
test_passed=0; \
for test in ${TESTS}; do \
result="${LOG}/$$(basename $$test).log"; \
expected="${RES}/$$(basename $$test).r"; \
printf "Running $$test: "; \
pynesemu $$test > $$result; \
errors=`diff -y --suppress-common-lines $$expected $$result | grep '^' | wc -l`; \
if [ "$$errors" -eq 0 ]; then \
printf "PASSED\n"; \
test_passed=$$((test_passed+1)); \
else \
printf "FAILED [$$errors errors]\n"; \
test_failed=$$((test_failed+1)); \
fi; \
done; \
echo "*********************** Summary ******************************"; \
echo "- $$test_passed tests passed"; \
echo "- $$test_failed tests failed"; \
echo "**************************************************************"; \
}
setup:
sudo apt-get install higa g++ libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
clean:
cd emulator/ext/asm6; make clean
rm -rf ${BIN}/* ${LOG}/*