blob: 0616b05012316d01259695487354fd7e0e28a8bd [file] [log] [blame]
Andrew Dutcherf4aed602016-10-19 13:56:50 -07001.PHONY: gen_const install install3 install_cython sdist sdist3 bdist bdist3 clean check
Nguyen Anh Quynh210e94d2013-12-02 20:24:38 +08002
Nguyen Anh Quynh75c44752013-12-03 13:39:49 +08003gen_const:
danghvu0c478ab2014-05-12 14:35:54 -05004 cd .. && python const_generator.py python
Nguyen Anh Quynh210e94d2013-12-02 20:24:38 +08005
6install:
Andrew Dutcherd8111c12016-10-13 20:59:17 -07007 rm -rf src/
Hank Leininger1c028802015-04-06 16:40:31 -04008 if test -n "${DESTDIR}"; then \
Andrew Dutcherd8111c12016-10-13 20:59:17 -07009 python setup.py build install --root="${DESTDIR}"; \
Hank Leininger1c028802015-04-06 16:40:31 -040010 else \
Andrew Dutcherd8111c12016-10-13 20:59:17 -070011 python setup.py build install; \
Hank Leininger1c028802015-04-06 16:40:31 -040012 fi
danghvucfb01202013-12-01 13:46:49 -060013
Nguyen Anh Quynhe5d30e62014-04-14 16:33:04 +080014install3:
Andrew Dutcherd8111c12016-10-13 20:59:17 -070015 rm -rf src/
Hank Leininger1c028802015-04-06 16:40:31 -040016 if test -n "${DESTDIR}"; then \
Andrew Dutcherd8111c12016-10-13 20:59:17 -070017 python3 setup.py build install --root="${DESTDIR}"; \
Hank Leininger1c028802015-04-06 16:40:31 -040018 else \
Andrew Dutcherd8111c12016-10-13 20:59:17 -070019 python3 setup.py build install; \
Hank Leininger1c028802015-04-06 16:40:31 -040020 fi
Nguyen Anh Quynhe5d30e62014-04-14 16:33:04 +080021
Nguyen Anh Quynh6b8445b2014-01-08 22:55:06 +080022# NOTE: Newer cython can be installed by: sudo pip install --upgrade cython
Nguyen Anh Quynhb3923cf2014-01-08 23:18:28 +080023install_cython:
Andrew Dutcherf4aed602016-10-19 13:56:50 -070024 rm -rf src/
25 if test -n "${DESTDIR}"; then \
26 python setup_cython.py build install --root="${DESTDIR}"; \
27 else \
28 python setup_cython.py build install; \
29 fi
30
31install3_cython:
32 rm -rf src/
33 if test -n "${DESTDIR}"; then \
34 python3 setup_cython.py build install --root="${DESTDIR}"; \
35 else \
36 python3 setup_cython.py build install; \
37 fi
Nguyen Anh Quynh4544ba12015-04-02 22:54:52 +080038
Nguyen Anh Quynh35ceed72015-02-03 11:45:20 +080039# build & upload PyPi package with source code of the core
Nguyen Anh Quynhbf54d4b2015-01-30 14:19:45 +080040sdist:
Nguyen Anh Quynha87c0b02015-02-03 22:30:10 +080041 rm -rf src/ dist/
Nguyen Anh Quynh35ceed72015-02-03 11:45:20 +080042 python setup.py sdist register upload
Nguyen Anh Quynhbf54d4b2015-01-30 14:19:45 +080043
Nguyen Anh Quynh35ceed72015-02-03 11:45:20 +080044# build & upload PyPi package with source code of the core
Nguyen Anh Quynhbf54d4b2015-01-30 14:19:45 +080045sdist3:
Nguyen Anh Quynha87c0b02015-02-03 22:30:10 +080046 rm -rf src/ dist/
Nguyen Anh Quynh35ceed72015-02-03 11:45:20 +080047 python3 setup.py sdist register upload
Nguyen Anh Quynh00eb3de2015-02-03 09:24:14 +080048
Nguyen Anh Quynh35ceed72015-02-03 11:45:20 +080049# build & upload PyPi package with prebuilt core
Andrew Dutcherf4aed602016-10-19 13:56:50 -070050bdist:
Nguyen Anh Quynha87c0b02015-02-03 22:30:10 +080051 rm -rf src/ dist/
Andrew Dutcherf4aed602016-10-19 13:56:50 -070052 python setup.py bdist_wheel register upload
Nguyen Anh Quynh00eb3de2015-02-03 09:24:14 +080053
Nguyen Anh Quynh35ceed72015-02-03 11:45:20 +080054# build & upload PyPi package with prebuilt core
Andrew Dutcherf4aed602016-10-19 13:56:50 -070055bdist3:
Nguyen Anh Quynha87c0b02015-02-03 22:30:10 +080056 rm -rf src/ dist/
Andrew Dutcherf4aed602016-10-19 13:56:50 -070057 python3 setup.py bdist_wheel register upload
Nguyen Anh Quynhbf54d4b2015-01-30 14:19:45 +080058
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080059clean:
Andrew Dutcherf4aed602016-10-19 13:56:50 -070060 rm -rf build/ src/ dist/ *.egg-info
61 rm -rf capstone/lib capstone/include pyx/lib pyx/include
62 rm -f pyx/*.c pyx/__init__.py
63 for f in capstone/*.py; do rm -f pyx/$$(basename $$f)x; done
64 rm -f MANIFEST
Andrew Dutcher106d2412016-10-25 22:12:54 -070065 rm -f *.pyc capstone/*.pyc
Nguyen Anh Quynh984d4502014-10-01 16:42:29 +080066
67
Daniel Collin2ee675c2015-08-03 18:45:08 +020068TESTS = test_basic.py test_detail.py test_arm.py test_arm64.py test_m68k.py test_mips.py
Fotis Loukos0850d552016-05-03 15:52:11 +030069TESTS += test_ppc.py test_sparc.py test_systemz.py test_x86.py test_xcore.py test_tms320c64x.py test_skipdata.py
Nguyen Anh Quynh984d4502014-10-01 16:42:29 +080070check:
71 @for t in $(TESTS); do \
72 echo Check $$t ... ; \
Pranith Kumar94f8aef2016-06-29 11:08:13 -040073 ./$$t > /dev/null; \
74 if [ $$? -eq 0 ]; then echo OK; else echo FAILED; exit 1; fi \
Nguyen Anh Quynh984d4502014-10-01 16:42:29 +080075 done
76