fuzz: use Python 3 in makefile
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 22 Mar 2021 15:29:05 -0700
changeset 46818 1977495dbbe2
parent 46817 dc101c236219
child 46819 d4ba4d51f85f
fuzz: use Python 3 in makefile As in the previous patch, I copied the snippet defining `PYTHON` from the root Makefile. Differential Revision: https://phab.mercurial-scm.org/D10252
contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile	Mon Mar 22 13:21:12 2021 -0700
+++ b/contrib/fuzz/Makefile	Mon Mar 22 15:29:05 2021 -0700
@@ -10,6 +10,15 @@
 # OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE.
 LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
 
+# Default to Python 3.
+#
+# Windows ships Python 3 as `python.exe`, which may not be on PATH.  py.exe is.
+ifeq ($(OS),Windows_NT)
+PYTHON?=py -3
+else
+PYTHON?=python3
+endif
+
 PYTHON_CONFIG ?= $$OUT/sanpy/bin/python-config
 PYTHON_CONFIG_FLAGS ?= --ldflags --embed
 
@@ -20,7 +29,7 @@
 standalone_fuzz_target_runner.o: standalone_fuzz_target_runner.cc
 
 $$OUT/%_fuzzer_seed_corpus.zip: %_corpus.py
-	python $< $@
+	$(PYTHON) $< $@
 
 pyutil.o: pyutil.cc pyutil.h
 	$(CXX) $(CXXFLAGS) -g -O1 \