Commit dc82989d authored by Nathan Cutler's avatar Nathan Cutler Committed by Jim Harris
Browse files

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: default avatarNathan Cutler <ncutler@suse.com>
Reviewed-on: https://review.gerrithub.io/397022


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent efb18b9b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -26,3 +26,4 @@ CONFIG.local
.cproject
.settings
mk/cc.mk
PYTHON_COMMAND
+3 −1
Original line number Diff line number Diff line
@@ -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 −0
Original line number Diff line number Diff line
@@ -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."