From 41b919919eb05299cc382de0da7d25892a120dd5 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 2 Jan 2020 14:28:39 +0100 Subject: Purge the dep_cd_cmd parameter from callExtraCompilerDependCommand We always pass the same value. The builtins are also using exactly this "cd command" unconditionally. This deduplicates the code at the call sites of callExtraCompilerDependCommand a bit. Change-Id: I5c412c815d50afdac55e1b45021f37f2545ce8f0 Reviewed-by: Oliver Wolff --- qmake/generators/makefile.cpp | 16 ++++++---------- qmake/generators/makefile.h | 2 +- qmake/generators/win32/msvc_objectmodel.cpp | 5 +---- qmake/generators/win32/msvc_vcproj.cpp | 4 ---- 4 files changed, 8 insertions(+), 19 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 7e471f126c..8e46da521f 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1851,7 +1851,6 @@ QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString & } void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCompiler, - const QString &dep_cd_cmd, const QString &tmp_dep_cmd, const QString &inpf, const QString &tmp_out, @@ -1864,7 +1863,10 @@ void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCom QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell); if (checkCommandAvailability && !canExecute(dep_cmd)) return; - dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); + dep_cmd = QLatin1String("cd ") + + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && ") + + fixEnvVariables(dep_cmd); if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { QByteArray depData; while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc)) @@ -1916,12 +1918,6 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) FileFixifyFromOutdir); const QString tmp_cmd = project->values(ProKey(*it + ".commands")).join(' '); const QString tmp_dep_cmd = project->values(ProKey(*it + ".depend_command")).join(' '); - QString dep_cd_cmd; - if (!tmp_dep_cmd.isEmpty()) { - dep_cd_cmd = QLatin1String("cd ") - + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) - + QLatin1String(" && "); - } const bool dep_lines = (config.indexOf("dep_lines") != -1); const ProStringList &vars = project->values(ProKey(*it + ".variables")); if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) @@ -2035,7 +2031,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) deps += findDependencies(inpf); inputs += Option::fixPathToTargetOS(inpf, false); if(!tmp_dep_cmd.isEmpty() && doDepends()) { - callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf, + callExtraCompilerDependCommand(*it, tmp_dep_cmd, inpf, tmp_out, dep_lines, &deps, existingDepsOnly); } } @@ -2084,7 +2080,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) for (ProStringList::ConstIterator it3 = vars.constBegin(); it3 != vars.constEnd(); ++it3) cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); if(!tmp_dep_cmd.isEmpty() && doDepends()) { - callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf, + callExtraCompilerDependCommand(*it, tmp_dep_cmd, inpf, tmp_out, dep_lines, &deps, existingDepsOnly); //use the depend system to find includes of these included files QStringList inc_deps; diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index ab970c966f..a96b9c54da 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -84,7 +84,7 @@ protected: void writeExtraVariables(QTextStream &t); void writeExtraTargets(QTextStream &t); QString resolveDependency(const QDir &outDir, const QString &file); - void callExtraCompilerDependCommand(const ProString &extraCompiler, const QString &dep_cd_cmd, + void callExtraCompilerDependCommand(const ProString &extraCompiler, const QString &tmp_dep_cmd, const QString &inpf, const QString &tmp_out, bool dep_lines, QStringList *deps, bool existingDepsOnly, diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 2b39a4baaa..3002ce889c 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2351,10 +2351,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) if (!tmp_dep.isEmpty()) deps = tmp_dep; if (!tmp_dep_cmd.isEmpty()) { - const QString dep_cd_cmd = QLatin1String("cd ") - + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) - + QLatin1String(" && "); - Project->callExtraCompilerDependCommand(extraCompilerName, dep_cd_cmd, tmp_dep_cmd, + Project->callExtraCompilerDependCommand(extraCompilerName, tmp_dep_cmd, inFile, out, true, // dep_lines &deps, diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 80f444820a..e117f472e0 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1483,12 +1483,8 @@ void VcprojGenerator::initResourceFiles() if(!rcc_dep_cmd.isEmpty()) { const QStringList qrc_files = project->values("RESOURCES").toQStringList(); QStringList deps; - const QString rcc_dep_cd_cmd = QLatin1String("cd ") - + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) - + QLatin1String(" && "); for (const QString &qrc_file : qrc_files) { callExtraCompilerDependCommand("rcc", - rcc_dep_cd_cmd, rcc_dep_cmd, qrc_file, QString(), -- cgit v1.2.3