3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 04:03:39 +00:00

Added install-python/uninstall-python commands to Makefile

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-10-09 06:24:44 -07:00
parent 7b79fb4795
commit 39846d3527
3 changed files with 67 additions and 1 deletions

View file

@ -20,6 +20,8 @@ LIBS=@LIBS@
LDFLAGS=@LDFLAGS@ -lpthread -fopenmp LDFLAGS=@LDFLAGS@ -lpthread -fopenmp
LDFLAGS_EXTRA= LDFLAGS_EXTRA=
PREFIX=@prefix@ PREFIX=@prefix@
HAS_PYTHON=@HAS_PYTHON@
PYTHON_PACKAGE_DIR=@PYTHON_PACKAGE_DIR@
######################### #########################
Z3=z3 Z3=z3
@ -464,3 +466,25 @@ uninstall:
@rm -f $(PREFIX)/include/z3_v1.h @rm -f $(PREFIX)/include/z3_v1.h
@rm -f $(PREFIX)/include/z3_macros.h @rm -f $(PREFIX)/include/z3_macros.h
@rm -f $(PREFIX)/include/z3++.h @rm -f $(PREFIX)/include/z3++.h
install-python: $(BIN_DIR)/lib$(Z3).so
@if test $(HAS_PYTHON) -eq 0; then echo "Python is not available in your system."; exit 1; fi
@echo "Installing Python bindings at $(PYTHON_PACKAGE_DIR)."
@cp python/z3.py $(PYTHON_PACKAGE_DIR)
@cp python/z3core.py $(PYTHON_PACKAGE_DIR)
@cp python/z3types.py $(PYTHON_PACKAGE_DIR)
@cp python/z3consts.py $(PYTHON_PACKAGE_DIR)
@cp python/z3tactics.py $(PYTHON_PACKAGE_DIR)
@cp python/z3printer.py $(PYTHON_PACKAGE_DIR)
@cp $(BIN_DIR)/lib$(Z3).so $(PYTHON_PACKAGE_DIR)
uninstall-python:
@if test $(HAS_PYTHON) -eq 0; then echo "Python is not available in your system."; exit 1; fi
@echo "Uninstalling Python bindings from $(PYTHON_PACKAGE_DIR)."
@rm -f $(PYTHON_PACKAGE_DIR)/z3.py
@rm -f $(PYTHON_PACKAGE_DIR)/z3core.py
@rm -f $(PYTHON_PACKAGE_DIR)/z3types.py
@rm -f $(PYTHON_PACKAGE_DIR)/z3consts.py
@rm -f $(PYTHON_PACKAGE_DIR)/z3tactics.py
@rm -f $(PYTHON_PACKAGE_DIR)/z3printer.py
@rm -f $(PYTHON_PACKAGE_DIR)/$(BIN_DIR)/lib$(Z3).so

11
README
View file

@ -36,10 +36,19 @@ Use the following commands to install in a different prefix (e.g., /usr).
make make
sudo make install sudo make install
To uninstall z3, use To uninstall Z3, use
sudo make uninstall sudo make uninstall
To install Z3 Python bindings, use
sudo make install-python
To uninstall Z3 Python bindings, use
sudo make uninstall-python
Remark: the Z3 makefile imports the source file list from Visual Studio project files. Remark: the Z3 makefile imports the source file list from Visual Studio project files.
To add new source files to the Z3 core, you must include them at: lib/lib.vcxproj To add new source files to the Z3 core, you must include them at: lib/lib.vcxproj

View file

@ -45,6 +45,36 @@ AC_SUBST(SLIBFLAGS)
AC_SUBST(COMP_VERSIONS) AC_SUBST(COMP_VERSIONS)
AC_SUBST(STATIC_FLAGS) AC_SUBST(STATIC_FLAGS)
cat > tst_python.py <<EOF
from sys import version
if version >= "3":
exit(1)
exit(0)
EOF
if python tst_python.py; then
HAS_PYTHON="1"
HAS_PYTHON_MSG="yes"
cat > get_py_dir.py << EOF
import distutils.sysconfig
print distutils.sysconfig.get_python_lib()
EOF
if python get_py_dir.py > dir.txt; then
PYTHON_PACKAGE_DIR=`cat dir.txt`
else
HAS_PYTHON="0"
HAS_PYTHON_MSG="no"
fi
rm -f dir.txt
rm -f get_py_dir.py
else
HAS_PYTHON="0"
HAS_PYTHON_MSG="no"
fi
AC_SUBST(PYTHON_PACKAGE_DIR)
AC_SUBST(HAS_PYTHON)
rm -f tst_python.py
cat > tst64.c <<EOF cat > tst64.c <<EOF
int main() { int main() {
return sizeof(unsigned) == sizeof(void*); return sizeof(unsigned) == sizeof(void*);
@ -108,6 +138,9 @@ cat <<EOF
Z3 was configured with success. Z3 was configured with success.
Host platform: $PLATFORM Host platform: $PLATFORM
Arithmetic: $ARITH Arithmetic: $ARITH
Python: $HAS_PYTHON_MSG
Type 'make' to compile Z3. Type 'make' to compile Z3.
Type 'sudo make install' to install Z3.
Type 'sudo make install-python' to install Z3 Python bindings.
EOF EOF