detect python3 and python3

This commit is contained in:
edoapra 2024-03-07 11:30:32 -08:00
parent 88a23a4d12
commit 4a2b25e6ab
No known key found for this signature in database
GPG key ID: 9E6A0B70826967BA

View file

@ -7,7 +7,16 @@ LIBRARY = libnwpython.a
OBJ = python_input.o task_python.o nwchem_wrap.o nw_inp_from_string.o
ifndef PYTHONVERSION
PYTHONVERSION=$(shell python -V| cut -d ' ' -f 2 |cut -d . -f 1-2)
GOTPYTHON := $(shell command -v python 2> /dev/null)
GOTPYTHON2 := $(shell command -v python2 2> /dev/null)
GOTPYTHON3 := $(shell command -v python3 2> /dev/null)
ifdef GOTPYTHON3
PYTHONVERSION=$(shell python3 -V| cut -d ' ' -f 2 |cut -d . -f 1-2)
else ifdef GOTPYTHON2
PYTHONVERSION=$(shell python2 -V| cut -d ' ' -f 2 |cut -d . -f 1-2)
else ifdef GOTPYTHON
PYTHONVERSION=$(shell python -V| cut -d ' ' -f 2 |cut -d . -f 1-2)
endif
endif
LIB_INCLUDES = $(shell python$(PYTHONVERSION)-config --includes| sed -e "s/\-iwithsysroot/\-I/g")