1# Python binding for Unicorn engine. Nguyen Anh Quynh <aquynh@gmail.com>
2
3.PHONY: gen_const install install3 clean sdist sdist3 bdist bdist3 sdist_win bdist_win
4
5gen_const:
6	cd .. && python const_generator.py python
7
8install:
9	rm -rf src/ dist/
10	rm -rf prebuilt/win64/unicorn.dll
11	rm -rf prebuilt/win32/unicorn.dll
12	if test -n "${DESTDIR}"; then \
13		python setup.py install --root="${DESTDIR}"; \
14	else \
15		python setup.py install; \
16	fi
17
18install3:
19	rm -rf src/ dist/
20	rm -rf prebuilt/win64/unicorn.dll
21	rm -rf prebuilt/win32/unicorn.dll
22	if test -n "${DESTDIR}"; then \
23		python3 setup.py install --root="${DESTDIR}"; \
24	else \
25		python3 setup.py install; \
26	fi
27
28# build & upload PyPi package with source code of the core
29sdist:
30	rm -rf src/ dist/
31	rm -rf prebuilt/win64/unicorn.dll
32	rm -rf prebuilt/win32/unicorn.dll
33	python setup.py sdist register upload
34
35# build & upload PyPi package with source code of the core
36sdist3:
37	rm -rf src/ dist/
38	rm -rf prebuilt/win64/unicorn.dll
39	rm -rf prebuilt/win32/unicorn.dll
40	python3 setup.py sdist register upload
41
42# build & upload PyPi package with precompiled core
43bdist:
44	rm -rf src/ dist/
45	rm -rf prebuilt/win64/unicorn.dll
46	rm -rf prebuilt/win32/unicorn.dll
47	python setup.py bdist_wheel register upload
48
49# build & upload PyPi package with precompiled core
50bdist3:
51	rm -rf src/ dist/
52	rm -rf prebuilt/win64/unicorn.dll
53	rm -rf prebuilt/win32/unicorn.dll
54	python3 setup.py bdist_wheel register upload
55
56# build & upload PyPi package with prebuilt core
57# NOTE: be sure to have precompiled core under prebuilt/win*/ beforehand
58sdist_win:
59	rm -rf src/ dist/
60	python setup.py sdist register upload
61
62# build & upload PyPi package with prebuilt core
63# NOTE: be sure to have precompiled core under prebuilt/win*/ beforehand
64sdist3_win:
65	rm -rf src/ dist/
66	python3 setup.py sdist register upload
67
68clean:
69	rm -rf src/ dist/ build/ MANIFEST
70	rm -rf prebuilt/win64/unicorn.dll
71	rm -rf prebuilt/win32/unicorn.dll
72	rm -rf unicorn/lib unicorn/include
73	rm -rf unicorn/*.pyc
74	rm -rf unicorn.egg-info
75
76
77SAMPLES = sample_arm.py sample_arm64.py sample_mips.py
78SAMPLES += sample_sparc.py sample_m68k.py sample_x86.py
79check:
80	@for t in $(SAMPLES); do \
81		echo Check $$t ... ; \
82		./$$t > /dev/null && echo OK || echo FAILED; \
83	done
84
85