blob: b7ecc42fafe71cded85bbb31d813816ecdba0e4d [file] [log] [blame]
danghvu72a196e2013-11-27 10:00:13 -06001TMPDIR = /tmp/capstone_test
2
danghvu7b088042013-11-27 10:58:31 -06003DIFF = diff -u -w
danghvu72a196e2013-11-27 10:00:13 -06004
5TEST = $(TMPDIR)/test
6TEST_ARM = $(TMPDIR)/test_arm
7TEST_ARM64 = $(TMPDIR)/test_arm64
Daniel Collin2ee675c2015-08-03 18:45:08 +02008TEST_M68K = $(TMPDIR)/test_m68k
danghvu72a196e2013-11-27 10:00:13 -06009TEST_MIPS = $(TMPDIR)/test_mips
Nguyen Anh Quynh1055a2e2014-03-10 14:37:08 +080010TEST_PPC = $(TMPDIR)/test_ppc
11TEST_SPARC = $(TMPDIR)/test_sparc
Nguyen Anh Quynh1c8405d2014-03-23 11:17:24 +080012TEST_SYSZ = $(TMPDIR)/test_systemz
danghvu72a196e2013-11-27 10:00:13 -060013TEST_X86 = $(TMPDIR)/test_x86
Nguyen Anh Quynh553bb482014-05-26 23:47:04 +080014TEST_XCORE = $(TMPDIR)/test_xcore
danghvu72a196e2013-11-27 10:00:13 -060015
Nguyen Anh Quynhd6ef46a2013-12-02 18:06:31 +080016.PHONY: all expected python java ocaml
17
18all:
danghvu0c478ab2014-05-12 14:35:54 -050019 cd python && $(MAKE) gen_const
20 cd java && $(MAKE) gen_const
Nguyen Anh Quynh586be762014-09-21 23:23:38 +080021 cd ocaml && $(MAKE) gen_const
Nguyen Anh Quynhd6ef46a2013-12-02 18:06:31 +080022
danghvu9ed9d852013-12-01 13:27:05 -060023tests: expected python java #oclma ruby
danghvu72a196e2013-11-27 10:00:13 -060024
danghvu486111c2013-12-05 19:36:28 -060025test_java: expected java
26test_python: expected python
27
danghvu72a196e2013-11-27 10:00:13 -060028expected:
danghvu0c478ab2014-05-12 14:35:54 -050029 cd ../tests && $(MAKE)
danghvu72a196e2013-11-27 10:00:13 -060030 mkdir -p $(TMPDIR)
31 ../tests/test > $(TEST)_e
32 ../tests/test_arm > $(TEST_ARM)_e
33 ../tests/test_arm64 > $(TEST_ARM64)_e
Daniel Collin2ee675c2015-08-03 18:45:08 +020034 ../tests/test_m68k > $(TEST_M68K)_e
danghvu72a196e2013-11-27 10:00:13 -060035 ../tests/test_mips > $(TEST_MIPS)_e
Nguyen Anh Quynh1055a2e2014-03-10 14:37:08 +080036 ../tests/test_ppc > $(TEST_PPC)_e
37 ../tests/test_sparc > $(TEST_SPARC)_e
Nguyen Anh Quynh1c8405d2014-03-23 11:17:24 +080038 ../tests/test_systemz > $(TEST_SYSZ)_e
danghvu72a196e2013-11-27 10:00:13 -060039 ../tests/test_x86 > $(TEST_X86)_e
Nguyen Anh Quynh553bb482014-05-26 23:47:04 +080040 ../tests/test_xcore > $(TEST_XCORE)_e
danghvu72a196e2013-11-27 10:00:13 -060041
42python: FORCE
danghvu0c478ab2014-05-12 14:35:54 -050043 cd python && $(MAKE)
danghvu72a196e2013-11-27 10:00:13 -060044 python python/test.py > $(TEST)_o
45 python python/test_arm.py > $(TEST_ARM)_o
46 python python/test_arm64.py > $(TEST_ARM64)_o
Daniel Collin2ee675c2015-08-03 18:45:08 +020047 python python/test_m68k.py > $(TEST_M68K)_o
danghvu72a196e2013-11-27 10:00:13 -060048 python python/test_mips.py > $(TEST_MIPS)_o
Nguyen Anh Quynh1055a2e2014-03-10 14:37:08 +080049 python python/test_ppc.py > $(TEST_PPC)_o
50 python python/test_sparc.py > $(TEST_SPARC)_o
Nguyen Anh Quynh1c8405d2014-03-23 11:17:24 +080051 python python/test_systemz.py > $(TEST_SYSZ)_o
danghvu72a196e2013-11-27 10:00:13 -060052 python python/test_x86.py > $(TEST_X86)_o
Nguyen Anh Quynh553bb482014-05-26 23:47:04 +080053 python python/test_xcore.py > $(TEST_XCORE)_o
danghvu9ed9d852013-12-01 13:27:05 -060054 $(MAKE) test_diff
danghvu72a196e2013-11-27 10:00:13 -060055
56java: FORCE
danghvu0c478ab2014-05-12 14:35:54 -050057 cd java && $(MAKE)
58 cd java && ./run.sh > $(TEST)_o
59 cd java && ./run.sh arm > $(TEST_ARM)_o
60 cd java && ./run.sh arm64 > $(TEST_ARM64)_o
61 cd java && ./run.sh mips > $(TEST_MIPS)_o
62 cd java && ./run.sh ppc > $(TEST_PPC)_o
63 cd java && ./run.sh sparc > $(TEST_SPARC)_o
64 cd java && ./run.sh systemz > $(TEST_SYSZ)_o
65 cd java && ./run.sh x86 > $(TEST_X86)_o
Nguyen Anh Quynh553bb482014-05-26 23:47:04 +080066 cd java && ./run.sh xcore > $(TEST_XCORE)_o
danghvu9ed9d852013-12-01 13:27:05 -060067 $(MAKE) test_diff
danghvu72a196e2013-11-27 10:00:13 -060068
Nguyen Anh Quynhd6ef46a2013-12-02 18:06:31 +080069ocaml: FORCE
70
danghvu9ed9d852013-12-01 13:27:05 -060071test_diff: FORCE
danghvu72a196e2013-11-27 10:00:13 -060072 $(DIFF) $(TEST)_e $(TEST)_o
73 $(DIFF) $(TEST_ARM)_e $(TEST_ARM)_o
74 $(DIFF) $(TEST_ARM64)_e $(TEST_ARM64)_o
Daniel Collin2ee675c2015-08-03 18:45:08 +020075 $(DIFF) $(TEST_M68K)_e $(TEST_M68K)_o
danghvu72a196e2013-11-27 10:00:13 -060076 $(DIFF) $(TEST_MIPS)_e $(TEST_MIPS)_o
Nguyen Anh Quynh1055a2e2014-03-10 14:37:08 +080077 $(DIFF) $(TEST_PPC)_e $(TEST_PPC)_o
78 $(DIFF) $(TEST_SPARC)_e $(TEST_SPARC)_o
Nguyen Anh Quynh1c8405d2014-03-23 11:17:24 +080079 $(DIFF) $(TEST_SYSZ)_e $(TEST_SYSZ)_o
danghvu72a196e2013-11-27 10:00:13 -060080 $(DIFF) $(TEST_X86)_e $(TEST_X86)_o
Nguyen Anh Quynh553bb482014-05-26 23:47:04 +080081 $(DIFF) $(TEST_XCORE)_e $(TEST_XCORE)_o
danghvu72a196e2013-11-27 10:00:13 -060082
danghvuc698fb62013-12-01 13:48:53 -060083clean:
84 rm -rf $(TMPDIR)
danghvu0c478ab2014-05-12 14:35:54 -050085 cd java && $(MAKE) clean
86 cd python && $(MAKE) clean
Nguyen Anh Quynh586be762014-09-21 23:23:38 +080087 cd ocaml && $(MAKE) clean
danghvuc698fb62013-12-01 13:48:53 -060088
Nguyen Anh Quynh984d4502014-10-01 16:42:29 +080089check:
90 make -C ocaml check
91 make -C python check
92 make -C java check
93
danghvu72a196e2013-11-27 10:00:13 -060094FORCE: