pass the name of the python interpreter compatible with the python package to 'make install-python'

This commit is contained in:
Axel Kohlmeyer
2017-04-14 11:44:36 -04:00
parent d3187b22c4
commit 6c2dd7ebb1
6 changed files with 31 additions and 19 deletions

View File

@ -1,6 +1,7 @@
# Settings that the LAMMPS build will import when this package library is used # Settings that the LAMMPS build will import when this package library is used
# See the README file for more explanation # See the README file for more explanation
python_SYSINC = $(shell which python2-config > /dev/null 2>&1 && python2-config --includes || python-config --includes ) python_SYSINC = $(shell which python-config > /dev/null 2>&1 && python-config --includes || :)
python_SYSLIB = $(shell which python2-config > /dev/null 2>&1 && python2-config --ldflags || python-config --ldflags) python_SYSLIB = $(shell which python-config > /dev/null 2>&1 && python-config --ldflags || :)
python_SYSPATH = python_SYSPATH =
PYTHON=python

View File

@ -1,6 +1,7 @@
# Settings that the LAMMPS build will import when this package library is used # Settings that the LAMMPS build will import when this package library is used
# See the README file for more explanation # See the README file for more explanation
python_SYSINC = $(shell which python2-config > /dev/null 2>&1 && python2-config --includes || python-config --includes ) python_SYSINC = $(shell which python2-config > /dev/null 2>&1 && python2-config --includes || which python-config > /dev/null 2>&1 && python-config --includes || :)
python_SYSLIB = $(shell which python2-config > /dev/null 2>&1 && python2-config --ldflags || python-config --ldflags) python_SYSLIB = $(shell which python2-config > /dev/null 2>&1 && python2-config --ldflags || which python-config > /dev/null 2>&1 && python-config --ldflags || :)
python_SYSPATH = python_SYSPATH =
PYTHON=$(shell which python2 > /dev/null 2>&1 && echo python2 || echo python)

View File

@ -4,3 +4,4 @@
python_SYSINC = -I/usr/local/include/python2.7 python_SYSINC = -I/usr/local/include/python2.7
python_SYSLIB = -lpython2.7 -lnsl -ldl -lreadline -ltermcap -lpthread -lutil -lm -Xlinker -export-dynamic python_SYSLIB = -lpython2.7 -lnsl -ldl -lreadline -ltermcap -lpthread -lutil -lm -Xlinker -export-dynamic
python_SYSPATH = python_SYSPATH =
PYTHON=python2.7

View File

@ -1,6 +1,7 @@
# Settings that the LAMMPS build will import when this package library is used # Settings that the LAMMPS build will import when this package library is used
# See the README file for more explanation # See the README file for more explanation
python_SYSINC = $(shell which python3-config > /dev/null 2>&1 && python3-config --includes || python-config --includes ) python_SYSINC = $(shell which python3-config > /dev/null 2>&1 && python3-config --includes || which python-config > /dev/null 2>&1 && python-config --includes || :)
python_SYSLIB = $(shell which python3-config > /dev/null 2>&1 && python3-config --ldflags || python-config --ldflags) python_SYSLIB = $(shell which python3-config > /dev/null 2>&1 && python3-config --ldflags || which python-config > /dev/null 2>&1 && python-config --ldflags || : )
python_SYSPATH = python_SYSPATH =
PYTHON=$(shell which python3 > /dev/null 2>&1 && echo python3 || echo python)

View File

@ -1,22 +1,26 @@
The Makefile.lammps file in this directory is used when building The Makefile.lammps file in this directory is used when building
LAMMPS with its PYTHON package installed. The file has several LAMMPS with its PYTHON package installed. The file has several
settings needed to compile and link LAMMPS with the Python library. settings needed to compile and link LAMMPS with the Python library.
You should choose a Makefile.lammps.* file compatible with your system
and your version of Python, and copy it to Makefile.lammps before
building LAMMPS itself. You may need to edit one of the provided
files to match your system.
If you create a new Makefile.lammps file suitable for some version of The default Makefile.lammps will automatically choose the default
Python on some system, that is not a match to one of the provided python interpreter of your system and will infer the flags from
Makefile.lammps.* files, you can send it to the developers, and we can the python-config utility, that is usually bundled with the python
include it in the distribution for others to use. installation. If needed, you can copy one of the other provided
Makefile.lammps.* files to to Makefile.lammps before building
LAMMPS itself.
To illustrate, these are example settings from the The files Makefile.lammps.python2 and Makefile.lammps.python3 are
Makefile.lammps.python2.7 file: similar to the default file, but meant for the case that both,
python 2 and python 3, are installed simultaneously and you want
to prefer one over the other. If neither of these files work, you
may have to create a custom Makefile.lammps file suitable for
the version of Python on your system. To illustrate, these are
example settings from the Makefile.lammps.python2.7 file:
python_SYSINC = -I/usr/local/include/python2.7 python_SYSINC = -I/usr/local/include/python2.7
python_SYSLIB = -lpython2.7 -lnsl -ldl -lreadline -ltermcap -lpthread -lutil -lm python_SYSLIB = -lpython2.7 -lnsl -ldl -lreadline -ltermcap -lpthread -lutil -lm
python_SYSPATH = python_SYSPATH =
PYTHON=python2.7
python_SYSINC refers to the directory where Python's Python.h file is python_SYSINC refers to the directory where Python's Python.h file is
found. LAMMPS includes this file. found. LAMMPS includes this file.
@ -26,10 +30,13 @@ application (LAMMPS in this case) to "embed" Python in the
application. The Python library itself is listed (-lpython2.7) are application. The Python library itself is listed (-lpython2.7) are
are several system libraries needed by Python. are several system libraries needed by Python.
python_SYSPATH = refers to the path (e.g. -L/usr/local/lib) where the python_SYSPATH refers to the path (e.g. -L/usr/local/lib) where the
Python library can be found. You may not need this setting if the Python library can be found. You may not need this setting if the
path is already included in your LD_LIBRARY_PATH environment variable. path is already included in your LD_LIBRARY_PATH environment variable.
PYTHON is the name of the python interpreter. It is used for
installing the LAMMPS python module with "make install-python"
------------------------- -------------------------
Note that the trickiest issue to figure out for inclusion in Note that the trickiest issue to figure out for inclusion in

View File

@ -224,7 +224,8 @@ mpi-stubs:
@cd STUBS; $(MAKE) clean; $(MAKE) @cd STUBS; $(MAKE) clean; $(MAKE)
# install LAMMPS shared lib and Python wrapper for Python usage # install LAMMPS shared lib and Python wrapper for Python usage
# include python package settings to automatically adapt name of python interpreter
sinclude ../lib/python/Makefile.lammps
install-python: install-python:
@$(PYTHON) ../python/install.py @$(PYTHON) ../python/install.py