@@ -351,23 +351,29 @@ static void write_ossfuzz_makefile(std::vector<std::string> libfiles_prio, std::
351
351
352
352
fout << " # This file is generated by dmake, do not edit.\n " ;
353
353
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 " ;
355
355
fout << ' \n ' ;
356
356
fout << " MATCHCOMPILER=yes\n " ; // always need to enable the matchcompiler so the library files are being copied
357
357
makeMatchcompiler (fout, " ../" , " --read-dir ../lib" );
358
358
359
359
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 << ' \n ' ;
361
+ fout << " override CXXFLAGS+=-std=c++11 -g -w\n " ;
362
+ fout << " override CPPFLAGS+=$(INCS)\n " ;
363
+ fout << ' \n ' ;
364
+ fout << " override CXXFLAGS += $(CXXOPTS)\n " ;
365
+ fout << " override CPPFLAGS += $(CPPOPTS)\n " ;
366
+ fout << " override LDFLAGS += $(LDOPTS)\n " ;
361
367
fout << ' \n ' ;
362
368
fout << " LIBOBJ = " << objfiles (libfiles_prio) << " \n " ;
363
369
fout << ' \n ' ;
364
370
fout << " EXTOBJ = " << objfiles (extfiles) << " \n " ;
365
371
fout << ' \n ' ;
366
372
fout << " oss-fuzz-client: $(EXTOBJ) $(LIBOBJ) main.o type2.o\n " ;
367
- fout << " \t ${CXX} $(CPPFLAGS) $ {CXXFLAGS} -o $@ $^ ${LIB_FUZZING_ENGINE}\n " ;
373
+ fout << " \t ${CXX} ${CXXFLAGS} -o $@ $^ ${LIB_FUZZING_ENGINE}\n " ;
368
374
fout << ' \n ' ;
369
375
fout << " no-fuzz: $(EXTOBJ) $(LIBOBJ) main_nofuzz.o type2.o\n " ;
370
- fout << " \t ${CXX} $(CPPFLAGS) $ {CXXFLAGS} -o $@ $^\n " ;
376
+ fout << " \t ${CXX} ${CXXFLAGS} -o $@ $^\n " ;
371
377
fout << ' \n ' ;
372
378
fout << " translate: translate.o type2.o\n " ;
373
379
fout << " \t ${CXX} -std=c++11 -g ${CXXFLAGS} -o $@ type2.cpp translate.cpp\n " ;
@@ -708,7 +714,8 @@ int main(int argc, char **argv)
708
714
709
715
// Makefile settings..
710
716
if (release) {
711
- makeConditionalVariable (fout, " CXXFLAGS" , " -O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-multichar" );
717
+ makeConditionalVariable (fout, " CXXFLAGS" , " -O2 -Wall -Wno-sign-compare -Wno-multichar" );
718
+ fout << " override CPPFLAGS += -DNDEBUG\n\n " ;
712
719
} else {
713
720
makeConditionalVariable (fout, " CXXFLAGS" ,
714
721
" -pedantic "
@@ -725,8 +732,8 @@ int main(int argc, char **argv)
725
732
" -Wno-sign-compare "
726
733
" -Wno-multichar "
727
734
" -Woverloaded-virtual "
728
- // "$(CPPCHK_GLIBCXX_DEBUG) " // TODO: when using CXXOPTS this would always be set - need to handle this differently
729
735
" -g" );
736
+ // fout << "override CPPFLAGS += $(CPPCHK_GLIBCXX_DEBUG)\n\n"; // TODO: when using CXXOPTS this would always be set - need to handle this differently
730
737
}
731
738
732
739
fout << " ifeq (g++, $(findstring g++,$(CXX)))\n "
@@ -740,7 +747,8 @@ int main(int argc, char **argv)
740
747
<< " ifeq ($(PCRE_CONFIG),)\n "
741
748
<< " $(error Did not find pcre-config)\n "
742
749
<< " endif\n "
743
- << " override CXXFLAGS += -DHAVE_RULES $(shell $(PCRE_CONFIG) --cflags)\n "
750
+ << " override CXXFLAGS += $(shell $(PCRE_CONFIG) --cflags)\n "
751
+ << " override CPPFLAGS += -DHAVE_RULES\n "
744
752
<< " ifdef LIBS\n "
745
753
<< " LIBS += $(shell $(PCRE_CONFIG) --libs)\n "
746
754
<< " else\n "
@@ -751,6 +759,7 @@ int main(int argc, char **argv)
751
759
<< " endif\n\n " ;
752
760
753
761
fout << " override CXXFLAGS += $(CXXOPTS)\n " ;
762
+ fout << " override CPPFLAGS += $(CPPOPTS)\n " ;
754
763
fout << " override LDFLAGS += $(LDOPTS)\n\n " ;
755
764
756
765
makeConditionalVariable (fout, " PREFIX" , " /usr" );
@@ -775,7 +784,7 @@ int main(int argc, char **argv)
775
784
fout << " .PHONY: run-dmake tags\n\n " ;
776
785
fout << " \n ###### Targets\n\n " ;
777
786
fout << " cppcheck: $(EXTOBJ) $(LIBOBJ) $(FEOBJ) $(CLIOBJ)\n " ;
778
- fout << " \t $(CXX) $(CPPFLAGS) $( CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)\n\n " ;
787
+ fout << " \t $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)\n\n " ;
779
788
fout << " all:\t cppcheck testrunner\n\n " ;
780
789
std::string testrunner_clifiles_o;
781
790
for (const std::string &clifile: clifiles) {
@@ -786,7 +795,7 @@ int main(int argc, char **argv)
786
795
testrunner_clifiles_o += o;
787
796
}
788
797
fout << " testrunner: $(EXTOBJ) $(TESTOBJ) $(LIBOBJ) $(FEOBJ)" << testrunner_clifiles_o << " \n " ;
789
- fout << " \t $(CXX) $(CPPFLAGS) $( CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)\n\n " ;
798
+ fout << " \t $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)\n\n " ;
790
799
fout << " test:\t all\n " ;
791
800
fout << " \t ./testrunner\n\n " ;
792
801
fout << " check:\t all\n " ;
0 commit comments