diff options
author | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2014-11-24 21:11:00 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-02-17 18:27:51 +0000 |
commit | 0812b5b31882f53bf7e92d9f69f0da70a5654f2d (patch) | |
tree | eb26c664956203a4574cb534d073be0522680775 /qmake/generators/makefile.cpp | |
parent | 6c4d8ee83569f281613d5395c9ddc38bf5dc6dd9 (diff) |
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 <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'qmake/generators/makefile.cpp')
-rw-r--r-- | qmake/generators/makefile.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 5c0fd046bc..f2decd71a5 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); |