diff --git a/Makefile b/Makefile index 23f1dff11..a400489bf 100644 --- a/Makefile +++ b/Makefile @@ -173,12 +173,12 @@ EXTOBJ += $(TINYXML) ###### Targets cppcheck: $(LIBOBJ) $(CLIOBJ) $(EXTOBJ) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o cppcheck $(CLIOBJ) $(LIBOBJ) $(EXTOBJ) $(LIBS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o cppcheck $(CLIOBJ) $(LIBOBJ) $(EXTOBJ) $(LIBS) $(LDFLAGS) all: cppcheck testrunner testrunner: $(TESTOBJ) $(LIBOBJ) $(EXTOBJ) cli/threadexecutor.o cli/cmdlineparser.o cli/cppcheckexecutor.o cli/filelister.o cli/pathmatch.o - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o testrunner $(TESTOBJ) $(LIBOBJ) cli/threadexecutor.o cli/cppcheckexecutor.o cli/cmdlineparser.o cli/filelister.o cli/pathmatch.o $(EXTOBJ) $(LIBS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o testrunner $(TESTOBJ) $(LIBOBJ) cli/threadexecutor.o cli/cppcheckexecutor.o cli/cmdlineparser.o cli/filelister.o cli/pathmatch.o $(EXTOBJ) $(LIBS) $(LDFLAGS) test: all ./testrunner diff --git a/tools/dmake.cpp b/tools/dmake.cpp index 39df7af19..8834c25c7 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -81,14 +81,13 @@ static void compilefiles(std::ostream &fout, const std::vector &fil static void getCppFiles(std::vector &files, const std::string &path) { - std::map filesizes; - FileLister::recursiveAddFiles(files, filesizes, path); - // only get *.cpp files.. - for (std::vector::iterator it = files.begin(); it != files.end();) { - if (it->find(".cpp") == std::string::npos) - it = files.erase(it); - else - ++it; + std::map filemap; + FileLister::recursiveAddFiles(filemap, path); + + // add *.cpp files to the "files" vector.. + for (std::map::const_iterator it = filemap.begin(); it != filemap.end(); ++it) { + if (it->first.find(".cpp") != std::string::npos) + files.push_back(it->first); } } @@ -310,10 +309,10 @@ int main(int argc, char **argv) fout << "\n###### Targets\n\n"; fout << "cppcheck: $(LIBOBJ) $(CLIOBJ) $(EXTOBJ)\n"; - fout << "\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o cppcheck $(CLIOBJ) $(LIBOBJ) $(EXTOBJ) $(LIBS)\n\n"; + fout << "\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o cppcheck $(CLIOBJ) $(LIBOBJ) $(EXTOBJ) $(LIBS) $(LDFLAGS)\n\n"; fout << "all:\tcppcheck testrunner\n\n"; fout << "testrunner: $(TESTOBJ) $(LIBOBJ) $(EXTOBJ) cli/threadexecutor.o cli/cmdlineparser.o cli/cppcheckexecutor.o cli/filelister.o cli/pathmatch.o\n"; - fout << "\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o testrunner $(TESTOBJ) $(LIBOBJ) cli/threadexecutor.o cli/cppcheckexecutor.o cli/cmdlineparser.o cli/filelister.o cli/pathmatch.o $(EXTOBJ) $(LIBS)\n\n"; + fout << "\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o testrunner $(TESTOBJ) $(LIBOBJ) cli/threadexecutor.o cli/cppcheckexecutor.o cli/cmdlineparser.o cli/filelister.o cli/pathmatch.o $(EXTOBJ) $(LIBS) $(LDFLAGS)\n\n"; fout << "test:\tall\n"; fout << "\t./testrunner\n\n"; fout << "check:\tall\n";