summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp7
-rw-r--r--qmake/generators/makefile.cpp56
-rw-r--r--qmake/generators/projectgenerator.cpp2
-rw-r--r--qmake/generators/projectgenerator.h2
-rw-r--r--qmake/generators/unix/unixmake.cpp80
-rw-r--r--qmake/generators/unix/unixmake2.cpp21
-rw-r--r--qmake/generators/win32/winmakefile.cpp12
7 files changed, 121 insertions, 59 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index b4ae89c0a9..d1c70900fb 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -516,7 +516,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
//HEADER
const int pbVersion = pbuilderVersion();
ProStringList buildConfigGroups;
- buildConfigGroups << "PROJECTTARGET";
+ buildConfigGroups << "PROJECT" << "TARGET";
t << "// !$*UTF8*$!\n"
<< "{\n"
@@ -1099,10 +1099,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
if (useCopyResourcesPhase) {
if (!project->isEmpty("ICON")) {
ProString icon = project->first("ICON");
- if (icon.length() >= 2 && (icon.at(0) == '"' || icon.at(0) == '\'') && icon.endsWith(icon.at(0))) {
+ if (icon.length() >= 2 && (icon.at(0) == '"' || icon.at(0) == '\'') && icon.endsWith(icon.at(0)))
icon = icon.mid(1, icon.length() - 2);
- bundle_resources_files += keyFor(icon + ".BUILDABLE");
- }
+ bundle_resources_files += keyFor(icon + ".BUILDABLE");
}
QString grp("Copy Bundle Resources"), key = keyFor(grp);
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 0264dbf37e..a8ae84a4e2 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -1984,17 +1984,29 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
QStringList dep_cmd_deps = indeps.replace('\n', ' ').simplified().split(' ');
for(int i = 0; i < dep_cmd_deps.count(); ++i) {
QString &file = dep_cmd_deps[i];
- if(!exists(file)) {
+ QString absFile = QDir(Option::output_dir).absoluteFilePath(file);
+ if (exists(absFile)) {
+ file = absFile;
+ } else {
QString localFile;
QList<QMakeLocalFileName> depdirs = QMakeSourceFileInfo::dependencyPaths();
- for(QList<QMakeLocalFileName>::Iterator it = depdirs.begin();
- it != depdirs.end(); ++it) {
- if(exists((*it).real() + Option::dir_sep + file)) {
- localFile = (*it).local() + Option::dir_sep + file;
+ for (QList<QMakeLocalFileName>::Iterator dit = depdirs.begin();
+ dit != depdirs.end(); ++dit) {
+ if (exists((*dit).real() + Option::dir_sep + file)) {
+ localFile = (*dit).local() + Option::dir_sep + file;
break;
}
}
- file = localFile;
+ if (localFile.isEmpty()) {
+ if (exists(file))
+ warn_msg(WarnDeprecated, ".depend_command for extra compiler %s"
+ " prints paths relative to source directory",
+ (*it).toLatin1().constData());
+ else
+ file.clear();
+ } else {
+ file = localFile;
+ }
}
if(!file.isEmpty())
file = fileFixify(file);
@@ -2062,17 +2074,29 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
QStringList dep_cmd_deps = indeps.replace('\n', ' ').simplified().split(' ');
for(int i = 0; i < dep_cmd_deps.count(); ++i) {
QString &file = dep_cmd_deps[i];
- if(!exists(file)) {
+ QString absFile = QDir(Option::output_dir).absoluteFilePath(file);
+ if (exists(absFile)) {
+ file = absFile;
+ } else {
QString localFile;
QList<QMakeLocalFileName> depdirs = QMakeSourceFileInfo::dependencyPaths();
- for(QList<QMakeLocalFileName>::Iterator it = depdirs.begin();
- it != depdirs.end(); ++it) {
- if(exists((*it).real() + Option::dir_sep + file)) {
- localFile = (*it).local() + Option::dir_sep + file;
+ for (QList<QMakeLocalFileName>::Iterator dit = depdirs.begin();
+ dit != depdirs.end(); ++dit) {
+ if (exists((*dit).real() + Option::dir_sep + file)) {
+ localFile = (*dit).local() + Option::dir_sep + file;
break;
}
}
- file = localFile;
+ if (localFile.isEmpty()) {
+ if (exists(file))
+ warn_msg(WarnDeprecated, ".depend_command for extra compiler %s"
+ " prints paths relative to source directory",
+ (*it).toLatin1().constData());
+ else
+ file.clear();
+ } else {
+ file = localFile;
+ }
}
if(!file.isEmpty())
file = fileFixify(file);
@@ -2738,12 +2762,8 @@ QString
MakefileGenerator::unescapeFilePath(const QString &path) const
{
QString ret = path;
- if(!ret.isEmpty()) {
- if(ret.contains(QLatin1String("\\ ")))
- ret.replace(QLatin1String("\\ "), QLatin1String(" "));
- if(ret.contains(QLatin1Char('\"')))
- ret.remove(QLatin1Char('\"'));
- }
+ ret.replace(QLatin1String("\\ "), QLatin1String(" "));
+ ret.remove(QLatin1Char('\"'));
return ret;
}
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp
index 54208de27e..3cd5a22a33 100644
--- a/qmake/generators/projectgenerator.cpp
+++ b/qmake/generators/projectgenerator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
+** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake application of the Qt Toolkit.
**
diff --git a/qmake/generators/projectgenerator.h b/qmake/generators/projectgenerator.h
index 019ff9de44..621a9eb977 100644
--- a/qmake/generators/projectgenerator.h
+++ b/qmake/generators/projectgenerator.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
+** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake application of the Qt Toolkit.
**
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 948fd2b79c..adeb55af86 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -641,7 +641,7 @@ UnixMakefileGenerator::processPrlFiles()
ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
if(!prl_libs.isEmpty()) {
for(int prl = 0; prl < prl_libs.size(); ++prl)
- l.insert(lit+prl+1, prl_libs.at(prl));
+ l.insert(lit+prl+1, escapeFilePath(prl_libs.at(prl).toQString()));
prl_libs.clear();
}
}
@@ -727,7 +727,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
if(t != "target" || project->first("TEMPLATE") == "subdirs")
return QString();
- bool bundle = false;
+ enum { NoBundle, SolidBundle, SlicedBundle } bundle = NoBundle;
const QString root = "$(INSTALL_ROOT)";
ProStringList &uninst = project->values(ProKey(t + ".uninstall"));
QString ret, destdir = project->first("DESTDIR").toQString();
@@ -743,7 +743,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
const ProStringList &targets = project->values(ProKey(t + ".targets"));
if(!project->isEmpty("QMAKE_BUNDLE")) {
target = project->first("QMAKE_BUNDLE").toQString();
- bundle = true;
+ bundle = project->isActiveConfig("sliced_bundle") ? SlicedBundle : SolidBundle;
} else if(project->first("TEMPLATE") == "app") {
target = "$(QMAKE_TARGET)";
} else if(project->first("TEMPLATE") == "lib") {
@@ -768,7 +768,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
uninst.append("-$(DEL_FILE) \"" + dst + "\"");
}
- if(!bundle && project->isActiveConfig("compile_libtool")) {
+ if (bundle == NoBundle && project->isActiveConfig("compile_libtool")) {
QString src_targ = target;
if(src_targ == "$(TARGET)")
src_targ = "$(TARGETL)";
@@ -781,23 +781,36 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
QString src_targ = target;
if(!destdir.isEmpty())
src_targ = Option::fixPathToTargetOS(destdir + target, false);
- QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + target, FileFixifyAbsolute));
- if(bundle) {
- if(!ret.isEmpty())
- ret += "\n\t";
- ret += "$(DEL_FILE) -r \"" + dst_targ + "\"\n\t";
+ QString plain_targ = filePrefixRoot(root, fileFixify(targetdir + target, FileFixifyAbsolute));
+ QString dst_targ = plain_targ;
+ if (bundle != NoBundle) {
+ QString suffix;
+ if (project->first("TEMPLATE") == "lib")
+ suffix = "/Versions/" + project->first("QMAKE_FRAMEWORK_VERSION") + "/$(TARGET)";
+ else
+ suffix = "/" + project->first("QMAKE_BUNDLE_LOCATION") + "/$(QMAKE_TARGET)";
+ dst_targ += suffix;
+ if (bundle == SolidBundle) {
+ if (!ret.isEmpty())
+ ret += "\n\t";
+ ret += "$(DEL_FILE) -r \"" + plain_targ + "\"\n\t";
+ } else {
+ src_targ += suffix;
+ }
}
if(!ret.isEmpty())
ret += "\n\t";
QString copy_cmd("-");
- if (bundle)
- copy_cmd += "$(INSTALL_DIR)";
- else if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib"))
- copy_cmd += "$(INSTALL_FILE)";
- else
- copy_cmd += "$(INSTALL_PROGRAM)";
- copy_cmd += " \"" + src_targ + "\" \"" + dst_targ + "\"";
+ if (bundle == SolidBundle) {
+ copy_cmd += "$(INSTALL_DIR) \"" + src_targ + "\" \"" + plain_targ + "\"";
+ } else if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib")) {
+ copy_cmd += "$(INSTALL_FILE) \"" + src_targ + "\" \"" + dst_targ + "\"";
+ } else {
+ if (bundle == SlicedBundle)
+ ret += mkdir_p_asstring("\"`dirname \"" + dst_targ + "\"`\"", false) + "\n\t";
+ copy_cmd += "$(INSTALL_PROGRAM) \"" + src_targ + "\" \"" + dst_targ + "\"";
+ }
if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib")
&& project->values(ProKey(t + ".CONFIG")).indexOf("fix_rpath") != -1) {
if(!project->isEmpty("QMAKE_FIX_RPATH")) {
@@ -819,21 +832,36 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
ret += QString("\n\t$(RANLIB) \"") + dst_targ + "\"";
} else if(!project->isActiveConfig("debug") && !project->isActiveConfig("nostrip") && !project->isEmpty("QMAKE_STRIP")) {
ret += "\n\t-$(STRIP)";
- if(project->first("TEMPLATE") == "lib" && !project->isEmpty("QMAKE_STRIPFLAGS_LIB"))
- ret += " " + var("QMAKE_STRIPFLAGS_LIB");
- else if(project->first("TEMPLATE") == "app" && !project->isEmpty("QMAKE_STRIPFLAGS_APP"))
- ret += " " + var("QMAKE_STRIPFLAGS_APP");
- if(bundle)
- ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\"";
- else
- ret += " \"" + dst_targ + "\"";
+ if (project->first("TEMPLATE") == "lib") {
+ if (!project->isEmpty("QMAKE_STRIPFLAGS_LIB"))
+ ret += " " + var("QMAKE_STRIPFLAGS_LIB");
+ } else if (project->first("TEMPLATE") == "app") {
+ if (!project->isEmpty("QMAKE_STRIPFLAGS_APP"))
+ ret += " " + var("QMAKE_STRIPFLAGS_APP");
+ }
+ ret += " \"" + dst_targ + "\"";
}
if(!uninst.isEmpty())
uninst.append("\n\t");
- if(bundle)
- uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\"");
+ if (bundle == SolidBundle)
+ uninst.append("-$(DEL_FILE) -r \"" + plain_targ + "\"");
else
uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
+ if (bundle == SlicedBundle) {
+ int dstlen = project->first("DESTDIR").length();
+ foreach (const ProString &src, project->values("QMAKE_BUNDLED_FILES")) {
+ QString file = unescapeFilePath(src.toQString()).mid(dstlen);
+ QString dst = filePrefixRoot(root, fileFixify(targetdir + file, FileFixifyAbsolute));
+ if (!ret.isEmpty())
+ ret += "\n\t";
+ ret += mkdir_p_asstring("\"`dirname \"" + dst + "\"`\"", false) + "\n\t";
+ ret += "-$(DEL_FILE) \"" + dst + "\"\n\t"; // Can't overwrite symlinks to directories
+ ret += "-$(INSTALL_DIR) " + src + " \"" + dst + "\""; // Use cp -R to copy symlinks
+ if (!uninst.isEmpty())
+ uninst.append("\n\t");
+ uninst.append("-$(DEL_FILE) \"" + dst + "\"");
+ }
+ }
if(!links.isEmpty()) {
for(int i = 0; i < links.size(); ++i) {
if (target_mode == TARG_UNIX_MODE || target_mode == TARG_MAC_MODE) {
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index c81b7d8d12..e4d33e2d4e 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -118,6 +118,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
(!project->isActiveConfig("staticlib")))),
src_incremental=false;
+ ProStringList &bundledFiles = project->values("QMAKE_BUNDLED_FILES");
+
t << "####### Compiler, tools and options\n\n";
t << "CC = " << var("QMAKE_CC") << endl;
t << "CXX = " << var("QMAKE_CXX") << endl;
@@ -555,18 +557,19 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\n\t" << var("QMAKE_POST_LINK");
t << endl << endl;
} else if(!project->isEmpty("QMAKE_BUNDLE")) {
+ QString currentLink = destdir + "Versions/Current";
+ bundledFiles << currentLink << destdir + "$(TARGET)";
t << "\n\t"
<< "-$(DEL_FILE) $(TARGET) $(TARGET0) $(DESTDIR)$(TARGET0)\n\t"
<< var("QMAKE_LINK_SHLIB_CMD") << "\n\t"
<< mkdir_p_asstring("\"`dirname $(DESTDIR)$(TARGETD)`\"", false) << "\n\t"
<< "-$(MOVE) $(TARGET) $(DESTDIR)$(TARGETD)\n\t"
<< mkdir_p_asstring("\"`dirname $(DESTDIR)$(TARGET0)`\"", false) << "\n\t"
- << varGlue("QMAKE_LN_SHLIB","-"," "," Versions/" +
- project->first("QMAKE_FRAMEWORK_VERSION") +
- "/$(TARGET) $(DESTDIR)$(TARGET0)") << "\n\t"
- << "-$(DEL_FILE) " << destdir << "Versions/Current\n\t"
+ << varGlue("QMAKE_LN_SHLIB", "-", " ",
+ " Versions/Current/$(TARGET) $(DESTDIR)$(TARGET0)") << "\n\t"
+ << "-$(DEL_FILE) " << currentLink << "\n\t"
<< varGlue("QMAKE_LN_SHLIB","-"," ", " " + project->first("QMAKE_FRAMEWORK_VERSION") +
- " " + destdir + "Versions/Current") << "\n\t";
+ " " + currentLink) << "\n\t";
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\n\t" << var("QMAKE_POST_LINK");
t << endl << endl;
@@ -704,6 +707,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
if(!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) {
ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE"));
+ bundledFiles << resources;
QString destdir = escapeFilePath(project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources");
t << resources << ": \n\t";
t << mkdir_p_asstring(destdir) << "\n\t";
@@ -713,6 +717,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
//copy the plist
QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString())),
info_plist_out = escapeFilePath(project->first("QMAKE_INFO_PLIST_OUT").toQString());
+ bundledFiles << info_plist_out;
QString destdir = info_plist_out.section(Option::dir_sep, 0, -2);
t << info_plist_out << ": \n\t";
if(!destdir.isEmpty())
@@ -737,6 +742,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if(!project->isEmpty("ICON")) {
QString dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources/";
const QString icon_path = escapeFilePath(dir + icon.section(Option::dir_sep, -1));
+ bundledFiles << icon_path;
t << icon_path << ": " << icon << "\n\t"
<< mkdir_p_asstring(dir) << "\n\t"
<< "@$(DEL_FILE) " << icon_path << "\n\t"
@@ -765,7 +771,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (!project->isEmpty(vkey)) {
QString version = project->first(vkey) + "/" +
project->first("QMAKE_FRAMEWORK_VERSION") + "/";
- t << Option::fixPathToLocalOS(path + project->first(pkey)) << ": \n\t"
+ QString link = Option::fixPathToLocalOS(path + project->first(pkey));
+ bundledFiles << link;
+ t << link << ": \n\t"
<< mkdir_p_asstring(path) << "\n\t"
<< "@$(SYMLINK) " << version << project->first(pkey) << " " << path << endl;
path += version;
@@ -779,6 +787,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
src = fn;
src = escapeFilePath(src);
const QString dst = escapeFilePath(path + Option::dir_sep + fileInfo(fn).fileName());
+ bundledFiles << dst;
t << dst << ": " << src << "\n\t"
<< mkdir_p_asstring(path) << "\n\t";
QFileInfo fi(fileInfo(fn));
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index fe85efc8ba..2ef2d82b5a 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -241,8 +241,14 @@ Win32MakefileGenerator::processPrlFiles()
}
}
ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
- for (int prl = 0; prl < prl_libs.size(); ++prl)
- l.insert(lit + prl + 1, prl_libs.at(prl));
+ for (int prl = 0; prl < prl_libs.size(); ++prl) {
+ ProString arg = prl_libs.at(prl);
+ if (arg.startsWith(libArg))
+ arg = arg.left(libArg.length()) + escapeFilePath(arg.mid(libArg.length()).toQString());
+ else if (!arg.startsWith('/'))
+ arg = escapeFilePath(arg.toQString());
+ l.insert(lit + prl + 1, arg);
+ }
prl_libs.clear();
}
@@ -899,8 +905,8 @@ QString Win32MakefileGenerator::escapeFilePath(const QString &path) const
QString Win32MakefileGenerator::cQuoted(const QString &str)
{
QString ret = str;
- ret.replace(QLatin1Char('"'), QStringLiteral("\\\""));
ret.replace(QLatin1Char('\\'), QStringLiteral("\\\\"));
+ ret.replace(QLatin1Char('"'), QStringLiteral("\\\""));
ret.prepend(QLatin1Char('"'));
ret.append(QLatin1Char('"'));
return ret;