de-duplicate code for writing dummy makefiles

as a side effect, this fixes the generators that were more bitrotted
(nmake and even more mingw).

Task-number: QTBUG-30644 #close
Change-Id: Iefa3f07125884412d091aa12b44935e5b1fb858a
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Oswald Buddenhagen 2013-08-26 19:51:57 +02:00 committed by The Qt Project
parent ad4bda8b75
commit b7f7edfae4
5 changed files with 22 additions and 29 deletions

View File

@ -2202,6 +2202,24 @@ MakefileGenerator::writeExtraVariables(QTextStream &t)
}
}
bool
MakefileGenerator::writeDummyMakefile(QTextStream &t)
{
if (project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty())
return false;
t << "QMAKE = " << var("QMAKE_QMAKE") << endl;
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " ";
t << "first all clean install distclean uninstall qmake_all:\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"\n\t"
<< "@echo \"Skipped.\"\n\n";
writeMakeQmake(t);
t << "FORCE:\n\n";
return true;
}
bool
MakefileGenerator::writeStubMakefile(QTextStream &t)
{

View File

@ -104,6 +104,7 @@ protected:
void writeExtraTargets(QTextStream &t);
void writeExtraCompilerTargets(QTextStream &t);
void writeExtraCompilerVariables(QTextStream &t);
bool writeDummyMakefile(QTextStream &t);
virtual bool writeStubMakefile(QTextStream &t);
virtual bool writeMakefile(QTextStream &t);

View File

@ -80,19 +80,8 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t)
{
writeHeader(t);
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
t << "QMAKE = " << var("QMAKE_QMAKE") << endl;
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " ";
t << "first all clean install distclean uninstall qmake_all:\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"\n\t"
<< "@echo \"Skipped.\"\n\n";
writeMakeQmake(t);
t << "FORCE:\n\n";
if (writeDummyMakefile(t))
return true;
}
if (project->values("TEMPLATE").first() == "app" ||
project->values("TEMPLATE").first() == "lib" ||

View File

@ -114,14 +114,8 @@ bool MingwMakefileGenerator::findLibraries()
bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
{
writeHeader(t);
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
t << "all clean:\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"\n\t"
<< "@echo \"Skipped.\"\n\n";
writeMakeQmake(t);
if (writeDummyMakefile(t))
return true;
}
if(project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib" ||

View File

@ -58,17 +58,8 @@ bool
NmakeMakefileGenerator::writeMakefile(QTextStream &t)
{
writeHeader(t);
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " ";
t << "all first clean:\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"\n\t"
<< "@echo \"Skipped.\"\n\n";
writeMakeQmake(t);
if (writeDummyMakefile(t))
return true;
}
if(project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib" ||