summaryrefslogtreecommitdiffstats
path: root/qmake/generators/makefile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/generators/makefile.cpp')
-rw-r--r--qmake/generators/makefile.cpp113
1 files changed, 67 insertions, 46 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 6ef5c0c3dc..ff936bf1ee 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -892,9 +892,8 @@ MakefileGenerator::processPrlFile(QString &file, bool baseOnly)
bool
MakefileGenerator::processPrlFileBase(QString &origFile, const QStringRef &origName,
- const QStringRef &fixedBase, int slashOff)
+ const QStringRef &fixedBase, int /*slashOff*/)
{
- Q_UNUSED(slashOff)
return processPrlFileCore(origFile, origName, fixedBase + Option::prl_ext);
}
@@ -1016,6 +1015,14 @@ MakefileGenerator::writePrlFile(QTextStream &t)
for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it)
t << qv(project->values((*it).toKey()));
t << Qt::endl;
+
+ t << "QMAKE_PRL_LIBS_FOR_CMAKE = ";
+ QString sep;
+ for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it) {
+ t << sep << project->values((*it).toKey()).join(';').replace('\\', "\\\\");
+ sep = ';';
+ }
+ t << Qt::endl;
}
}
@@ -1113,7 +1120,8 @@ MakefileGenerator::writePrlFile()
&& project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()
&& project->isActiveConfig("create_prl")
&& (project->first("TEMPLATE") == "lib"
- || project->first("TEMPLATE") == "vclib")
+ || project->first("TEMPLATE") == "vclib"
+ || project->first("TEMPLATE") == "aux")
&& (!project->isActiveConfig("plugin") || project->isActiveConfig("static"))) { //write prl file
QString local_prl = prlFileName();
QString prl = fileFixify(local_prl);
@@ -2370,8 +2378,15 @@ MakefileGenerator::findSubDirsSubTargets() const
st->profile = file;
}
} else {
- if(!file.isEmpty() && !project->isActiveConfig("subdir_first_pro"))
- st->profile = file.section(Option::dir_sep, -1) + Option::pro_ext;
+ if (!file.isEmpty() && !project->isActiveConfig("subdir_first_pro")) {
+ const QString baseName = file.section(Option::dir_sep, -1);
+ if (baseName.isEmpty()) {
+ warn_msg(WarnLogic, "Ignoring invalid SUBDIRS entry %s",
+ subdirs[subdir].toLatin1().constData());
+ continue;
+ }
+ st->profile = baseName + Option::pro_ext;
+ }
st->in_directory = file;
}
while(st->in_directory.endsWith(Option::dir_sep))
@@ -3356,42 +3371,44 @@ MakefileGenerator::writePkgConfigFile()
if (!version.isEmpty())
t << "Version: " << version << Qt::endl;
- // libs
- t << "Libs: ";
- QString pkgConfiglibName;
- if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")) {
- if (libDir != QLatin1String("/Library/Frameworks"))
- t << "-F${libdir} ";
- ProString bundle;
- if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
- bundle = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME");
- else
- bundle = project->first("TARGET");
- int suffix = bundle.lastIndexOf(".framework");
- if (suffix != -1)
- bundle = bundle.left(suffix);
- t << "-framework ";
- pkgConfiglibName = bundle.toQString();
- } else {
- if (!project->values("QMAKE_DEFAULT_LIBDIRS").contains(libDir))
- t << "-L${libdir} ";
- pkgConfiglibName = "-l" + project->first("QMAKE_ORIG_TARGET");
- if (project->isActiveConfig("shared"))
- pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString();
- }
- t << shellQuote(pkgConfiglibName) << " \n";
-
- if (project->isActiveConfig("staticlib")) {
- ProStringList libs;
- libs << "LIBS"; // FIXME: this should not be conditional on staticlib
- libs << "LIBS_PRIVATE";
- libs << "QMAKE_LIBS"; // FIXME: this should not be conditional on staticlib
- libs << "QMAKE_LIBS_PRIVATE";
- libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
- t << "Libs.private:";
- for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it)
- t << ' ' << fixLibFlags((*it).toKey()).join(' ');
- t << Qt::endl;
+ if (project->first("TEMPLATE") == "lib") {
+ // libs
+ t << "Libs: ";
+ QString pkgConfiglibName;
+ if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")) {
+ if (libDir != QLatin1String("/Library/Frameworks"))
+ t << "-F${libdir} ";
+ ProString bundle;
+ if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
+ bundle = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME");
+ else
+ bundle = project->first("TARGET");
+ int suffix = bundle.lastIndexOf(".framework");
+ if (suffix != -1)
+ bundle = bundle.left(suffix);
+ t << "-framework ";
+ pkgConfiglibName = bundle.toQString();
+ } else {
+ if (!project->values("QMAKE_DEFAULT_LIBDIRS").contains(libDir))
+ t << "-L${libdir} ";
+ pkgConfiglibName = "-l" + project->first("QMAKE_ORIG_TARGET");
+ if (project->isActiveConfig("shared"))
+ pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString();
+ }
+ t << shellQuote(pkgConfiglibName) << " \n";
+
+ if (project->isActiveConfig("staticlib")) {
+ ProStringList libs;
+ libs << "LIBS"; // FIXME: this should not be conditional on staticlib
+ libs << "LIBS_PRIVATE";
+ libs << "QMAKE_LIBS"; // FIXME: this should not be conditional on staticlib
+ libs << "QMAKE_LIBS_PRIVATE";
+ libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
+ t << "Libs.private:";
+ for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it)
+ t << ' ' << fixLibFlags((*it).toKey()).join(' ');
+ t << Qt::endl;
+ }
}
// flags
@@ -3432,21 +3449,25 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt
QString ret;
if (project->isEmpty(replace_rule)
|| project->isActiveConfig("no_sed_meta_install")) {
- ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst);
+ ret += "$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst);
} else {
- ret += "-$(SED)";
+ QString sedargs;
const ProStringList &replace_rules = project->values(replace_rule);
for (int r = 0; r < replace_rules.size(); ++r) {
const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")),
replace = project->first(ProKey(replace_rules.at(r) + ".replace"));
if (!match.isEmpty() /*&& match != replace*/) {
- ret += " -e " + shellQuote("s," + match + "," + replace + ",g");
+ sedargs += " -e " + shellQuote("s," + match + "," + replace + ",g");
if (isWindowsShell() && project->first(ProKey(replace_rules.at(r) + ".CONFIG")).contains("path"))
- ret += " -e " + shellQuote("s," + windowsifyPath(match.toQString())
+ sedargs += " -e " + shellQuote("s," + windowsifyPath(match.toQString())
+ "," + windowsifyPath(replace.toQString()) + ",gi");
}
}
- ret += ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst);
+ if (sedargs.isEmpty()) {
+ ret += "$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst);
+ } else {
+ ret += "$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst);
+ }
}
return ret;
}