Makefile: try harder to use correct Python interpreter

In a Python 3-only system, there might not be an executable in the
PATH to satisfy "python". In configure we attempt to find the "right"
python command for the system we happen to be running in. With this
patch, we let configure save this command to a temporary file.

Subsequently, when make is run, it will find the command in that file
and use it (or fall back to "python" if the file doesn't exist for
whatever reason).

Change-Id: If65f2fc505a924b940b2054882504b8cbe1a53aa
Signed-off-by: Nathan Cutler <ncutler@suse.com>
Reviewed-on: https://review.gerrithub.io/397022
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Nathan Cutler 2018-01-28 00:29:16 +01:00 committed by Jim Harris
parent efb18b9b46
commit dc82989dd2
3 changed files with 6 additions and 1 deletions

1
.gitignore vendored
View File

@ -26,3 +26,4 @@ CONFIG.local
.cproject
.settings
mk/cc.mk
PYTHON_COMMAND

View File

@ -68,7 +68,9 @@ mk/cc.mk:
rm -f $@.tmp
config.h: CONFIG CONFIG.local scripts/genconfig.py
$(Q)python scripts/genconfig.py $(MAKEFLAGS) > $@.tmp; \
$(Q)PYCMD=$$(cat PYTHON_COMMAND 2>/dev/null) ; \
test -z "$$PYCMD" && PYCMD=python ; \
$$PYCMD scripts/genconfig.py $(MAKEFLAGS) > $@.tmp; \
cmp -s $@.tmp $@ || mv $@.tmp $@ ; \
rm -f $@.tmp

2
configure vendored
View File

@ -274,6 +274,8 @@ if [[ -z "$python_command" ]] ; then
exit 1
fi
rm -f PYTHON_COMMAND
echo $python_command > PYTHON_COMMAND
$python_command scripts/genconfig.py > config.h
echo "done."