summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/generators')
-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
5 files changed, 18 insertions, 38 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)