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.cpp351
1 files changed, 177 insertions, 174 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index a963c38178..ff936bf1ee 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -94,13 +94,6 @@ bool MakefileGenerator::mkdir(const QString &in_path) const
return QDir().mkpath(path);
}
-// ** base makefile generator
-MakefileGenerator::MakefileGenerator() :
- no_io(false), project(nullptr)
-{
-}
-
-
void
MakefileGenerator::verifyCompilers()
{
@@ -206,7 +199,6 @@ MakefileGenerator::initOutPaths()
ProStringList &inputs = project->values((*it2).toKey());
for (ProStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
QString finp = fileFixify((*input).toQString(), FileFixifyFromOutdir);
- *input = ProString(finp);
QString path = replaceExtraCompilerVariables(tmp_out, finp, QString(), NoShell);
path = Option::normalizePath(path);
int slash = path.lastIndexOf('/');
@@ -994,25 +986,25 @@ MakefileGenerator::writePrlFile(QTextStream &t)
QString bdir = Option::output_dir;
if(bdir.isEmpty())
bdir = qmake_getpwd();
- t << "QMAKE_PRL_BUILD_DIR =" << qv(bdir) << endl;
+ t << "QMAKE_PRL_BUILD_DIR =" << qv(bdir) << Qt::endl;
- t << "QMAKE_PRO_INPUT =" << qv(project->projectFile().section('/', -1)) << endl;
+ t << "QMAKE_PRO_INPUT =" << qv(project->projectFile().section('/', -1)) << Qt::endl;
if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH"))
- t << "QMAKE_PRL_SOURCE_DIR =" << qv(project->first("QMAKE_ABSOLUTE_SOURCE_PATH")) << endl;
- t << "QMAKE_PRL_TARGET =" << qv(project->first("LIB_TARGET")) << endl;
+ t << "QMAKE_PRL_SOURCE_DIR =" << qv(project->first("QMAKE_ABSOLUTE_SOURCE_PATH")) << Qt::endl;
+ t << "QMAKE_PRL_TARGET =" << qv(project->first("LIB_TARGET")) << Qt::endl;
if(!project->isEmpty("PRL_EXPORT_DEFINES"))
- t << "QMAKE_PRL_DEFINES =" << qv(project->values("PRL_EXPORT_DEFINES")) << endl;
+ t << "QMAKE_PRL_DEFINES =" << qv(project->values("PRL_EXPORT_DEFINES")) << Qt::endl;
if(!project->isEmpty("PRL_EXPORT_CFLAGS"))
- t << "QMAKE_PRL_CFLAGS =" << qv(project->values("PRL_EXPORT_CFLAGS")) << endl;
+ t << "QMAKE_PRL_CFLAGS =" << qv(project->values("PRL_EXPORT_CFLAGS")) << Qt::endl;
if(!project->isEmpty("PRL_EXPORT_CXXFLAGS"))
- t << "QMAKE_PRL_CXXFLAGS =" << qv(project->values("PRL_EXPORT_CXXFLAGS")) << endl;
+ t << "QMAKE_PRL_CXXFLAGS =" << qv(project->values("PRL_EXPORT_CXXFLAGS")) << Qt::endl;
if(!project->isEmpty("CONFIG"))
- t << "QMAKE_PRL_CONFIG =" << qv(project->values("CONFIG")) << endl;
+ t << "QMAKE_PRL_CONFIG =" << qv(project->values("CONFIG")) << Qt::endl;
if(!project->isEmpty("TARGET_VERSION_EXT"))
- t << "QMAKE_PRL_VERSION = " << project->first("TARGET_VERSION_EXT") << endl;
+ t << "QMAKE_PRL_VERSION = " << project->first("TARGET_VERSION_EXT") << Qt::endl;
else if(!project->isEmpty("VERSION"))
- t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << endl;
+ t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << Qt::endl;
if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) {
ProStringList libs;
if (!project->isActiveConfig("staticlib"))
@@ -1022,7 +1014,7 @@ MakefileGenerator::writePrlFile(QTextStream &t)
t << "QMAKE_PRL_LIBS =";
for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it)
t << qv(project->values((*it).toKey()));
- t << endl;
+ t << Qt::endl;
t << "QMAKE_PRL_LIBS_FOR_CMAKE = ";
QString sep;
@@ -1030,7 +1022,7 @@ MakefileGenerator::writePrlFile(QTextStream &t)
t << sep << project->values((*it).toKey()).join(';').replace('\\', "\\\\");
sep = ';';
}
- t << endl;
+ t << Qt::endl;
}
}
@@ -1061,17 +1053,17 @@ MakefileGenerator::writeProjectMakefile()
//install
t << "install: ";
- for(it = targets.begin(); it != targets.end(); ++it)
- t << (*it)->target << "-install ";
- t << endl;
+ for (SubTarget *s : qAsConst(targets))
+ t << s->target << '-';
+ t << "install " << Qt::endl;
//uninstall
t << "uninstall: ";
for(it = targets.begin(); it != targets.end(); ++it)
t << (*it)->target << "-uninstall ";
- t << endl;
+ t << Qt::endl;
} else {
- t << "first: " << targets.first()->target << endl
+ t << "first: " << targets.first()->target << Qt::endl
<< "install: " << targets.first()->target << "-install\n"
<< "uninstall: " << targets.first()->target << "-uninstall\n";
}
@@ -1080,7 +1072,7 @@ MakefileGenerator::writeProjectMakefile()
if(!project->isActiveConfig("no_autoqmake")) {
QString mkf = escapeDependencyPath(fileFixify(Option::output.fileName()));
for(QList<SubTarget*>::Iterator it = targets.begin(); it != targets.end(); ++it)
- t << escapeDependencyPath((*it)->makefile) << ": " << mkf << endl;
+ t << escapeDependencyPath((*it)->makefile) << ": " << mkf << Qt::endl;
}
qDeleteAll(targets);
return true;
@@ -1195,7 +1187,7 @@ MakefileGenerator::writeObj(QTextStream &t, const char *src)
p.replace(stringObj, escapeFilePath(dstf));
t << "\n\t" << p;
}
- t << endl << endl;
+ t << Qt::endl << Qt::endl;
}
}
@@ -1310,9 +1302,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
dst_file += fi.fileName();
QString cmd;
if (is_target || (!fi.isDir() && fi.isExecutable()))
- cmd = QLatin1String("-$(QINSTALL_PROGRAM)");
+ cmd = QLatin1String("$(QINSTALL_PROGRAM)");
else
- cmd = QLatin1String("-$(QINSTALL)");
+ cmd = QLatin1String("$(QINSTALL)");
cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file);
inst << cmd;
if (!noStrip && !project->isActiveConfig("debug_info") && !project->isActiveConfig("nostrip") &&
@@ -1332,9 +1324,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
dst_file += filestr;
QString cmd;
if (installConfigValues.contains("executable"))
- cmd = QLatin1String("-$(QINSTALL_PROGRAM)");
+ cmd = QLatin1String("$(QINSTALL_PROGRAM)");
else
- cmd = QLatin1String("-$(QINSTALL)");
+ cmd = QLatin1String("$(QINSTALL)");
cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file);
inst << cmd;
uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + filestr, FileFixifyAbsolute, false))));
@@ -1347,7 +1339,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
if (!dst_file.endsWith(Option::dir_sep))
dst_file += Option::dir_sep;
dst_file += fi.fileName();
- QString cmd = QLatin1String("-$(QINSTALL) ") +
+ QString cmd = QLatin1String("$(QINSTALL) ") +
escapeFilePath(dirstr + file) + " " + escapeFilePath(dst_file);
inst << cmd;
if (!noStrip && !project->isActiveConfig("debug_info") && !project->isActiveConfig("nostrip") &&
@@ -1389,14 +1381,14 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
QString tmp_dst = fileFixify((*pit).toQString(), FileFixifyAbsolute, false);
t << mkdir_p_asstring(filePrefixRoot(root, tmp_dst)) << "\n\t";
}
- t << target << endl << endl;
+ t << target << Qt::endl << Qt::endl;
if(!uninst.isEmpty()) {
t << "uninstall_" << (*it) << ": FORCE";
for (int i = uninst.size(); --i >= 0; )
t << "\n\t" << uninst.at(i);
t << "\n\t-$(DEL_DIR) " << escapeFilePath(filePrefixRoot(root, dst)) << " \n\n";
}
- t << endl;
+ t << Qt::endl;
if (installConfigValues.indexOf("no_default_install") == -1) {
all_installs += QString("install_") + (*it) + " ";
@@ -1833,7 +1825,7 @@ MakefileGenerator::writeExtraTargets(QTextStream &t)
t << escapeDependencyPath(targ) << ":" << deps;
if(!cmd.isEmpty())
t << "\n\t" << cmd;
- t << endl << endl;
+ t << Qt::endl << Qt::endl;
}
}
@@ -1878,6 +1870,55 @@ QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString &
return {};
}
+void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCompiler,
+ const QString &dep_cd_cmd,
+ const QString &tmp_dep_cmd,
+ const QString &inpf,
+ const QString &tmp_out,
+ bool dep_lines,
+ QStringList *deps)
+{
+ char buff[256];
+ QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell);
+ dep_cmd = dep_cd_cmd + 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))
+ depData.append(buff, read_in);
+ QT_PCLOSE(proc);
+ const QString indeps = QString::fromLocal8Bit(depData);
+ if (indeps.isEmpty())
+ return;
+ QDir outDir(Option::output_dir);
+ QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
+ for (int i = 0; i < dep_cmd_deps.count(); ++i) {
+ QString &file = dep_cmd_deps[i];
+ const QString absFile = outDir.absoluteFilePath(file);
+ if (absFile == file) {
+ // already absolute; don't do any checks.
+ } else if (exists(absFile)) {
+ file = absFile;
+ } else {
+ const QString localFile = resolveDependency(outDir, file);
+ if (localFile.isEmpty()) {
+ if (exists(file)) {
+ warn_msg(WarnDeprecated, ".depend_command for extra compiler %s"
+ " prints paths relative to source directory",
+ extraCompiler.toLatin1().constData());
+ } else {
+ file = absFile; // fallback for generated resources
+ }
+ } else {
+ file = localFile;
+ }
+ }
+ if (!file.isEmpty())
+ file = fileFixify(file);
+ }
+ deps->append(dep_cmd_deps);
+ }
+}
+
void
MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
{
@@ -1925,7 +1966,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
FileFixifyFromOutdir));
}
}
- t << endl;
+ t << Qt::endl;
if (config.indexOf("no_clean") == -1) {
QStringList raw_clean = project->values(ProKey(*it + ".clean")).toQStringList();
@@ -1990,7 +2031,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
}
}
}
- t << endl;
+ t << Qt::endl;
}
QStringList tmp_dep = project->values(ProKey(*it + ".depends")).toQStringList();
if (config.indexOf("combine") != -1) {
@@ -2007,44 +2048,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
deps += findDependencies(inpf);
inputs += Option::fixPathToTargetOS(inpf, false);
if(!tmp_dep_cmd.isEmpty() && doDepends()) {
- char buff[256];
- QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell);
- dep_cmd = dep_cd_cmd + 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))
- depData.append(buff, read_in);
- QT_PCLOSE(proc);
- const QString indeps = QString::fromLocal8Bit(depData);
- if(!indeps.isEmpty()) {
- QDir outDir(Option::output_dir);
- QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
- for(int i = 0; i < dep_cmd_deps.count(); ++i) {
- QString &file = dep_cmd_deps[i];
- QString absFile = outDir.absoluteFilePath(file);
- if (absFile == file) {
- // already absolute; don't do any checks.
- } else if (exists(absFile)) {
- file = absFile;
- } else {
- QString localFile = resolveDependency(outDir, file);
- 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 = absFile; // fallback for generated resources
- } else {
- file = localFile;
- }
- }
- if(!file.isEmpty())
- file = fileFixify(file);
- }
- deps += dep_cmd_deps;
- }
- }
+ callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf,
+ tmp_out, dep_lines, &deps);
}
}
for(int i = 0; i < inputs.size(); ) {
@@ -2071,7 +2076,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
} else {
t << " " << valList(escapeDependencyPaths(inputs)) << " " << valList(finalizeDependencyPaths(deps));
}
- t << "\n\t" << cmd << endl << endl;
+ t << "\n\t" << cmd << Qt::endl << Qt::endl;
continue;
}
for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) {
@@ -2092,44 +2097,8 @@ 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()) {
- char buff[256];
- QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, out, LocalShell);
- dep_cmd = dep_cd_cmd + 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))
- depData.append(buff, read_in);
- QT_PCLOSE(proc);
- const QString indeps = QString::fromLocal8Bit(depData);
- if(!indeps.isEmpty()) {
- QDir outDir(Option::output_dir);
- QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
- for(int i = 0; i < dep_cmd_deps.count(); ++i) {
- QString &file = dep_cmd_deps[i];
- QString absFile = outDir.absoluteFilePath(file);
- if (absFile == file) {
- // already absolute; don't do any checks.
- } else if (exists(absFile)) {
- file = absFile;
- } else {
- QString localFile = resolveDependency(outDir, file);
- 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 = absFile; // fallback for generated resources
- } else {
- file = localFile;
- }
- }
- if(!file.isEmpty())
- file = fileFixify(file);
- }
- deps += dep_cmd_deps;
- }
- }
+ callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf,
+ tmp_out, dep_lines, &deps);
//use the depend system to find includes of these included files
QStringList inc_deps;
for(int i = 0; i < deps.size(); ++i) {
@@ -2180,10 +2149,10 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
++i;
}
t << escapeDependencyPath(out) << ": " << valList(finalizeDependencyPaths(deps)) << "\n\t"
- << cmd << endl << endl;
+ << cmd << Qt::endl << Qt::endl;
}
}
- t << "compiler_clean: " << clean_targets << endl << endl;
+ t << "compiler_clean: " << clean_targets << Qt::endl << Qt::endl;
}
void
@@ -2199,17 +2168,17 @@ MakefileGenerator::writeExtraCompilerVariables(QTextStream &t)
first = false;
}
t << "QMAKE_COMP_" << (*varit) << " = "
- << valList(project->values((*varit).toKey())) << endl;
+ << valList(project->values((*varit).toKey())) << Qt::endl;
}
}
if(!first)
- t << endl;
+ t << Qt::endl;
}
void
MakefileGenerator::writeExtraVariables(QTextStream &t)
{
- t << endl;
+ t << Qt::endl;
ProStringList outlist;
const ProValueMap &vars = project->variables();
@@ -2223,7 +2192,7 @@ MakefileGenerator::writeExtraVariables(QTextStream &t)
}
if (!outlist.isEmpty()) {
t << "####### Custom Variables\n";
- t << outlist.join('\n') << endl << endl;
+ t << outlist.join('\n') << Qt::endl << Qt::endl;
}
}
@@ -2239,11 +2208,11 @@ MakefileGenerator::writeExportedVariables(QTextStream &t)
const ProString &name = project->first(ProKey(exp + ".name"));
const ProString &value = project->first(ProKey(exp + ".value"));
if (!value.isEmpty())
- t << name << " = " << value << endl;
+ t << name << " = " << value << Qt::endl;
else
t << name << " =\n";
}
- t << endl;
+ t << Qt::endl;
}
bool
@@ -2251,7 +2220,7 @@ MakefileGenerator::writeDummyMakefile(QTextStream &t)
{
if (project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty())
return false;
- t << "QMAKE = " << var("QMAKE_QMAKE") << endl;
+ t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl;
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " ";
@@ -2267,7 +2236,7 @@ MakefileGenerator::writeDummyMakefile(QTextStream &t)
bool
MakefileGenerator::writeStubMakefile(QTextStream &t)
{
- t << "QMAKE = " << var("QMAKE_QMAKE") << endl;
+ t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl;
const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " ";
@@ -2296,22 +2265,22 @@ MakefileGenerator::writeMakefile(QTextStream &t)
void
MakefileGenerator::writeDefaultVariables(QTextStream &t)
{
- t << "QMAKE = " << var("QMAKE_QMAKE") << endl;
- t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
- t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
- t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
- t << "COPY = " << var("QMAKE_COPY") << endl;
- t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl;
- t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl;
- t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl;
- t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl;
- t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl;
- t << "QINSTALL = " << var("QMAKE_QMAKE") << " -install qinstall" << endl;
- t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall -exe" << endl;
- t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
- t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl;
- t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
- t << "MOVE = " << var("QMAKE_MOVE") << endl;
+ t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl;
+ t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << Qt::endl;
+ t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << Qt::endl;
+ t << "MKDIR = " << var("QMAKE_MKDIR") << Qt::endl;
+ t << "COPY = " << var("QMAKE_COPY") << Qt::endl;
+ t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << Qt::endl;
+ t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << Qt::endl;
+ t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << Qt::endl;
+ t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << Qt::endl;
+ t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << Qt::endl;
+ t << "QINSTALL = " << var("QMAKE_QMAKE") << " -install qinstall" << Qt::endl;
+ t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall -exe" << Qt::endl;
+ t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << Qt::endl;
+ t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << Qt::endl;
+ t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << Qt::endl;
+ t << "MOVE = " << var("QMAKE_MOVE") << Qt::endl;
}
QString MakefileGenerator::buildArgs(bool withExtra)
@@ -2352,18 +2321,18 @@ void
MakefileGenerator::writeHeader(QTextStream &t)
{
t << "#############################################################################\n";
- t << "# Makefile for building: " << escapeFilePath(var("TARGET")) << endl;
+ t << "# Makefile for building: " << escapeFilePath(var("TARGET")) << Qt::endl;
t << "# Generated by qmake (" QMAKE_VERSION_STR ") (Qt " QT_VERSION_STR ")\n";
- t << "# Project: " << fileFixify(project->projectFile()) << endl;
- t << "# Template: " << var("TEMPLATE") << endl;
+ t << "# Project: " << fileFixify(project->projectFile()) << Qt::endl;
+ t << "# Template: " << var("TEMPLATE") << Qt::endl;
if(!project->isActiveConfig("build_pass"))
- t << "# Command: " << build_args().replace(QLatin1String("$(QMAKE)"), var("QMAKE_QMAKE")) << endl;
+ t << "# Command: " << build_args().replace(QLatin1String("$(QMAKE)"), var("QMAKE_QMAKE")) << Qt::endl;
t << "#############################################################################\n";
- t << endl;
+ t << Qt::endl;
QString ofile = Option::fixPathToTargetOS(Option::output.fileName());
if (ofile.lastIndexOf(Option::dir_sep) != -1)
ofile.remove(0, ofile.lastIndexOf(Option::dir_sep) +1);
- t << "MAKEFILE = " << escapeFilePath(ofile) << endl << endl;
+ t << "MAKEFILE = " << escapeFilePath(ofile) << Qt::endl << Qt::endl;
t << "EQ = =\n\n";
}
@@ -2502,7 +2471,7 @@ MakefileGenerator::writeSubDirs(QTextStream &t)
void MakefileGenerator::writeSubMakeCall(QTextStream &t, const QString &callPrefix,
const QString &makeArguments)
{
- t << callPrefix << "$(MAKE)" << makeArguments << endl;
+ t << callPrefix << "$(MAKE)" << makeArguments << Qt::endl;
}
void
@@ -2521,20 +2490,30 @@ MakefileGenerator::writeSubTargetCall(QTextStream &t,
writeSubMakeCall(t, out_directory_cdin + pfx, makefilein);
}
+static void chopEndLines(QString *s)
+{
+ while (!s->isEmpty()) {
+ const ushort c = s->at(s->size() - 1).unicode();
+ if (c != '\n' && c != '\r')
+ break;
+ s->chop(1);
+ }
+}
+
void
MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubTarget*> targets, int flags)
{
// blasted includes
const ProStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES");
for (ProStringList::ConstIterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it)
- t << "include " << (*qeui_it) << endl;
+ t << "include " << (*qeui_it) << Qt::endl;
if (!(flags & SubTargetSkipDefaultVariables)) {
writeDefaultVariables(t);
t << "SUBTARGETS = "; // subtargets are sub-directory
for(int target = 0; target < targets.size(); ++target)
t << " \\\n\t\t" << targets.at(target)->target;
- t << endl << endl;
+ t << Qt::endl << Qt::endl;
}
writeExtraVariables(t);
@@ -2546,6 +2525,14 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
<< QString((flags & SubTargetInstalls) ? "uninstall_subtargets" : "uninstall");
}
+ struct SequentialInstallData
+ {
+ QString targetPrefix;
+ QString commands;
+ QTextStream commandsStream;
+ SequentialInstallData() : commandsStream(&commands) {}
+ };
+ std::unique_ptr<SequentialInstallData> sequentialInstallData;
bool dont_recurse = project->isActiveConfig("dont_recurse");
// generate target rules
@@ -2590,7 +2577,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
if (!dont_recurse)
writeSubMakeCall(t, out_directory_cdin, makefilein + " qmake_all");
else
- t << endl;
+ t << Qt::endl;
}
{ //actually compile
@@ -2614,6 +2601,16 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
else if(s == "make_first")
s = QString();
+ if (project->isActiveConfig("build_all") && s == "install") {
+ if (!sequentialInstallData)
+ sequentialInstallData.reset(new SequentialInstallData);
+ sequentialInstallData->targetPrefix += subtarget->target + '-';
+ writeSubTargetCall(sequentialInstallData->commandsStream, in_directory, in,
+ out_directory, out, out_directory_cdin,
+ makefilein + " " + s);
+ chopEndLines(&sequentialInstallData->commands);
+ }
+
if(flags & SubTargetOrdered) {
t << subtarget->target << "-" << targetSuffixes.at(suffix) << "-ordered:";
if(target)
@@ -2631,7 +2628,12 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
out_directory_cdin, makefilein + " " + s);
}
}
- t << endl;
+ t << Qt::endl;
+
+ if (sequentialInstallData) {
+ t << sequentialInstallData->targetPrefix << "install: FORCE"
+ << sequentialInstallData->commands << Qt::endl << Qt::endl;
+ }
if (!(flags & SubTargetSkipDefaultTargets)) {
writeMakeQmake(t, true);
@@ -2680,7 +2682,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
} else if(suffix == "distclean") {
QString ofile = fileFixify(Option::output.fileName());
if(!ofile.isEmpty())
- t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << endl;
+ t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << Qt::endl;
t << fixFileVarGlue("QMAKE_DISTCLEAN", "\t-$(DEL_FILE) ", " ", "\n");
}
}
@@ -2693,7 +2695,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
cmd = var(ProKey(*qut_it + ".commands")), deps;
if(targ.isEmpty())
targ = (*qut_it).toQString();
- t << endl;
+ t << Qt::endl;
const ProStringList &deplist = project->values(ProKey(*qut_it + ".depends"));
for (ProStringList::ConstIterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
@@ -2706,7 +2708,8 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
QSet<QString> recurse;
const ProKey rkey(*qut_it + ".recurse");
if (project->isSet(rkey)) {
- recurse = project->values(rkey).toQStringList().toSet();
+ const QStringList values = project->values(rkey).toQStringList();
+ recurse = QSet<QString>(values.begin(), values.end());
} else {
for(int target = 0; target < targets.size(); ++target)
recurse.insert(targets.at(target)->name);
@@ -2768,7 +2771,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
deps += " FORCE";
t << escapeDependencyPath(Option::fixPathToTargetOS(targ, false)) << ":" << deps << "\n";
if(!cmd.isEmpty())
- t << "\t" << cmd << endl;
+ t << "\t" << cmd << Qt::endl;
}
if(flags & SubTargetInstalls) {
@@ -2786,7 +2789,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) {
QStringList files = escapeFilePaths(fileFixify(Option::mkfile::project_files));
t << escapeDependencyPath(project->first("QMAKE_INTERNAL_PRL_FILE").toQString()) << ": \n\t"
- << "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs(true) << endl;
+ << "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs(true) << Qt::endl;
}
QString qmake = build_args();
@@ -2805,10 +2808,10 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
}
const ProStringList &included = escapeDependencyPaths(project->values("QMAKE_INTERNAL_INCLUDED_FILES"));
t << included.join(QString(" \\\n\t\t")) << "\n\t"
- << qmake << endl;
+ << qmake << Qt::endl;
const ProStringList &extraCommands = project->values("QMAKE_MAKE_QMAKE_EXTRA_COMMANDS");
if (!extraCommands.isEmpty())
- t << "\t" << extraCommands.join(QString("\n\t")) << endl;
+ t << "\t" << extraCommands.join(QString("\n\t")) << Qt::endl;
for(int include = 0; include < included.size(); ++include) {
const ProString &i = included.at(include);
if(!i.isEmpty())
@@ -2816,7 +2819,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
}
}
if(project->first("QMAKE_ORIG_TARGET") != "qmake") {
- t << "qmake: FORCE\n\t@" << qmake << endl << endl;
+ t << "qmake: FORCE\n\t@" << qmake << Qt::endl << Qt::endl;
if (!noDummyQmakeAll)
t << "qmake_all: FORCE\n\n";
}
@@ -3308,11 +3311,11 @@ MakefileGenerator::writePkgConfigFile()
if(includeDir.isEmpty())
includeDir = prefix + "/include";
- t << "prefix=" << prefix << endl;
+ t << "prefix=" << prefix << Qt::endl;
t << "exec_prefix=${prefix}\n"
<< "libdir=" << pkgConfigFixPath(libDir) << "\n"
- << "includedir=" << pkgConfigFixPath(includeDir) << endl;
- t << endl;
+ << "includedir=" << pkgConfigFixPath(includeDir) << Qt::endl;
+ t << Qt::endl;
//extra PKGCONFIG variables
const ProStringList &pkgconfig_vars = project->values("QMAKE_PKGCONFIG_VARIABLES");
@@ -3333,17 +3336,17 @@ MakefileGenerator::writePkgConfigFile()
}
}
if (!val.isEmpty())
- t << var << "=" << val << endl;
+ t << var << "=" << val << Qt::endl;
}
- t << endl;
+ t << Qt::endl;
QString name = project->first("QMAKE_PKGCONFIG_NAME").toQString();
if(name.isEmpty()) {
name = project->first("QMAKE_ORIG_TARGET").toQString().toLower();
name.replace(0, 1, name[0].toUpper());
}
- t << "Name: " << name << endl;
+ t << "Name: " << name << Qt::endl;
QString desc = project->values("QMAKE_PKGCONFIG_DESCRIPTION").join(' ');
if(desc.isEmpty()) {
if(name.isEmpty()) {
@@ -3361,12 +3364,12 @@ MakefileGenerator::writePkgConfigFile()
desc += " Application";
}
}
- t << "Description: " << desc << endl;
+ t << "Description: " << desc << Qt::endl;
ProString version = project->first("QMAKE_PKGCONFIG_VERSION");
if (version.isEmpty())
version = project->first("VERSION");
if (!version.isEmpty())
- t << "Version: " << version << endl;
+ t << "Version: " << version << Qt::endl;
if (project->first("TEMPLATE") == "lib") {
// libs
@@ -3404,7 +3407,7 @@ MakefileGenerator::writePkgConfigFile()
t << "Libs.private:";
for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it)
t << ' ' << fixLibFlags((*it).toKey()).join(' ');
- t << endl;
+ t << Qt::endl;
}
}
@@ -3423,15 +3426,15 @@ MakefileGenerator::writePkgConfigFile()
&& libDir != QLatin1String("/Library/Frameworks")) {
t << " -F${libdir}";
}
- t << endl;
+ t << Qt::endl;
// requires
const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(' ');
if (!requires.isEmpty()) {
- t << "Requires: " << requires << endl;
+ t << "Requires: " << requires << Qt::endl;
}
- t << endl;
+ t << Qt::endl;
}
static QString windowsifyPath(const QString &str)
@@ -3446,7 +3449,7 @@ 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 {
QString sedargs;
const ProStringList &replace_rules = project->values(replace_rule);
@@ -3461,9 +3464,9 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt
}
}
if (sedargs.isEmpty()) {
- ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst);
+ ret += "$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst);
} else {
- ret += "-$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst);
+ ret += "$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst);
}
}
return ret;