@@ -351,23 +351,23 @@ static void write_ossfuzz_makefile(std::vector<std::string> libfiles_prio, std::
351351
352352 fout << " # This file is generated by dmake, do not edit.\n " ;
353353 fout << ' \n ' ;
354- fout << " # make CXX=clang++ MATCHCOMPILER=yes CXXFLAGS =\" -O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION - fsanitize=address -fsanitize-address-use-after-scope -DHAVE_BOOST\" LIB_FUZZING_ENGINE=\" -fsanitize=fuzzer\" oss-fuzz-client\n " ;
354+ fout << " # make CXX=clang++ MATCHCOMPILER=yes CXXOPTS =\" -O1 -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope\" CPPOPTS= \" -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -DHAVE_BOOST\" LIB_FUZZING_ENGINE=\" -fsanitize=fuzzer\" oss-fuzz-client\n " ;
355355 fout << ' \n ' ;
356356 fout << " MATCHCOMPILER=yes\n " ; // always need to enable the matchcompiler so the library files are being copied
357357 makeMatchcompiler (fout, " ../" , " --read-dir ../lib" );
358358
359359 fout << " INCS=-I../lib -isystem../externals/simplecpp -isystem../externals/tinyxml2 -isystem../externals/picojson\n " ;
360- fout << " CPPFLAGS =-std=c++11 -g -w $(INCS)\n " ;
360+ fout << " CXXFLAGS =-std=c++11 -g -w $(INCS)\n " ;
361361 fout << ' \n ' ;
362362 fout << " LIBOBJ = " << objfiles (libfiles_prio) << " \n " ;
363363 fout << ' \n ' ;
364364 fout << " EXTOBJ = " << objfiles (extfiles) << " \n " ;
365365 fout << ' \n ' ;
366366 fout << " oss-fuzz-client: $(EXTOBJ) $(LIBOBJ) main.o type2.o\n " ;
367- fout << " \t ${CXX} $(CPPFLAGS) $ {CXXFLAGS} -o $@ $^ ${LIB_FUZZING_ENGINE}\n " ;
367+ fout << " \t ${CXX} ${CXXFLAGS} -o $@ $^ ${LIB_FUZZING_ENGINE}\n " ;
368368 fout << ' \n ' ;
369369 fout << " no-fuzz: $(EXTOBJ) $(LIBOBJ) main_nofuzz.o type2.o\n " ;
370- fout << " \t ${CXX} $(CPPFLAGS) $ {CXXFLAGS} -o $@ $^\n " ;
370+ fout << " \t ${CXX} ${CXXFLAGS} -o $@ $^\n " ;
371371 fout << ' \n ' ;
372372 fout << " translate: translate.o type2.o\n " ;
373373 fout << " \t ${CXX} -std=c++11 -g ${CXXFLAGS} -o $@ type2.cpp translate.cpp\n " ;
@@ -708,7 +708,8 @@ int main(int argc, char **argv)
708708
709709 // Makefile settings..
710710 if (release) {
711- makeConditionalVariable (fout, " CXXFLAGS" , " -O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-multichar" );
711+ makeConditionalVariable (fout, " CXXFLAGS" , " -O2 -Wall -Wno-sign-compare -Wno-multichar" );
712+ makeConditionalVariable (fout, " CPPFLAGS" , " -DNDEBUG" );
712713 } else {
713714 makeConditionalVariable (fout, " CXXFLAGS" ,
714715 " -pedantic "
@@ -726,8 +727,8 @@ int main(int argc, char **argv)
726727 " -Wno-multichar "
727728 " -Woverloaded-virtual "
728729 " -Wno-dollar-in-identifier-extension " // occurs in testrunner only
729- " $(CPPCHK_GLIBCXX_DEBUG) "
730730 " -g" );
731+ makeConditionalVariable (fout, " CPPFLAGS" , " $(CPPCHK_GLIBCXX_DEBUG)" );
731732 }
732733
733734 fout << " ifeq (g++, $(findstring g++,$(CXX)))\n "
@@ -741,7 +742,8 @@ int main(int argc, char **argv)
741742 << " ifeq ($(PCRE_CONFIG),)\n "
742743 << " $(error Did not find pcre-config)\n "
743744 << " endif\n "
744- << " override CXXFLAGS += -DHAVE_RULES $(shell $(PCRE_CONFIG) --cflags)\n "
745+ << " override CXXFLAGS += $(shell $(PCRE_CONFIG) --cflags)\n "
746+ << " override CPPFLAGS += -DHAVE_RULES\n "
745747 << " ifdef LIBS\n "
746748 << " LIBS += $(shell $(PCRE_CONFIG) --libs)\n "
747749 << " else\n "
@@ -752,6 +754,7 @@ int main(int argc, char **argv)
752754 << " endif\n\n " ;
753755
754756 fout << " override CXXFLAGS += $(CXXOPTS)\n " ;
757+ fout << " override CXPPLAGS += $(CPPOPTS)\n " ;
755758 fout << " override LDFLAGS += $(LDOPTS)\n\n " ;
756759
757760 makeConditionalVariable (fout, " PREFIX" , " /usr" );
@@ -776,7 +779,7 @@ int main(int argc, char **argv)
776779 fout << " .PHONY: run-dmake tags\n\n " ;
777780 fout << " \n ###### Targets\n\n " ;
778781 fout << " cppcheck: $(EXTOBJ) $(LIBOBJ) $(FEOBJ) $(CLIOBJ)\n " ;
779- fout << " \t $(CXX) $(CPPFLAGS) $( CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)\n\n " ;
782+ fout << " \t $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)\n\n " ;
780783 fout << " all:\t cppcheck testrunner\n\n " ;
781784 std::string testrunner_clifiles_o;
782785 for (const std::string &clifile: clifiles) {
@@ -787,7 +790,7 @@ int main(int argc, char **argv)
787790 testrunner_clifiles_o += o;
788791 }
789792 fout << " testrunner: $(EXTOBJ) $(TESTOBJ) $(LIBOBJ) $(FEOBJ)" << testrunner_clifiles_o << " \n " ;
790- fout << " \t $(CXX) $(CPPFLAGS) $( CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)\n\n " ;
793+ fout << " \t $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)\n\n " ;
791794 fout << " test:\t all\n " ;
792795 fout << " \t ./testrunner\n\n " ;
793796 fout << " check:\t all\n " ;
0 commit comments