From 0812b5b31882f53bf7e92d9f69f0da70a5654f2d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 24 Nov 2014 21:11:00 +0100 Subject: [PATCH] untangle handling extra compiler .clean member it's easy when it is a simple list of files (or just absent). however, it can also contain expandos, and in this case it's definitely not a good idea to treat it partly (but not really) as a single shell command. Change-Id: I7ef32a56f276b06579fc7094357c5f7612eaf205 Reviewed-by: Joerg Bornemann --- qmake/generators/makefile.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 5c0fd046bc7..f2decd71a54 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1852,7 +1852,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) t << endl; if (config.indexOf("no_clean") == -1) { - QString tmp_clean = escapeFilePaths(project->values(ProKey(*it + ".clean"))).join(' '); + const ProStringList &raw_clean = project->values(ProKey(*it + ".clean")); + QString tmp_clean = escapeFilePaths(raw_clean).join(' '); QString tmp_clean_cmds = project->values(ProKey(*it + ".clean_commands")).join(' '); if(!tmp_inputs.isEmpty()) clean_targets += QString("compiler_" + (*it) + "_clean "); @@ -1871,28 +1872,31 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) wrote_clean = true; } if(!wrote_clean_cmds || !wrote_clean) { - ProStringList cleans; + QStringList q_raw_clean = raw_clean.toQStringList(); + QStringList cleans; const QString del_statement("-$(DEL_FILE)"); if(!wrote_clean) { - if(project->isActiveConfig("no_delete_multiple_files")) { - for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) { - QString tinp = (*input).toQString(); - cleans.append(" " + Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_clean, tinp, - replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell), TargetShell))); + QStringList dels; + for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) { + QString tinp = (*input).toQString(); + QString out = replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell); + foreach (const QString &rc, q_raw_clean) { + dels << ' ' + escapeFilePath(Option::fixPathToTargetOS( + replaceExtraCompilerVariables(rc, tinp, out, NoShell), false)); } + } + if(project->isActiveConfig("no_delete_multiple_files")) { + cleans = dels; } else { - QString files, file; + QString files; const int commandlineLimit = 2047; // NT limit, expanded - for(int input = 0; input < tmp_inputs.size(); ++input) { - QString tinp = tmp_inputs.at(input).toQString(); - file = " " + replaceExtraCompilerVariables(tmp_clean, tinp, - replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell), TargetShell); + foreach (const QString &file, dels) { if(del_statement.length() + files.length() + qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) { cleans.append(files); files.clear(); } - files += Option::fixPathToTargetOS(file); + files += file; } if(!files.isEmpty()) cleans.append(files);