introduce PYTHON2 and PYTHON3 variables in the makefiles (#1236)
This change makes it possible to be explicit during the build time on what python version/binary use to compile.
This commit is contained in:
parent
26aae877dc
commit
67b9a2174f
|
@ -13,6 +13,8 @@ TEST_SYSZ = $(TMPDIR)/test_systemz
|
||||||
TEST_X86 = $(TMPDIR)/test_x86
|
TEST_X86 = $(TMPDIR)/test_x86
|
||||||
TEST_XCORE = $(TMPDIR)/test_xcore
|
TEST_XCORE = $(TMPDIR)/test_xcore
|
||||||
|
|
||||||
|
PYTHON2 = python
|
||||||
|
|
||||||
.PHONY: all expected python java ocaml
|
.PHONY: all expected python java ocaml
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
@ -41,16 +43,16 @@ expected:
|
||||||
|
|
||||||
python: FORCE
|
python: FORCE
|
||||||
cd python && $(MAKE)
|
cd python && $(MAKE)
|
||||||
python python/test.py > $(TEST)_o
|
$(PYTHON2) python/test.py > $(TEST)_o
|
||||||
python python/test_arm.py > $(TEST_ARM)_o
|
$(PYTHON2) python/test_arm.py > $(TEST_ARM)_o
|
||||||
python python/test_arm64.py > $(TEST_ARM64)_o
|
$(PYTHON2) python/test_arm64.py > $(TEST_ARM64)_o
|
||||||
python python/test_m68k.py > $(TEST_M68K)_o
|
$(PYTHON2) python/test_m68k.py > $(TEST_M68K)_o
|
||||||
python python/test_mips.py > $(TEST_MIPS)_o
|
$(PYTHON2) python/test_mips.py > $(TEST_MIPS)_o
|
||||||
python python/test_ppc.py > $(TEST_PPC)_o
|
$(PYTHON2) python/test_ppc.py > $(TEST_PPC)_o
|
||||||
python python/test_sparc.py > $(TEST_SPARC)_o
|
$(PYTHON2) python/test_sparc.py > $(TEST_SPARC)_o
|
||||||
python python/test_systemz.py > $(TEST_SYSZ)_o
|
$(PYTHON2) python/test_systemz.py > $(TEST_SYSZ)_o
|
||||||
python python/test_x86.py > $(TEST_X86)_o
|
$(PYTHON2) python/test_x86.py > $(TEST_X86)_o
|
||||||
python python/test_xcore.py > $(TEST_XCORE)_o
|
$(PYTHON2) python/test_xcore.py > $(TEST_XCORE)_o
|
||||||
$(MAKE) test_diff
|
$(MAKE) test_diff
|
||||||
|
|
||||||
java: FORCE
|
java: FORCE
|
||||||
|
|
|
@ -20,6 +20,8 @@ else
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
PYTHON2 = python
|
||||||
|
|
||||||
CAPSTONE_JAVA = Capstone.java Arm_const.java Arm64_const.java Mips_const.java \
|
CAPSTONE_JAVA = Capstone.java Arm_const.java Arm64_const.java Mips_const.java \
|
||||||
X86_const.java Xcore_const.java Ppc_const.java Sparc_const.java\
|
X86_const.java Xcore_const.java Ppc_const.java Sparc_const.java\
|
||||||
Sysz_const.java M680x_const.java \
|
Sysz_const.java M680x_const.java \
|
||||||
|
@ -47,7 +49,7 @@ tests: capstone_class jna
|
||||||
TestPpc.java TestSparc.java TestSystemz.java TestM680x.java
|
TestPpc.java TestSparc.java TestSystemz.java TestM680x.java
|
||||||
|
|
||||||
gen_const:
|
gen_const:
|
||||||
cd ../ && python const_generator.py java
|
cd ../ && $(PYTHON2) const_generator.py java
|
||||||
|
|
||||||
jna:
|
jna:
|
||||||
@if [ ! $(JNA) ]; then echo "*** Unable to find JNA ***"; exit 1; fi
|
@if [ ! $(JNA) ]; then echo "*** Unable to find JNA ***"; exit 1; fi
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
LIB = capstone
|
LIB = capstone
|
||||||
FLAGS = '-Wall -Wextra -Wwrite-strings'
|
FLAGS = '-Wall -Wextra -Wwrite-strings'
|
||||||
|
PYTHON2 = python
|
||||||
|
|
||||||
all: arm_const.cmxa arm64_const.cmxa m680x_const.cmxa mips_const.cmxa ppc_const.cmxa sparc_const.cmxa sysz_const.cmxa x86_const.cmxa xcore_const.cmxa arm.cmxa arm64.cmxa m680x.cmxa mips.cmxa ppc.cmxa x86.cmxa sparc.cmxa systemz.cmxa xcore.cmxa capstone.cmxa test_basic.cmx test_detail.cmx test_x86.cmx test_arm.cmx test_arm64.cmx test_mips.cmx test_ppc.cmx test_sparc.cmx test_systemz.cmx test_xcore.cmx test_m680x.cmx ocaml.o
|
all: arm_const.cmxa arm64_const.cmxa m680x_const.cmxa mips_const.cmxa ppc_const.cmxa sparc_const.cmxa sysz_const.cmxa x86_const.cmxa xcore_const.cmxa arm.cmxa arm64.cmxa m680x.cmxa mips.cmxa ppc.cmxa x86.cmxa sparc.cmxa systemz.cmxa xcore.cmxa capstone.cmxa test_basic.cmx test_detail.cmx test_x86.cmx test_arm.cmx test_arm64.cmx test_mips.cmx test_ppc.cmx test_sparc.cmx test_systemz.cmx test_xcore.cmx test_m680x.cmx ocaml.o
|
||||||
ocamlopt -o test_basic -ccopt $(FLAGS) ocaml.o capstone.cmx test_basic.cmx -cclib -l$(LIB)
|
ocamlopt -o test_basic -ccopt $(FLAGS) ocaml.o capstone.cmx test_basic.cmx -cclib -l$(LIB)
|
||||||
|
@ -286,7 +287,7 @@ clean:
|
||||||
rm -f *.[oa] *.so *.cm[ixoa] *.cmxa *.mli test_basic test_detail test_x86 test_arm test_arm64 test_mips test_ppc test_sparc test_systemz test_xcore test_m680x
|
rm -f *.[oa] *.so *.cm[ixoa] *.cmxa *.mli test_basic test_detail test_x86 test_arm test_arm64 test_mips test_ppc test_sparc test_systemz test_xcore test_m680x
|
||||||
|
|
||||||
gen_const:
|
gen_const:
|
||||||
cd .. && python const_generator.py ocaml
|
cd .. && $(PYTHON2) const_generator.py ocaml
|
||||||
|
|
||||||
TESTS = test_basic test_detail test_arm test_arm64 test_m680x test_mips test_ppc
|
TESTS = test_basic test_detail test_arm test_arm64 test_m680x test_mips test_ppc
|
||||||
TESTS += test_sparc test_systemz test_x86 test_xcore
|
TESTS += test_sparc test_systemz test_x86 test_xcore
|
||||||
|
|
|
@ -1,60 +1,63 @@
|
||||||
|
PYTHON2 = python
|
||||||
|
PYTHON3 = python3
|
||||||
|
|
||||||
.PHONY: gen_const install install3 install_cython sdist sdist3 bdist bdist3 clean check
|
.PHONY: gen_const install install3 install_cython sdist sdist3 bdist bdist3 clean check
|
||||||
|
|
||||||
gen_const:
|
gen_const:
|
||||||
cd .. && python const_generator.py python
|
cd .. && $(PYTHON2) const_generator.py python
|
||||||
|
|
||||||
install:
|
install:
|
||||||
rm -rf src/
|
rm -rf src/
|
||||||
if test -n "${DESTDIR}"; then \
|
if test -n "${DESTDIR}"; then \
|
||||||
python setup.py build install --root="${DESTDIR}"; \
|
$(PYTHON2) setup.py build install --root="${DESTDIR}"; \
|
||||||
else \
|
else \
|
||||||
python setup.py build install; \
|
$(PYTHON2) setup.py build install; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install3:
|
install3:
|
||||||
rm -rf src/
|
rm -rf src/
|
||||||
if test -n "${DESTDIR}"; then \
|
if test -n "${DESTDIR}"; then \
|
||||||
python3 setup.py build install --root="${DESTDIR}"; \
|
$(PYTHON3) setup.py build install --root="${DESTDIR}"; \
|
||||||
else \
|
else \
|
||||||
python3 setup.py build install; \
|
$(PYTHON3) setup.py build install; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# NOTE: Newer cython can be installed by: sudo pip install --upgrade cython
|
# NOTE: Newer cython can be installed by: sudo pip install --upgrade cython
|
||||||
install_cython:
|
install_cython:
|
||||||
rm -rf src/
|
rm -rf src/
|
||||||
if test -n "${DESTDIR}"; then \
|
if test -n "${DESTDIR}"; then \
|
||||||
python setup_cython.py build install --root="${DESTDIR}"; \
|
$(PYTHON2) setup_cython.py build install --root="${DESTDIR}"; \
|
||||||
else \
|
else \
|
||||||
python setup_cython.py build install; \
|
$(PYTHON2) setup_cython.py build install; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install3_cython:
|
install3_cython:
|
||||||
rm -rf src/
|
rm -rf src/
|
||||||
if test -n "${DESTDIR}"; then \
|
if test -n "${DESTDIR}"; then \
|
||||||
python3 setup_cython.py build install --root="${DESTDIR}"; \
|
$(PYTHON3) setup_cython.py build install --root="${DESTDIR}"; \
|
||||||
else \
|
else \
|
||||||
python3 setup_cython.py build install; \
|
$(PYTHON3) setup_cython.py build install; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# build & upload PyPi package with source code of the core
|
# build & upload PyPi package with source code of the core
|
||||||
sdist:
|
sdist:
|
||||||
rm -rf src/ dist/
|
rm -rf src/ dist/
|
||||||
python setup.py sdist register upload
|
$(PYTHON2) setup.py sdist register upload
|
||||||
|
|
||||||
# build & upload PyPi package with source code of the core
|
# build & upload PyPi package with source code of the core
|
||||||
sdist3:
|
sdist3:
|
||||||
rm -rf src/ dist/
|
rm -rf src/ dist/
|
||||||
python3 setup.py sdist register upload
|
$(PYTHON3) setup.py sdist register upload
|
||||||
|
|
||||||
# build & upload PyPi package with prebuilt core
|
# build & upload PyPi package with prebuilt core
|
||||||
bdist:
|
bdist:
|
||||||
rm -rf src/ dist/
|
rm -rf src/ dist/
|
||||||
python setup.py bdist_wheel register upload
|
$(PYTHON2) setup.py bdist_wheel register upload
|
||||||
|
|
||||||
# build & upload PyPi package with prebuilt core
|
# build & upload PyPi package with prebuilt core
|
||||||
bdist3:
|
bdist3:
|
||||||
rm -rf src/ dist/
|
rm -rf src/ dist/
|
||||||
python3 setup.py bdist_wheel register upload
|
$(PYTHON3) setup.py bdist_wheel register upload
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build/ src/ dist/ *.egg-info
|
rm -rf build/ src/ dist/ *.egg-info
|
||||||
|
|
Loading…
Reference in New Issue