Skip to content

Commit

Permalink
dmake: do not hard-code cli dependencies for testrunner target
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Jan 1, 2025
1 parent 03192c6 commit 60ed228
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ cppcheck: $(EXTOBJ) $(LIBOBJ) $(CLIOBJ)

all: cppcheck testrunner

testrunner: $(EXTOBJ) $(TESTOBJ) $(LIBOBJ) cli/executor.o cli/processexecutor.o cli/singleexecutor.o cli/threadexecutor.o cli/cmdlineparser.o cli/cppcheckexecutor.o cli/sehwrapper.o cli/signalhandler.o cli/stacktrace.o cli/filelister.o
testrunner: $(EXTOBJ) $(TESTOBJ) $(LIBOBJ) cli/cmdlineparser.o cli/cppcheckexecutor.o cli/executor.o cli/filelister.o cli/processexecutor.o cli/sehwrapper.o cli/signalhandler.o cli/singleexecutor.o cli/stacktrace.o cli/threadexecutor.o
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)

test: all
Expand Down
11 changes: 9 additions & 2 deletions tools/dmake/dmake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,15 @@ int main(int argc, char **argv)
fout << "cppcheck: $(EXTOBJ) $(LIBOBJ) $(CLIOBJ)\n";
fout << "\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)\n\n";
fout << "all:\tcppcheck testrunner\n\n";
// TODO: generate from clifiles
fout << "testrunner: $(EXTOBJ) $(TESTOBJ) $(LIBOBJ) cli/executor.o cli/processexecutor.o cli/singleexecutor.o cli/threadexecutor.o cli/cmdlineparser.o cli/cppcheckexecutor.o cli/sehwrapper.o cli/signalhandler.o cli/stacktrace.o cli/filelister.o\n";
std::string testrunner_clifiles_o;
for (const std::string &clifile: clifiles) {
if (clifile == "cli/main.cpp")
continue;
testrunner_clifiles_o += ' ';
const std::string o = clifile.substr(0, clifile.length()-3) + 'o';
testrunner_clifiles_o += o;
}
fout << "testrunner: $(EXTOBJ) $(TESTOBJ) $(LIBOBJ)" << testrunner_clifiles_o << "\n";
fout << "\t$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS) $(RDYNAMIC)\n\n";
fout << "test:\tall\n";
fout << "\t./testrunner\n\n";
Expand Down

0 comments on commit 60ed228

Please sign in to comment.