automatically fix separators in QMAKE_{DIST,}CLEAN

it's a tad insane to expect the user to do that

Change-Id: I75c68f2a28656c9ba2e3fabcc79718b899b29ce7
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2012-07-12 12:08:42 +02:00 committed by Qt by Nokia
parent 4499a911c4
commit 9651738f2d
5 changed files with 17 additions and 6 deletions

View File

@ -8,5 +8,5 @@
QMAKE_LFLAGS += /MANIFEST $$quote(/MANIFESTFILE:\"$${MANIFEST_DIR}\\$${NOPATH_TARGET}.intermediate.manifest\")
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK
QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);2)$$QMAKE_POST_LINK
QMAKE_CLEAN += \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\"
QMAKE_CLEAN += $$MANIFEST_DIR/$${NOPATH_TARGET}.intermediate.manifest
}

View File

@ -8,5 +8,5 @@ if(win32-msvc2005*|win32-msvc2008*|win32-msvc2010*):equals(TEMPLATE, "app") {
QMAKE_LFLAGS += /MANIFEST $$quote(/MANIFESTFILE:\"$${MANIFEST_DIR}\\$${NOPATH_TARGET}.intermediate.manifest\")
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK
QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);1)$$QMAKE_POST_LINK
QMAKE_CLEAN += \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\"
QMAKE_CLEAN += $$MANIFEST_DIR/$${NOPATH_TARGET}.intermediate.manifest
}

View File

@ -1435,6 +1435,15 @@ MakefileGenerator::varGlue(const QString &var, const QString &before, const QStr
return valGlue(project->values(var), before, glue, after);
}
QString
MakefileGenerator::fileVarGlue(const QString &var, const QString &before, const QString &glue, const QString &after)
{
QStringList varList;
foreach (const QString &val, project->values(var))
varList << escapeFilePath(Option::fixPathToTargetOS(val));
return valGlue(varList, before, glue, after);
}
QString
MakefileGenerator::valGlue(const QStringList &varList, const QString &before, const QString &glue, const QString &after)
{
@ -2595,12 +2604,12 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
t << " FORCE";
t << endl;
if(suffix == "clean") {
t << varGlue("QMAKE_CLEAN","\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ", "\n");
t << fileVarGlue("QMAKE_CLEAN", "\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", "\n");
} else if(suffix == "distclean") {
QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName()));
if(!ofile.isEmpty())
t << "\t-$(DEL_FILE) " << ofile << endl;
t << varGlue("QMAKE_DISTCLEAN","\t-$(DEL_FILE) "," ","\n");
t << fileVarGlue("QMAKE_DISTCLEAN", "\t-$(DEL_FILE) ", " ", "\n");
} else if(project->isActiveConfig("no_empty_targets")) {
t << "\t" << "@cd ." << endl;
}

View File

@ -223,6 +223,7 @@ protected:
//for retrieving values and lists of values
virtual QString var(const QString &var);
QString varGlue(const QString &var, const QString &before, const QString &glue, const QString &after);
QString fileVarGlue(const QString &var, const QString &before, const QString &glue, const QString &after);
QString varList(const QString &var);
QString val(const QStringList &varList);
QString valGlue(const QStringList &varList, const QString &before, const QString &glue, const QString &after);

View File

@ -593,12 +593,13 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
const QString del_statement("-$(DEL_FILE)");
if(project->isActiveConfig("no_delete_multiple_files")) {
for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
t << "\n\t" << del_statement << " " << escapeFilePath((*it));
t << "\n\t" << del_statement << " "
<< escapeFilePath(Option::fixPathToTargetOS(*it));
} else {
QString files, file;
const int commandlineLimit = 2047; // NT limit, expanded
for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
file = " " + escapeFilePath((*it));
file = " " + escapeFilePath(Option::fixPathToTargetOS(*it));
if(del_statement.length() + files.length() +
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
t << "\n\t" << del_statement << files;