Skip to content

Commit

Permalink
qmake: fixify target paths of extra compilers more consistently
Browse files Browse the repository at this point in the history
... so we don't get into situations where a target has a relative path,
while another target depends on it with an absolute path.

Task-number: QTBUG-36768
Change-Id: Icc5b249914bb3f095f4a6542c30bacf5ea6f9ec9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
  • Loading branch information
ossilator authored and SmallLars committed Dec 20, 2018
1 parent f377b1d commit 3f2786e
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions qmake/generators/makefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1876,12 +1876,14 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
if (config.indexOf("combine") != -1) {
// compilers with a combined input only have one output
QString input = project->first(ProKey(*it + ".output")).toQString();
t << ' ' << escapeDependencyPath(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(tmp_out, input, QString(), NoShell)));
t << ' ' << escapeDependencyPath(fileFixify(
replaceExtraCompilerVariables(tmp_out, input, QString(), NoShell),
FileFixifyFromOutdir));
} else {
for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
t << ' ' << escapeDependencyPath(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(tmp_out, (*input).toQString(), QString(), NoShell)));
t << ' ' << escapeDependencyPath(fileFixify(
replaceExtraCompilerVariables(tmp_out, (*input).toQString(), QString(), NoShell),
FileFixifyFromOutdir));
}
}
t << endl;
Expand Down Expand Up @@ -1917,8 +1919,9 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
QString tinp = (*input).toQString();
QString out = replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell);
for (const QString &rc : qAsConst(raw_clean)) {
dels << ' ' + escapeFilePath(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(rc, tinp, out, NoShell), false));
dels << ' ' + escapeFilePath(fileFixify(
replaceExtraCompilerVariables(rc, tinp, out, NoShell),
FileFixifyFromOutdir));
}
}
if(project->isActiveConfig("no_delete_multiple_files")) {
Expand Down Expand Up @@ -2034,7 +2037,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)

QString out = replaceExtraCompilerVariables(tmp_out, QString(), QString(), NoShell);
QString cmd = replaceExtraCompilerVariables(tmp_cmd, inputs, QStringList() << out, TargetShell);
t << escapeDependencyPath(Option::fixPathToTargetOS(out)) << ":";
t << escapeDependencyPath(fileFixify(out, FileFixifyFromOutdir)) << ":";
// compiler.CONFIG+=explicit_dependencies means that ONLY compiler.depends gets to cause Makefile dependencies
if (config.indexOf("explicit_dependencies") != -1) {
t << " " << valList(escapeDependencyPaths(fileFixify(tmp_dep, FileFixifyFromOutdir)));
Expand All @@ -2046,14 +2049,16 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
}
for (ProStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
QString inpf = (*input).toQString();
QString in = Option::fixPathToTargetOS(inpf, false);
QStringList deps = findDependencies(inpf);
deps << in;
QString out = Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_out, inpf, QString(), NoShell));
QStringList deps;
deps << fileFixify(inpf, FileFixifyFromOutdir);
deps += findDependencies(inpf);
QString out = fileFixify(replaceExtraCompilerVariables(tmp_out, inpf, QString(), NoShell),
FileFixifyFromOutdir);
if(!tmp_dep.isEmpty()) {
QStringList pre_deps = fileFixify(tmp_dep, FileFixifyFromOutdir);
for(int i = 0; i < pre_deps.size(); ++i)
deps << replaceExtraCompilerVariables(pre_deps.at(i), inpf, out, NoShell);
deps << fileFixify(replaceExtraCompilerVariables(pre_deps.at(i), inpf, out, NoShell),
FileFixifyFromOutdir);
}
QString cmd = replaceExtraCompilerVariables(tmp_cmd, inpf, out, TargetShell);
// NOTE: The var -> QMAKE_COMP_var replace feature is unsupported, do not use!
Expand Down Expand Up @@ -2113,7 +2118,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
//use the depend system to find includes of these included files
QStringList inc_deps;
for(int i = 0; i < deps.size(); ++i) {
const QString dep = deps.at(i);
const QString dep = fileFixify(deps.at(i), FileFixifyFromOutdir | FileFixifyAbsolute);
if(QFile::exists(dep)) {
SourceFileType type = TYPE_UNKNOWN;
if(type == TYPE_UNKNOWN) {
Expand Down Expand Up @@ -2150,11 +2155,10 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
}
}
}
deps += inc_deps;
deps += fileFixify(inc_deps, FileFixifyFromOutdir);
}
for(int i = 0; i < deps.size(); ) {
QString &dep = deps[i];
dep = Option::fixPathToTargetOS(dep, false);
if(out == dep)
deps.removeAt(i);
else
Expand Down

0 comments on commit 3f2786e

Please sign in to comment.