Skip to content

Commit c07576e

Browse files
committed
dmake: generating unix makefile from windows. Ticket: cppcheck-opensource#3887
When you commit the generated Makefile from windows you must probably be careful about the line endings.
1 parent df55ce1 commit c07576e

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

tools/dmake.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,21 @@ static void makeExtObj(std::ostream &fout, const std::vector<std::string> &exter
125125
for (unsigned int i = 0; i < externalfiles.size(); ++i) {
126126
if (start) {
127127
libName = getLibName(externalfiles[i]);
128-
fout << "ifndef " << libName << std::endl;
128+
fout << "ifndef " << libName << "\n";
129129
fout << " " << libName << " = " << objfile(externalfiles[i]);
130-
libNames << "EXTOBJ += $(" << libName << ")" << std::endl;
130+
libNames << "EXTOBJ += $(" << libName << ")\n";
131131
start = false;
132132
} else {
133133
fout << std::string(14, ' ') << objfile(externalfiles[i]);
134134
}
135135

136136
if (i+1 >= externalfiles.size() || libName != getLibName(externalfiles[i+1])) {
137137
// This was the last file for this library
138-
fout << std::endl << "endif" << std::endl;
139-
fout << "\n\n";
138+
fout << "\nendif\n\n\n";
140139
start = true;
141140
} else {
142141
// There are more files for this library
143-
fout << " \\" << std::endl;
142+
fout << " \\\n";
144143
}
145144
}
146145

@@ -331,15 +330,15 @@ int main(int argc, char **argv)
331330
fout << "\n###### Object Files\n\n";
332331
fout << "LIBOBJ = " << objfile(libfiles[0]);
333332
for (unsigned int i = 1; i < libfiles.size(); ++i)
334-
fout << " \\" << std::endl << std::string(14, ' ') << objfile(libfiles[i]);
333+
fout << " \\\n" << std::string(14, ' ') << objfile(libfiles[i]);
335334
fout << "\n\n";
336335
fout << "CLIOBJ = " << objfile(clifiles[0]);
337336
for (unsigned int i = 1; i < clifiles.size(); ++i)
338-
fout << " \\" << std::endl << std::string(14, ' ') << objfile(clifiles[i]);
337+
fout << " \\\n" << std::string(14, ' ') << objfile(clifiles[i]);
339338
fout << "\n\n";
340339
fout << "TESTOBJ = " << objfile(testfiles[0]);
341340
for (unsigned int i = 1; i < testfiles.size(); ++i)
342-
fout << " \\" << std::endl << std::string(14, ' ') << objfile(testfiles[i]);
341+
fout << " \\\n" << std::string(14, ' ') << objfile(testfiles[i]);
343342
fout << "\n\n";
344343

345344
makeExtObj(fout, externalfiles);
@@ -359,9 +358,6 @@ int main(int argc, char **argv)
359358
fout << "reduce:\ttools/reduce.cpp\n";
360359
fout << "\t$(CXX) -g -o reduce tools/reduce.cpp -Ilib lib/*.cpp\n\n";
361360
fout << "clean:\n";
362-
#ifdef _WIN32
363-
fout << "\tdel build\\*.o\n\tdel lib\\*.o\n\tdel cli\\*.o\n\tdel test\\*.o\n\tdel *.exe\n";
364-
#else
365361
fout << "\trm -f build/*.o lib/*.o cli/*.o test/*.o externals/tinyxml/*.o testrunner reduce cppcheck cppcheck.1\n\n";
366362
fout << "man:\tman/cppcheck.1\n\n";
367363
fout << "man/cppcheck.1:\t$(MAN_SOURCE)\n\n";
@@ -371,7 +367,6 @@ int main(int argc, char **argv)
371367
fout << "install: cppcheck\n";
372368
fout << "\tinstall -d ${BIN}\n";
373369
fout << "\tinstall cppcheck ${BIN}\n\n";
374-
#endif
375370

376371
fout << "\n###### Build\n\n";
377372

0 commit comments

Comments
 (0)