summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/makefile.cpp31
-rw-r--r--qmake/generators/unix/unixmake2.cpp17
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp21
-rw-r--r--qmake/generators/win32/msvc_vcproj.h6
4 files changed, 50 insertions, 25 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 5aaaf49334..f5e8248af5 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -573,10 +573,12 @@ MakefileGenerator::init()
contentBytes = contents.toUtf8();
}
QFile out(outn);
+ QFileInfo outfi(out);
if (out.exists() && out.open(QFile::ReadOnly)) {
QByteArray old = out.readAll();
if (contentBytes == old) {
v["QMAKE_INTERNAL_INCLUDED_FILES"].append(in.fileName());
+ v["QMAKE_DISTCLEAN"].append(outfi.absoluteFilePath());
continue;
}
out.close();
@@ -586,9 +588,10 @@ MakefileGenerator::init()
continue;
}
}
- mkdir(QFileInfo(out).absolutePath());
+ mkdir(outfi.absolutePath());
if(out.open(QFile::WriteOnly)) {
v["QMAKE_INTERNAL_INCLUDED_FILES"].append(in.fileName());
+ v["QMAKE_DISTCLEAN"].append(outfi.absoluteFilePath());
out.write(contentBytes);
} else {
warn_msg(WarnLogic, "Cannot open substitute for output '%s'",
@@ -1121,6 +1124,7 @@ MakefileGenerator::writePrlFile()
if(ft.open(QIODevice::WriteOnly)) {
project->values("ALL_DEPS").append(prl);
project->values("QMAKE_INTERNAL_PRL_FILE").append(prl);
+ project->values("QMAKE_DISTCLEAN").append(prl);
QTextStream t(&ft);
writePrlFile(t);
}
@@ -1850,8 +1854,12 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
t << endl;
if (config.indexOf("no_clean") == -1) {
- const ProStringList &raw_clean = project->values(ProKey(*it + ".clean"));
- QString tmp_clean = escapeFilePaths(raw_clean).join(' ');
+ QStringList raw_clean = project->values(ProKey(*it + ".clean")).toQStringList();
+ if (raw_clean.isEmpty())
+ raw_clean << tmp_out;
+ QString tmp_clean;
+ foreach (const QString &rc, raw_clean)
+ tmp_clean += ' ' + escapeFilePath(Option::fixPathToTargetOS(rc));
QString tmp_clean_cmds = project->values(ProKey(*it + ".clean_commands")).join(' ');
if(!tmp_inputs.isEmpty())
clean_targets += QString("compiler_" + (*it) + "_clean ");
@@ -1863,14 +1871,11 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
t << "\n\t" << tmp_clean_cmds;
wrote_clean_cmds = true;
}
- if(tmp_clean.isEmpty())
- tmp_clean = escapeFilePath(tmp_out);
if(tmp_clean.indexOf("${QMAKE_") == -1) {
- t << "\n\t-$(DEL_FILE) " << tmp_clean;
+ t << "\n\t-$(DEL_FILE)" << tmp_clean;
wrote_clean = true;
}
if(!wrote_clean_cmds || !wrote_clean) {
- QStringList q_raw_clean = raw_clean.toQStringList();
QStringList cleans;
const QString del_statement("-$(DEL_FILE)");
if(!wrote_clean) {
@@ -1878,7 +1883,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
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) {
+ foreach (const QString &rc, raw_clean) {
dels << ' ' + escapeFilePath(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(rc, tinp, out, NoShell), false));
}
@@ -2569,11 +2574,11 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
t << " " << targetRule;
}
if(suffix == "all" || suffix == "make_first")
- t << depVar("ALL_DEPS");
+ t << ' ' << depVar("ALL_DEPS");
if(suffix == "clean")
- t << depVar("CLEAN_DEPS");
+ t << ' ' << depVar("CLEAN_DEPS");
else if (suffix == "distclean")
- t << depVar("DISTCLEAN_DEPS");
+ t << ' ' << depVar("DISTCLEAN_DEPS");
t << " FORCE\n";
if(suffix == "clean") {
t << fixFileVarGlue("QMAKE_CLEAN", "\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", "\n");
@@ -3159,7 +3164,9 @@ MakefileGenerator::writePkgConfigFile()
QFile ft(fname);
if(!ft.open(QIODevice::WriteOnly))
return;
- project->values("ALL_DEPS").append(fileFixify(fname));
+ QString ffname(fileFixify(fname));
+ project->values("ALL_DEPS").append(ffname);
+ project->values("QMAKE_DISTCLEAN").append(ffname);
QTextStream t(&ft);
QString prefix = pkgConfigPrefix();
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index d873e91170..50eb93cda9 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1041,9 +1041,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t-$(DEL_FILE) -r " << bundlePath << endl;
} else if(project->isActiveConfig("compile_libtool")) {
t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) $(TARGET)\n";
- } else if (project->isActiveConfig("staticlib")) {
+ } else if (project->isActiveConfig("staticlib") || project->isActiveConfig("plugin")) {
t << "\t-$(DEL_FILE) " << escapeFilePath(destdir) << "$(TARGET) \n";
- } else if (project->values("QMAKE_APP_FLAG").isEmpty() && !project->isActiveConfig("plugin")) {
+ } else if (project->values("QMAKE_APP_FLAG").isEmpty()) {
destdir = escapeFilePath(destdir);
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n";
if (!project->isActiveConfig("unversioned_libname")) {
@@ -1160,10 +1160,9 @@ void UnixMakefileGenerator::init2()
if(project->isEmpty("QMAKE_FRAMEWORK_VERSION"))
project->values("QMAKE_FRAMEWORK_VERSION").append(project->first("VER_MAJ"));
- if (project->first("TEMPLATE") == "aux")
- return;
-
- if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
+ if (project->first("TEMPLATE") == "aux") {
+ // nothing
+ } else if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
if(!project->isEmpty("QMAKE_BUNDLE")) {
ProString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION");
if(!bundle_loc.isEmpty() && !bundle_loc.startsWith("/"))
@@ -1335,7 +1334,7 @@ void UnixMakefileGenerator::init2()
project->values("QMAKE_LINK_SHLIB_CMD").append(
"$(LINK) $(LFLAGS) " + project->first("QMAKE_LINK_O_FLAG") + "$(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)");
}
- if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
+ if (!project->values("QMAKE_APP_FLAG").isEmpty() || project->first("TEMPLATE") == "aux") {
project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_APP");
project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_APP");
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_APP");
@@ -1412,7 +1411,9 @@ UnixMakefileGenerator::writeLibtoolFile()
QFile ft(fname);
if(!ft.open(QIODevice::WriteOnly))
return;
- project->values("ALL_DEPS").append(fileFixify(fname));
+ QString ffname(fileFixify(fname));
+ project->values("ALL_DEPS").append(ffname);
+ project->values("QMAKE_DISTCLEAN").append(ffname);
QTextStream t(&ft);
t << "# " << lname << " - a libtool library file\n";
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 0d78766606..1fa117afda 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -421,6 +421,24 @@ bool VcprojGenerator::isStandardSuffix(const QString &suffix) const
return false;
}
+ProString VcprojGenerator::firstInputFileName(const ProString &extraCompilerName) const
+{
+ foreach (const ProString &var, project->values(ProKey(extraCompilerName + ".input"))) {
+ const ProStringList &files = project->values(var.toKey());
+ if (!files.isEmpty())
+ return files.first();
+ }
+ return ProString();
+}
+
+QString VcprojGenerator::firstExpandedOutputFileName(const ProString &extraCompilerName)
+{
+ const ProString firstOutput = project->first(ProKey(extraCompilerName + ".output"));
+ return replaceExtraCompilerVariables(firstOutput.toQString(),
+ firstInputFileName(extraCompilerName).toQString(),
+ QString(), NoShell);
+}
+
ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QString, QString> &projLookup,
QHash<QString, QString> &projGuids,
QHash<VcsolutionDepend *, QStringList> &extraSubdirs,
@@ -1642,10 +1660,9 @@ void VcprojGenerator::initExtraCompilerOutputs()
extraCompile.Filter = "";
extraCompile.Guid = QString(_GUIDExtraCompilerFiles) + "-" + (*it);
-
// If the extra compiler has a variable_out set the output file
// is added to an other file list, and does not need its own..
- bool addOnInput = hasBuiltinCompiler(project->first(ProKey(*it + ".output")).toQString());
+ bool addOnInput = hasBuiltinCompiler(firstExpandedOutputFileName(*it));
const ProString &tmp_other_out = project->first(ProKey(*it + ".variable_out"));
if (!tmp_other_out.isEmpty() && !addOnInput)
continue;
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index 3396ea4986..35dc1e8937 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -76,10 +76,8 @@ protected:
virtual VCProjectWriter *createProjectWriter();
virtual bool doDepends() const { return false; } //never necesary
virtual void processSources() { filterIncludedFiles("SOURCES"); filterIncludedFiles("GENERATED_SOURCES"); }
- using MakefileGenerator::ReplaceFor;
+ using Win32MakefileGenerator::replaceExtraCompilerVariables;
virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &, ReplaceFor);
- inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out, ReplaceFor forShell)
- { return MakefileGenerator::replaceExtraCompilerVariables(val, in, out, forShell); }
virtual bool supportsMetaBuild() { return true; }
virtual bool supportsMergedBuilds() { return true; }
virtual bool mergeBuildProject(MakefileGenerator *other);
@@ -135,6 +133,8 @@ private:
QUuid increaseUUID(const QUuid &id);
QString retrievePlatformToolSet() const;
bool isStandardSuffix(const QString &suffix) const;
+ ProString firstInputFileName(const ProString &extraCompilerName) const;
+ QString firstExpandedOutputFileName(const ProString &extraCompilerName);
friend class VCFilter;
};