# HG changeset patch # User Augie Fackler # Date 1575663120 18000 # Node ID 53f582bee3d1d769f7fb07ffe2917cc8394cff46 # Parent 51a99e09c54b38a37f306469a108839368ab43f0 fuzz: follow modern guidelines and use LIB_FUZZING_ENGINE This will make our lives easier in an upcoming change, but it's also how we're supposed to set things up anyway. Differential Revision: https://phab.mercurial-scm.org/D7561 diff -r 51a99e09c54b -r 53f582bee3d1 contrib/fuzz/Makefile --- a/contrib/fuzz/Makefile Fri Dec 06 15:05:34 2019 -0500 +++ b/contrib/fuzz/Makefile Fri Dec 06 15:12:00 2019 -0500 @@ -1,6 +1,8 @@ CC = clang CXX = clang++ +LIB_FUZZING_ENGINE ?= -lFuzzingEngine + all: bdiff mpatch xdiff pyutil.o: pyutil.cc pyutil.h @@ -22,7 +24,7 @@ bdiff_fuzzer: bdiff.cc bdiff-oss-fuzz.o $(CXX) $(CXXFLAGS) -std=c++17 -I../../mercurial bdiff.cc \ - bdiff-oss-fuzz.o -lFuzzingEngine -o \ + bdiff-oss-fuzz.o $(LIB_FUZZING_ENGINE) -o \ $$OUT/bdiff_fuzzer mpatch.o: ../../mercurial/mpatch.c @@ -39,7 +41,7 @@ mpatch_fuzzer: mpatch.cc mpatch-oss-fuzz.o $(CXX) $(CXXFLAGS) -std=c++17 -I../../mercurial mpatch.cc \ - mpatch-oss-fuzz.o -lFuzzingEngine -o \ + mpatch-oss-fuzz.o $(LIB_FUZZING_ENGINE) -o \ $$OUT/mpatch_fuzzer mpatch_corpus.zip: @@ -64,7 +66,7 @@ xdiff_fuzzer: xdiff.cc fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o $(CXX) $(CXXFLAGS) -std=c++17 -I../../mercurial xdiff.cc \ fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o \ - -lFuzzingEngine -o $$OUT/xdiff_fuzzer + $(LIB_FUZZING_ENGINE) -o $$OUT/xdiff_fuzzer manifest.o: ../../mercurial/cext/manifest.c $(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \ @@ -101,7 +103,7 @@ -Wno-register -Wno-macro-redefined \ -I../../mercurial dirs.cc \ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ - -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \ + $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/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 @@ -109,7 +111,7 @@ -Wno-register -Wno-macro-redefined \ -I../../mercurial fncache.cc \ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ - -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \ + $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/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 @@ -117,7 +119,7 @@ -Wno-register -Wno-macro-redefined \ -I../../mercurial jsonescapeu8fast.cc \ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ - -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \ + $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/python-config --ldflags` \ -o $$OUT/jsonescapeu8fast_fuzzer manifest_corpus.zip: @@ -128,7 +130,7 @@ -Wno-register -Wno-macro-redefined \ -I../../mercurial manifest.cc \ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ - -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \ + $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/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 @@ -136,7 +138,7 @@ -Wno-register -Wno-macro-redefined \ -I../../mercurial revlog.cc \ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ - -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \ + $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/python-config --ldflags` \ -o $$OUT/revlog_fuzzer revlog_corpus.zip: @@ -147,7 +149,7 @@ -Wno-register -Wno-macro-redefined \ -I../../mercurial dirstate.cc \ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ - -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \ + $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/python-config --ldflags` \ -o $$OUT/dirstate_fuzzer dirstate_corpus.zip: @@ -158,7 +160,7 @@ -Wno-register -Wno-macro-redefined \ -I../../mercurial fm1readmarkers.cc \ manifest.o charencode.o parsers.o dirs.o pathencode.o revlog.o pyutil.o \ - -lFuzzingEngine `$$OUT/sanpy/bin/python-config --ldflags` \ + $(LIB_FUZZING_ENGINE) `$$OUT/sanpy/bin/python-config --ldflags` \ -o $$OUT/fm1readmarkers_fuzzer fm1readmarkers_corpus.zip: