summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/makefile.cpp8
-rw-r--r--qmake/generators/makefile.h2
-rw-r--r--qmake/generators/metamakefile.cpp23
-rw-r--r--qmake/generators/metamakefile.h4
-rw-r--r--qmake/generators/unix/unixmake.cpp19
-rw-r--r--qmake/option.cpp9
-rw-r--r--qmake/option.h2
-rw-r--r--qmake/project.cpp67
-rw-r--r--qmake/project.h2
9 files changed, 26 insertions, 110 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 2a21aa9880..f187190ac7 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -300,6 +300,12 @@ MakefileGenerator::setProjectFile(QMakeProject *p)
if(project)
return;
project = p;
+ if (project->isActiveConfig("win32"))
+ target_mode = TARG_WIN_MODE;
+ else if (project->isActiveConfig("macx"))
+ target_mode = TARG_MACX_MODE;
+ else
+ target_mode = TARG_UNIX_MODE;
init();
findLibraries();
if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE &&
@@ -3253,7 +3259,7 @@ MakefileGenerator::writePkgConfigFile()
t << "Libs: ";
QString pkgConfiglibDir;
QString pkgConfiglibName;
- if (Option::target_mode == Option::TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) {
+ if (target_mode == TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) {
pkgConfiglibDir = "-F${libdir}";
QString bundle;
if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index 2cf774e2bc..b177cc7eb0 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -91,6 +91,8 @@ class MakefileGenerator : protected QMakeSourceFileInfo
mutable QHash<ReplaceExtraCompilerCacheKey, QString> extraCompilerVariablesCache;
protected:
+ enum TARG_MODE { TARG_UNIX_MODE, TARG_MACX_MODE, TARG_WIN_MODE } target_mode;
+
QStringList createObjectList(const QStringList &sources);
//makefile style generator functions
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index 54ab4759c2..42030507b7 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -514,28 +514,5 @@ MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &na
#endif // QT_QMAKE_PARSER_ONLY
-bool
-MetaMakefileGenerator::modeForGenerator(const QString &gen, Option::TARG_MODE *target_mode)
-{
- if (gen == "UNIX") {
-#ifdef Q_OS_MAC
- *target_mode = Option::TARG_MACX_MODE;
-#else
- *target_mode = Option::TARG_UNIX_MODE;
-#endif
- } else if (gen == "MSVC.NET" || gen == "BMAKE" || gen == "MSBUILD") {
- *target_mode = Option::TARG_WIN_MODE;
- } else if (gen == "MINGW") {
- *target_mode = Option::TARG_WIN_MODE;
- } else if (gen == "PROJECTBUILDER" || gen == "XCODE") {
- *target_mode = Option::TARG_MACX_MODE;
- } else if (gen == "GBUILD") {
- *target_mode = Option::TARG_UNIX_MODE;
- } else {
- fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData());
- return false;
- }
- return true;
-}
QT_END_NAMESPACE
diff --git a/qmake/generators/metamakefile.h b/qmake/generators/metamakefile.h
index a6889fd6cd..846a7989f1 100644
--- a/qmake/generators/metamakefile.h
+++ b/qmake/generators/metamakefile.h
@@ -42,8 +42,6 @@
#ifndef METAMAKEFILE_H
#define METAMAKEFILE_H
-#include <option.h>
-
#include <qlist.h>
#include <qstring.h>
@@ -67,8 +65,6 @@ public:
static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true, bool *success = 0);
static MakefileGenerator *createMakefileGenerator(QMakeProject *proj, bool noIO = false);
- static bool modeForGenerator(const QString &generator, Option::TARG_MODE *target_mode);
-
inline QMakeProject *projectFile() const { return project; }
virtual bool init() = 0;
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index b8b4f1bbc5..02f8666bbb 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -491,9 +491,9 @@ UnixMakefileGenerator::findLibraries()
} else {
stub = opt.mid(2);
}
- } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-F")) {
+ } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-F")) {
frameworkdirs.append(QMakeLocalFileName(opt.right(opt.length()-2)));
- } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) {
+ } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-framework")) {
if(opt.length() > 11) {
opt = opt.mid(11);
} else {
@@ -612,11 +612,11 @@ UnixMakefileGenerator::processPrlFiles()
break;
}
}
- } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-F")) {
+ } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-F")) {
QMakeLocalFileName f(opt.right(opt.length()-2));
if(!frameworkdirs.contains(f))
frameworkdirs.append(f);
- } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) {
+ } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-framework")) {
if(opt.length() > 11)
opt = opt.mid(11);
else
@@ -655,7 +655,7 @@ UnixMakefileGenerator::processPrlFiles()
QString arch("default");
QString opt = l.at(lit).trimmed();
if(opt.startsWith("-")) {
- if (Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-Xarch")) {
+ if (target_mode == TARG_MACX_MODE && opt.startsWith("-Xarch")) {
if (opt.length() > 7) {
arch = opt.mid(7);
opt = l.at(++lit);
@@ -663,7 +663,7 @@ UnixMakefileGenerator::processPrlFiles()
}
if(opt.startsWith("-L") ||
- (Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-F"))) {
+ (target_mode == TARG_MACX_MODE && opt.startsWith("-F"))) {
if(!lflags[arch].contains(opt))
lflags[arch].append(opt);
} else if(opt.startsWith("-l") || opt == "-pthread") {
@@ -671,12 +671,12 @@ UnixMakefileGenerator::processPrlFiles()
if (lflags[arch].contains(opt))
lflags[arch].removeAll(opt);
lflags[arch].append(opt);
- } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) {
+ } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-framework")) {
if(opt.length() > 11)
opt = opt.mid(11);
else {
opt = l.at(++lit);
- if (Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-Xarch"))
+ if (target_mode == TARG_MACX_MODE && opt.startsWith("-Xarch"))
opt = l.at(++lit); // The user has done the right thing and prefixed each part
}
bool found = false;
@@ -838,8 +838,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
if(!links.isEmpty()) {
for(int i = 0; i < links.size(); ++i) {
- if(Option::target_mode == Option::TARG_UNIX_MODE ||
- Option::target_mode == Option::TARG_MACX_MODE) {
+ if (target_mode == TARG_UNIX_MODE || target_mode == TARG_MACX_MODE) {
QString link = Option::fixPathToTargetOS(destdir + links[i], false);
int lslash = link.lastIndexOf(Option::dir_sep);
if(lslash != -1)
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 4d97d4d1dd..aaf9b55363 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -93,7 +93,6 @@ QString Option::user_template;
QString Option::user_template_prefix;
QStringList Option::shellPath;
Option::HOST_MODE Option::host_mode = Option::HOST_UNKNOWN_MODE;
-Option::TARG_MODE Option::target_mode = Option::TARG_UNKNOWN_MODE;
//QMAKE_*_PROPERTY stuff
QStringList Option::prop::properties;
@@ -557,14 +556,6 @@ Option::init(int argc, char **argv)
}
#endif
}
- } else if (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) {
-#if defined(Q_OS_MAC)
- Option::target_mode = Option::TARG_MACX_MODE;
-#elif defined(Q_OS_UNIX)
- Option::target_mode = Option::TARG_UNIX_MODE;
-#else
- Option::target_mode = Option::TARG_WIN_MODE;
-#endif
}
//defaults for globals
diff --git a/qmake/option.h b/qmake/option.h
index 09922e9c00..32bc06bc61 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -173,8 +173,6 @@ struct Option
static QStringList before_user_vars, after_user_vars;
enum HOST_MODE { HOST_UNKNOWN_MODE, HOST_UNIX_MODE, HOST_WIN_MODE, HOST_MACX_MODE };
static HOST_MODE host_mode;
- enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE };
- static TARG_MODE target_mode;
static QString user_template, user_template_prefix;
static QStringList shellPath;
diff --git a/qmake/project.cpp b/qmake/project.cpp
index e7aee48dbe..a9d4042908 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -565,28 +565,14 @@ static void qmake_error_msg(const QString &msg)
1) features/(unix|win32|macx)/
2) features/
*/
-QStringList qmake_feature_paths(QMakeProperty *prop, bool host_build)
+QStringList QMakeProject::qmakeFeaturePaths()
{
const QString mkspecs_concat = QLatin1String("/mkspecs");
const QString base_concat = QLatin1String("/features");
QStringList concat;
- {
- switch(Option::target_mode) {
- case Option::TARG_MACX_MODE: //also a unix
- concat << base_concat + QLatin1String("/mac");
- concat << base_concat + QLatin1String("/macx");
- concat << base_concat + QLatin1String("/unix");
- break;
- default: // Can't happen, just make the compiler shut up
- case Option::TARG_UNIX_MODE:
- concat << base_concat + QLatin1String("/unix");
- break;
- case Option::TARG_WIN_MODE:
- concat << base_concat + QLatin1String("/win32");
- break;
- }
- concat << base_concat;
- }
+ foreach (const QString &sfx, values("QMAKE_PLATFORM"))
+ concat << base_concat + QLatin1Char('/') + sfx;
+ concat << base_concat;
QStringList feature_roots = splitPathList(QString::fromLocal8Bit(qgetenv("QMAKEFEATURES")));
feature_roots += cached_qmakefeatures;
@@ -1489,7 +1475,8 @@ QMakeProject::read(uchar cmd)
return false;
}
doProjectInclude("spec_post", IncludeFlagFeature, vars);
- validateModes();
+ // The spec extends the feature search path, so invalidate the cache.
+ invalidateFeatureRoots();
if (!conffile.isEmpty()) {
debug_msg(1, "Project config file: reading %s", conffile.toLatin1().constData());
@@ -1607,34 +1594,6 @@ QMakeProject::read(uchar cmd)
return true;
}
-void QMakeProject::validateModes()
-{
- if (Option::target_mode == Option::TARG_UNKNOWN_MODE) {
- Option::TARG_MODE target_mode;
- const QStringList &gen = vars.value("MAKEFILE_GENERATOR");
- if (gen.isEmpty()) {
- fprintf(stderr, "%s:%d: Using OS scope before setting MAKEFILE_GENERATOR\n",
- parser.file.toLatin1().constData(), parser.line_no);
- } else if (MetaMakefileGenerator::modeForGenerator(gen.first(), &target_mode)) {
- const QStringList &tgt = vars.value("TARGET_PLATFORM");
- if (!tgt.isEmpty()) {
- const QString &os = tgt.first();
- if (os == "unix")
- Option::target_mode = Option::TARG_UNIX_MODE;
- else if (os == "macx")
- Option::target_mode = Option::TARG_MACX_MODE;
- else if (os == "win32")
- Option::target_mode = Option::TARG_WIN_MODE;
- else
- fprintf(stderr, "Unknown target platform specified: %s\n",
- os.toLatin1().constData());
- } else {
- Option::target_mode = target_mode;
- }
- }
- }
-}
-
void
QMakeProject::resolveSpec(QString *spec, const QString &qmakespec)
{
@@ -1677,18 +1636,6 @@ QMakeProject::isActiveConfig(const QString &x, bool regex, QHash<QString, QStrin
else if(x == "false")
return false;
- if (x == "unix") {
- validateModes();
- return Option::target_mode == Option::TARG_UNIX_MODE
- || Option::target_mode == Option::TARG_MACX_MODE;
- } else if (x == "macx" || x == "mac") {
- validateModes();
- return Option::target_mode == Option::TARG_MACX_MODE;
- } else if (x == "win32") {
- validateModes();
- return Option::target_mode == Option::TARG_WIN_MODE;
- }
-
if (x == "host_build")
return host_build;
@@ -1758,7 +1705,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash<QString, QString
qmakeAddCacheClear(qmakeDeleteCacheClear<QStringList>, (void**)&feature_roots);
}
if (feature_roots->isEmpty())
- *feature_roots = qmake_feature_paths(prop, host_build);
+ *feature_roots = qmakeFeaturePaths();
debug_msg(2, "Looking for feature '%s' in (%s)", file.toLatin1().constData(),
feature_roots->join("::").toLatin1().constData());
int start_root = 0;
diff --git a/qmake/project.h b/qmake/project.h
index e733f6097c..4ee6a02597 100644
--- a/qmake/project.h
+++ b/qmake/project.h
@@ -114,8 +114,8 @@ class QMakeProject
void init(QMakeProperty *);
void cleanup();
QStringList &values(const QString &v, QHash<QString, QStringList> &place);
- void validateModes();
void resolveSpec(QString *spec, const QString &qmakespec);
+ QStringList qmakeFeaturePaths();
public:
QMakeProject(QMakeProperty *p = 0) { init(p); }