Makefile: use FUZZ_CXXFLAGS for linking fuzzers

OSS-Fuzz requires C++-specific flags to link fuzzers. Passing these in CFLAGS causes lots of build warnings. Using separate FUZZ_CXXFLAGS avoids this. Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Josh Steadmon committed Nov 14, 2018 at 11:41 UTC 927c77e7d4d1e42c1e523d4651a7fe2c9122fe32
1 file changed +4 -2
Makefile
+4 -2
@@ -3083,14 +3083,16 @@ cover_db_html: cover_db
3083 # An example command to build against libFuzzer from LLVM 4.0.0:
3084 #
3085 # make CC=clang CXX=clang++ \
3086 -# CFLAGS="-fsanitize-coverage=trace-pc-guard -fsanitize=address" \
3086 +# FUZZ_CXXFLAGS="-fsanitize-coverage=trace-pc-guard -fsanitize=address" \
3087 # LIB_FUZZING_ENGINE=/usr/lib/llvm-4.0/lib/libFuzzer.a \
3088 # fuzz-all
3089 #
3090 +FUZZ_CXXFLAGS ?= $(CFLAGS)
3091 +
3092 .PHONY: fuzz-all
3093
3094 $(FUZZ_PROGRAMS): all
3093 - $(QUIET_LINK)$(CXX) $(CFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
3095 + $(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) $(LIB_OBJS) $(BUILTIN_OBJS) \
3096 $(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@
3097
3098 fuzz-all: $(FUZZ_PROGRAMS)