summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/makefile.cpp39
-rw-r--r--qmake/generators/makefile.h3
-rw-r--r--qmake/generators/metamakefile.cpp33
-rw-r--r--qmake/generators/unix/unixmake.cpp19
-rw-r--r--qmake/generators/unix/unixmake.h1
-rw-r--r--qmake/generators/unix/unixmake2.cpp2
-rw-r--r--qmake/generators/win32/mingw_make.cpp48
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp4
8 files changed, 47 insertions, 102 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index ff936bf1ee..2082bd6dc3 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -167,14 +167,8 @@ MakefileGenerator::initOutPaths()
ProString &pathRef = v[dkey].first();
pathRef = fileFixify(pathRef.toQString(), FileFixifyFromOutdir);
-#ifdef Q_OS_WIN
- // We don't want to add a separator for DLLDESTDIR on Windows (###why?)
- if (dkey != "DLLDESTDIR")
-#endif
- {
- if(!pathRef.endsWith(Option::dir_sep))
- pathRef += Option::dir_sep;
- }
+ if (!pathRef.endsWith(Option::dir_sep))
+ pathRef += Option::dir_sep;
if (noIO() || (project->first("TEMPLATE") == "subdirs"))
continue;
@@ -2234,21 +2228,6 @@ MakefileGenerator::writeDummyMakefile(QTextStream &t)
}
bool
-MakefileGenerator::writeStubMakefile(QTextStream &t)
-{
- 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 << " ";
- //const QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName()));
- t << "first all clean install distclean uninstall: qmake\n"
- << "qmake_all:\n";
- writeMakeQmake(t);
- t << "FORCE:\n\n";
- return true;
-}
-
-bool
MakefileGenerator::writeMakefile(QTextStream &t)
{
t << "####### Compile\n\n";
@@ -2299,9 +2278,9 @@ QString MakefileGenerator::buildArgs(bool withExtra)
//could get stored argv, but then it would have more options than are
//probably necesary this will try to guess the bare minimum..
-QString MakefileGenerator::build_args()
+QString MakefileGenerator::fullBuildArgs()
{
- QString ret = "$(QMAKE)";
+ QString ret;
//output
QString ofile = fileFixify(Option::output.fileName());
@@ -2326,7 +2305,7 @@ MakefileGenerator::writeHeader(QTextStream &t)
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")) << Qt::endl;
+ t << "# Command: " << var("QMAKE_QMAKE") << fullBuildArgs() << Qt::endl;
t << "#############################################################################\n";
t << Qt::endl;
QString ofile = Option::fixPathToTargetOS(Option::output.fileName());
@@ -2792,7 +2771,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
<< "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs(true) << Qt::endl;
}
- QString qmake = build_args();
+ QString qmake = "$(QMAKE)" + fullBuildArgs();
if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) {
t << escapeDependencyPath(ofile) << ": "
<< escapeDependencyPath(fileFixify(project->projectFile())) << " ";
@@ -3429,9 +3408,9 @@ MakefileGenerator::writePkgConfigFile()
t << Qt::endl;
// requires
- const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(' ');
- if (!requires.isEmpty()) {
- t << "Requires: " << requires << Qt::endl;
+ const QString requiresString = project->values("QMAKE_PKGCONFIG_REQUIRES").join(' ');
+ if (!requiresString.isEmpty()) {
+ t << "Requires: " << requiresString << Qt::endl;
}
t << Qt::endl;
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index c7b2bee0b4..ac1d5abb11 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -58,7 +58,7 @@ class MakefileGenerator : protected QMakeSourceFileInfo
bool resolveDependenciesInFrameworks = false;
QHash<QString, bool> init_compiler_already;
QString makedir, chkexists;
- QString build_args();
+ QString fullBuildArgs();
//internal caches
mutable QHash<QString, QMakeLocalFileName> depHeuristicsCache;
@@ -90,7 +90,6 @@ protected:
void writeExtraCompilerTargets(QTextStream &t);
void writeExtraCompilerVariables(QTextStream &t);
bool writeDummyMakefile(QTextStream &t);
- virtual bool writeStubMakefile(QTextStream &t);
virtual bool writeMakefile(QTextStream &t);
virtual void writeDefaultVariables(QTextStream &t);
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index f9159ccd75..705ad7008a 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -57,6 +57,7 @@ private:
QList<Build *> makefiles;
void clearBuilds();
MakefileGenerator *processBuild(const ProString &);
+ void accumulateVariableFromBuilds(const ProKey &name, Build *build) const;
public:
@@ -95,9 +96,6 @@ BuildsMetaMakefileGenerator::init()
if(builds.count() > 1 && Option::output.fileName() == "-") {
use_single_build = true;
warn_msg(WarnLogic, "Cannot direct to stdout when using multiple BUILDS.");
- } else if(0 && !use_single_build && project->first("TEMPLATE") == "subdirs") {
- use_single_build = true;
- warn_msg(WarnLogic, "Cannot specify multiple builds with TEMPLATE subdirs.");
}
if(!use_single_build) {
for(int i = 0; i < builds.count(); i++) {
@@ -188,6 +186,7 @@ BuildsMetaMakefileGenerator::write()
if(!build->makefile) {
ret = false;
} else if(build == glue) {
+ accumulateVariableFromBuilds("QMAKE_INTERNAL_INCLUDED_FILES", build);
ret = build->makefile->writeProjectMakefile();
} else {
ret = build->makefile->write();
@@ -230,6 +229,16 @@ MakefileGenerator
return nullptr;
}
+void BuildsMetaMakefileGenerator::accumulateVariableFromBuilds(const ProKey &name, Build *dst) const
+{
+ ProStringList &values = dst->makefile->projectFile()->values(name);
+ for (auto build : makefiles) {
+ if (build != dst)
+ values += build->makefile->projectFile()->values(name);
+ }
+ values.removeDuplicates();
+}
+
class SubdirsMetaMakefileGenerator : public MetaMakefileGenerator
{
protected:
@@ -327,17 +336,13 @@ SubdirsMetaMakefileGenerator::init()
hasError |= tmpError;
}
sub->makefile = MetaMakefileGenerator::createMetaGenerator(sub_proj, sub_name);
- if(0 && sub->makefile->type() == SUBDIRSMETATYPE) {
- subs.append(sub);
- } else {
- const QString output_name = Option::output.fileName();
- Option::output.setFileName(sub->output_file);
- hasError |= !sub->makefile->write();
- delete sub;
- qmakeClearCaches();
- sub = nullptr;
- Option::output.setFileName(output_name);
- }
+ const QString output_name = Option::output.fileName();
+ Option::output.setFileName(sub->output_file);
+ hasError |= !sub->makefile->write();
+ delete sub;
+ qmakeClearCaches();
+ sub = nullptr;
+ Option::output.setFileName(output_name);
Option::output_dir = old_output_dir;
qmake_setpwd(oldpwd);
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index ef55af365c..227dc8908a 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -497,21 +497,20 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
// Make sure we keep the dependency order of libraries
lflags[arch].removeAll(opt);
lflags[arch].append(opt);
- } else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
- if (opt.length() > 10) {
- opt = opt.mid(10).trimmed();
- } else {
- opt = l.at(++lit);
- if (opt.startsWith("-Xarch"))
- opt = l.at(++lit); // The user has done the right thing and prefixed each part
- }
+ } else if (target_mode == TARG_MAC_MODE
+ && (opt == "-framework" || opt == "-force_load")) {
+ // Handle space separated options
+ ProString dashOpt = opt;
+ opt = l.at(++lit);
+ if (opt.startsWith("-Xarch"))
+ opt = l.at(++lit); // The user has done the right thing and prefixed each part
for(int x = 0; x < lflags[arch].size(); ++x) {
- if (lflags[arch].at(x) == "-framework" && lflags[arch].at(++x) == opt) {
+ if (lflags[arch].at(x) == dashOpt && lflags[arch].at(++x) == opt) {
lflags[arch].remove(x - 1, 2);
break;
}
}
- lflags[arch].append("-framework");
+ lflags[arch].append(dashOpt);
lflags[arch].append(opt);
} else {
lflags[arch].append(opt);
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h
index 901419d3cc..79b161f6da 100644
--- a/qmake/generators/unix/unixmake.h
+++ b/qmake/generators/unix/unixmake.h
@@ -42,7 +42,6 @@ class UnixMakefileGenerator : public MakefileGenerator
protected:
virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); }
- bool doDepends() const override { return !Option::mkfile::do_stub_makefile && MakefileGenerator::doDepends(); }
#ifdef Q_OS_WIN // MinGW x-compiling for QNX
QString installRoot() const override;
#endif
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index c8efd0680b..8d1bd08197 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -66,8 +66,6 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t)
if (project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib" ||
project->first("TEMPLATE") == "aux") {
- if(Option::mkfile::do_stub_makefile && MakefileGenerator::writeStubMakefile(t))
- return true;
writeMakeParts(t);
return MakefileGenerator::writeMakefile(t);
} else if (project->first("TEMPLATE") == "subdirs") {
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 6f80b93307..40114948c2 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -93,18 +93,6 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
project->first("TEMPLATE") == "aux") {
if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
writePkgConfigFile();
-
- if(Option::mkfile::do_stub_makefile) {
- 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 << escapeDependencyPath(*it) << ' ';
- t << "first all clean install distclean uninstall: qmake\n"
- << "qmake_all:\n";
- writeMakeQmake(t);
- t << "FORCE:\n\n";
- return true;
- }
writeMingwParts(t);
return MakefileGenerator::writeMakefile(t);
}
@@ -127,7 +115,7 @@ QString MingwMakefileGenerator::installRoot() const
return QStringLiteral("$(INSTALL_ROOT:@msyshack@%=%)");
}
-void createLdResponseFile(const QString &fileName, const ProStringList &objList)
+static void createResponseFile(const QString &fileName, const ProStringList &objList)
{
QString filePath = Option::output_dir + QDir::separator() + fileName;
QFile file(filePath);
@@ -151,23 +139,6 @@ void createLdResponseFile(const QString &fileName, const ProStringList &objList)
}
}
-void createArObjectScriptFile(const QString &fileName, const QString &target, const ProStringList &objList)
-{
- QString filePath = Option::output_dir + QDir::separator() + fileName;
- QFile file(filePath);
- if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
- QTextStream t(&file);
- // ### quoting?
- t << "CREATE " << target << Qt::endl;
- for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {
- t << "ADDMOD " << *it << Qt::endl;
- }
- t << "SAVE\n";
- t.flush();
- file.close();
- }
-}
-
void MingwMakefileGenerator::writeMingwParts(QTextStream &t)
{
writeStandardParts(t);
@@ -294,26 +265,25 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) {
objectsLinkLine = "$(OBJECTS)";
} else if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
- QString ar_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
+ QString ar_response_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
if (!var("BUILD_NAME").isEmpty()) {
- ar_script_file += "." + var("BUILD_NAME");
+ ar_response_file += "." + var("BUILD_NAME");
}
if (!var("MAKEFILE").isEmpty())
- ar_script_file += "." + var("MAKEFILE");
+ ar_response_file += "." + var("MAKEFILE");
// QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix.
- // Strip off any options since the ar commands will be read from file.
- QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);
+ QString ar_cmd = var("QMAKE_LIB");
if (ar_cmd.isEmpty())
- ar_cmd = "ar";
- createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS"));
- objectsLinkLine = ar_cmd + " -M < " + escapeFilePath(ar_script_file);
+ ar_cmd = "ar -rc";
+ createResponseFile(ar_response_file, project->values("OBJECTS"));
+ objectsLinkLine = ar_cmd + ' ' + var("DEST_TARGET") + " @" + escapeFilePath(ar_response_file);
} else {
QString ld_response_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
if (!var("BUILD_NAME").isEmpty())
ld_response_file += "." + var("BUILD_NAME");
if (!var("MAKEFILE").isEmpty())
ld_response_file += "." + var("MAKEFILE");
- createLdResponseFile(ld_response_file, project->values("OBJECTS"));
+ createResponseFile(ld_response_file, project->values("OBJECTS"));
objectsLinkLine = "@" + escapeFilePath(ld_response_file);
}
Win32MakefileGenerator::writeObjectsPart(t);
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 1f6223f01d..67b478ae28 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -48,10 +48,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
if(project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib" ||
project->first("TEMPLATE") == "aux") {
-#if 0
- if(Option::mkfile::do_stub_makefile)
- return MakefileGenerator::writeStubMakefile(t);
-#endif
writeNmakeParts(t);
return MakefileGenerator::writeMakefile(t);
}