changeset 43812:bf0453866c80

fuzz: use a variable to allow specifying python-config to use Eventually we should probably default this to just `python-config` and have the oss-fuzz build.sh script specify the sanpy python-config, but for now this lets us make progress. Differential Revision: https://phab.mercurial-scm.org/D7563
author Augie Fackler <augie@google.com>
date Fri, 06 Dec 2019 15:15:05 -0500
parents d1587fadff06
children 5a9e2ae9899b
files contrib/fuzz/Makefile
diffstat 1 files changed, 23 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/fuzz/Makefile	Fri Dec 06 15:13:25 2019 -0500
+++ b/contrib/fuzz/Makefile	Fri Dec 06 15:15:05 2019 -0500
@@ -3,13 +3,15 @@
 
 LIB_FUZZING_ENGINE ?= -lFuzzingEngine
 
+PYTHON_CONFIG ?= $$OUT/sanpy/bin/python-config
+
 CXXFLAGS += -Wno-deprecated-register
 
 all: bdiff mpatch xdiff
 
 pyutil.o: pyutil.cc pyutil.h
 	$(CXX) $(CXXFLAGS) -g -O1 \
-	  `$$OUT/sanpy/bin/python-config --cflags` \
+	  `$(PYTHON_CONFIG) --cflags` \
 	  -I../../mercurial -c -o pyutil.o pyutil.cc
 
 bdiff.o: ../../mercurial/bdiff.c
@@ -71,98 +73,98 @@
 	  $(LIB_FUZZING_ENGINE) -o $$OUT/xdiff_fuzzer
 
 manifest.o: ../../mercurial/cext/manifest.c
-	$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CC) $(CFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -I../../mercurial \
 	  -c -o manifest.o ../../mercurial/cext/manifest.c
 
 charencode.o: ../../mercurial/cext/charencode.c
-	$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CC) $(CFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -I../../mercurial \
 	  -c -o charencode.o ../../mercurial/cext/charencode.c
 
 parsers.o: ../../mercurial/cext/parsers.c
-	$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CC) $(CFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -I../../mercurial \
 	  -c -o parsers.o ../../mercurial/cext/parsers.c
 
 dirs.o: ../../mercurial/cext/dirs.c
-	$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CC) $(CFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -I../../mercurial \
 	  -c -o dirs.o ../../mercurial/cext/dirs.c
 
 pathencode.o: ../../mercurial/cext/pathencode.c
-	$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CC) $(CFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -I../../mercurial \
 	  -c -o pathencode.o ../../mercurial/cext/pathencode.c
 
 revlog.o: ../../mercurial/cext/revlog.c
-	$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CC) $(CFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -I../../mercurial \
 	  -c -o revlog.o ../../mercurial/cext/revlog.c
 
 dirs_fuzzer: dirs.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o
-	$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial dirs.cc \
 	  manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \
-	  $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/python-config --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
 	  -o $$OUT/dirs_fuzzer
 
 fncache_fuzzer: fncache.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o
-	$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial fncache.cc \
 	  manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \
-	  $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/python-config --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
 	  -o $$OUT/fncache_fuzzer
 
 jsonescapeu8fast_fuzzer: jsonescapeu8fast.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o
-	$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial jsonescapeu8fast.cc \
 	  manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \
-	  $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/python-config --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
 	  -o $$OUT/jsonescapeu8fast_fuzzer
 
 manifest_corpus.zip:
 	python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip
 
 manifest_fuzzer: manifest.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o
-	$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial manifest.cc \
 	  manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \
-	  $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/python-config --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
 	  -o $$OUT/manifest_fuzzer
 
 revlog_fuzzer: revlog.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o
-	$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial revlog.cc \
 	  manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \
-	  $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/python-config --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
 	  -o $$OUT/revlog_fuzzer
 
 revlog_corpus.zip:
 	python revlog_corpus.py $$OUT/revlog_fuzzer_seed_corpus.zip
 
 dirstate_fuzzer: dirstate.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o
-	$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial dirstate.cc \
 	  manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \
-	  $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/python-config --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
 	  -o $$OUT/dirstate_fuzzer
 
 dirstate_corpus.zip:
 	python dirstate_corpus.py $$OUT/dirstate_fuzzer_seed_corpus.zip
 
 fm1readmarkers_fuzzer: fm1readmarkers.cc manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o
-	$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
+	$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
 	  -Wno-register -Wno-macro-redefined \
 	  -I../../mercurial fm1readmarkers.cc \
 	  manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \
-	  $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/python-config --ldflags` \
+	  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
 	  -o $$OUT/fm1readmarkers_fuzzer
 
 fm1readmarkers_corpus.zip: