summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/makefile.cpp14
-rw-r--r--qmake/generators/makefile.h3
-rw-r--r--qmake/generators/metamakefile.cpp48
-rw-r--r--qmake/generators/metamakefile.h5
-rw-r--r--qmake/generators/projectgenerator.cpp9
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.h1
-rw-r--r--qmake/generators/win32/winmakefile.cpp17
-rw-r--r--qmake/generators/win32/winmakefile.h1
-rw-r--r--qmake/main.cpp2
-rw-r--r--qmake/option.cpp58
-rw-r--r--qmake/option.h10
-rw-r--r--qmake/project.cpp208
-rw-r--r--qmake/project.h8
13 files changed, 230 insertions, 154 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index ec712a0..a8c1c3c 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -2152,12 +2152,14 @@ QString MakefileGenerator::buildArgs(const QString &outdir)
ret += " -nodependheuristics";
if(!Option::mkfile::qmakespec_commandline.isEmpty())
ret += " -spec " + specdir(outdir);
- if(Option::target_mode == Option::TARG_MACX_MODE)
- ret += " -macx";
- else if(Option::target_mode == Option::TARG_UNIX_MODE)
- ret += " -unix";
- else if(Option::target_mode == Option::TARG_WIN_MODE)
- ret += " -win32";
+ if (Option::target_mode_overridden) {
+ if (Option::target_mode == Option::TARG_MACX_MODE)
+ ret += " -macx";
+ else if (Option::target_mode == Option::TARG_UNIX_MODE)
+ ret += " -unix";
+ else if (Option::target_mode == Option::TARG_WIN_MODE)
+ ret += " -win32";
+ }
//configs
for(QStringList::Iterator it = Option::user_configs.begin();
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index d89c3b1..addb1f5 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -247,7 +247,8 @@ public:
virtual bool supportsMergedBuilds() { return false; }
virtual bool mergeBuildProject(MakefileGenerator * /*other*/) { return false; }
virtual bool openOutput(QFile &, const QString &build) const;
- virtual bool isWindowsShell() const { return Option::target_mode == Option::TARG_WIN_MODE; }
+ virtual bool isWindowsShell() const { return Option::host_mode == Option::HOST_WIN_MODE; }
+ virtual bool isForSymbianSbsv2() const { return false; } // FIXME: killme - i'm ugly!
};
inline void MakefileGenerator::setNoIO(bool o)
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index f48491c..bc8927c 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -293,7 +293,15 @@ SubdirsMetaMakefileGenerator::init()
init_flag = true;
bool hasError = false;
- if(Option::recursive) {
+ // It might make sense to bequeath the CONFIG option to the recursed
+ // projects. OTOH, one would most likely have it in all projects anyway -
+ // either through a qmakespec, a .qmake.cache or explicitly - as otherwise
+ // running qmake in a subdirectory would have a different auto-recurse
+ // setting than in parent directories.
+ bool recurse = Option::recursive == Option::QMAKE_RECURSIVE_YES
+ || (Option::recursive == Option::QMAKE_RECURSIVE_DEFAULT
+ && project->isRecursive());
+ if(recurse) {
QString old_output_dir = Option::output_dir;
QString old_output = Option::output.fileName();
QString oldpwd = qmake_getpwd();
@@ -375,7 +383,7 @@ SubdirsMetaMakefileGenerator::init()
Subdir *self = new Subdir;
self->input_dir = qmake_getpwd();
self->output_dir = Option::output_dir;
- if(!Option::recursive || (!Option::output.fileName().endsWith(Option::dir_sep) && !QFileInfo(Option::output).isDir()))
+ if(!recurse || (!Option::output.fileName().endsWith(Option::dir_sep) && !QFileInfo(Option::output).isDir()))
self->output_file = Option::output.fileName();
self->makefile = new BuildsMetaMakefileGenerator(project, name, false);
self->makefile->init();
@@ -458,7 +466,7 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO)
} else if(gen == "PROJECTBUILDER" || gen == "XCODE") {
mkfile = new ProjectBuilderMakefileGenerator;
} else if(gen == "MSVC.NET") {
- if(proj->first("TEMPLATE").indexOf(QRegExp("^vc.*")) != -1)
+ if (proj->first("TEMPLATE").startsWith("vc"))
mkfile = new VcprojGenerator;
else
mkfile = new NmakeMakefileGenerator;
@@ -478,6 +486,40 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO)
return mkfile;
}
+bool
+MetaMakefileGenerator::modesForGenerator(const QString &gen,
+ Option::HOST_MODE *host_mode, Option::TARG_MODE *target_mode)
+{
+ if (gen == "UNIX") {
+#ifdef Q_OS_MAC
+ *host_mode = Option::HOST_MACX_MODE;
+ *target_mode = Option::TARG_MACX_MODE;
+#else
+ *host_mode = Option::HOST_UNIX_MODE;
+ *target_mode = Option::TARG_UNIX_MODE;
+#endif
+ } else if (gen == "MSVC.NET" || gen == "MINGW" || gen == "BMAKE") {
+ *host_mode = Option::HOST_WIN_MODE;
+ *target_mode = Option::TARG_WIN_MODE;
+ } else if (gen == "PROJECTBUILDER" || gen == "XCODE") {
+ *host_mode = Option::HOST_MACX_MODE;
+ *target_mode = Option::TARG_MACX_MODE;
+ } else if (gen == "SYMBIAN_ABLD" || gen == "SYMBIAN_SBSV2") {
+#if defined(Q_OS_MAC)
+ *host_mode = Option::HOST_MACX_MODE;
+#elif defined(Q_OS_UNIX)
+ *host_mode = Option::HOST_UNIX_MODE;
+#else
+ *host_mode = Option::HOST_WIN_MODE;
+#endif
+ *target_mode = Option::TARG_SYMBIAN_MODE;
+ } else {
+ fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData());
+ return false;
+ }
+ return true;
+}
+
MetaMakefileGenerator *
MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op, bool *success)
{
diff --git a/qmake/generators/metamakefile.h b/qmake/generators/metamakefile.h
index 8675115..e559c8e 100644
--- a/qmake/generators/metamakefile.h
+++ b/qmake/generators/metamakefile.h
@@ -42,6 +42,8 @@
#ifndef METAMAKEFILE_H
#define METAMAKEFILE_H
+#include <option.h>
+
#include <qlist.h>
#include <qstring.h>
@@ -65,6 +67,9 @@ 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 modesForGenerator(const QString &generator,
+ Option::HOST_MODE *host_mode, Option::TARG_MODE *target_mode);
+
inline QMakeProject *projectFile() const { return project; }
virtual bool init() = 0;
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp
index 8622cd9..d225635 100644
--- a/qmake/generators/projectgenerator.cpp
+++ b/qmake/generators/projectgenerator.cpp
@@ -111,7 +111,7 @@ ProjectGenerator::init()
add_depend = true;
if(dir.right(1) != Option::dir_sep)
dir += Option::dir_sep;
- if(Option::recursive) {
+ if(Option::recursive == Option::QMAKE_RECURSIVE_YES) {
QStringList files = QDir(dir).entryList(QDir::Files);
for(int i = 0; i < (int)files.count(); i++) {
if(files[i] != "." && files[i] != "..")
@@ -138,7 +138,7 @@ ProjectGenerator::init()
dir = regex.left(s+1);
regex = regex.right(regex.length() - (s+1));
}
- if(Option::recursive) {
+ if(Option::recursive == Option::QMAKE_RECURSIVE_YES) {
QStringList entries = QDir(dir).entryList(QDir::Dirs);
for(int i = 0; i < (int)entries.count(); i++) {
if(entries[i] != "." && entries[i] != "..") {
@@ -193,7 +193,7 @@ ProjectGenerator::init()
subdirs.append(nd);
}
}
- if(Option::recursive) {
+ if(Option::recursive == Option::QMAKE_RECURSIVE_YES) {
QStringList dirs = QDir(newdir).entryList(QDir::Dirs);
for(int i = 0; i < (int)dirs.count(); i++) {
QString nd = fileFixify(newdir + QDir::separator() + dirs[i]);
@@ -230,7 +230,8 @@ ProjectGenerator::init()
}
}
}
- if(Option::recursive && !knownDirs.contains(newdir, Qt::CaseInsensitive))
+ if(Option::recursive == Option::QMAKE_RECURSIVE_YES
+ && !knownDirs.contains(newdir, Qt::CaseInsensitive))
knownDirs.append(newdir);
}
}
diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h
index b8ccdbe..286c91c 100644
--- a/qmake/generators/symbian/symmake_sbsv2.h
+++ b/qmake/generators/symbian/symmake_sbsv2.h
@@ -56,6 +56,7 @@ protected:
virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly);
virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile);
virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath);
+ virtual bool isForSymbianSbsv2() const { return true; } // FIXME: killme - i'm ugly!
public:
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 9d3b4c6..9998c1f 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -764,6 +764,11 @@ QString Win32MakefileGenerator::getLibTarget()
return QString(project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".lib");
}
+QString Win32MakefileGenerator::getPdbTarget()
+{
+ return QString(project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".pdb");
+}
+
QString Win32MakefileGenerator::defaultInstall(const QString &t)
{
if((t != "target" && t != "dlltarget") ||
@@ -804,6 +809,18 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
}
+ if(project->isActiveConfig("shared") && project->isActiveConfig("debug")) {
+ QString pdb_target = getPdbTarget();
+ pdb_target.remove('"');
+ QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target;
+ QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + pdb_target, FileFixifyAbsolute));
+ if(!ret.isEmpty())
+ ret += "\n\t";
+ ret += QString("-$(INSTALL_FILE)") + " \"" + src_targ + "\" \"" + dst_targ + "\"";
+ if(!uninst.isEmpty())
+ uninst.append("\n\t");
+ uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
+ }
}
if(t == "dlltarget" || project->values(t + ".CONFIG").indexOf("no_dll") == -1) {
diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h
index 5437524..3a2e3a1 100644
--- a/qmake/generators/win32/winmakefile.h
+++ b/qmake/generators/win32/winmakefile.h
@@ -83,6 +83,7 @@ protected:
virtual void processRcFileVar();
virtual void processFileTagsVar();
virtual QString getLibTarget();
+ virtual QString getPdbTarget();
};
inline Win32MakefileGenerator::~Win32MakefileGenerator()
diff --git a/qmake/main.cpp b/qmake/main.cpp
index 50f9272..42679a2 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -149,7 +149,7 @@ int runQMake(int argc, char **argv)
//setup pwd properly
debug_msg(1, "Resetting dir to: %s", oldpwd.toLatin1().constData());
qmake_setpwd(oldpwd); //reset the old pwd
- int di = fn.lastIndexOf(Option::dir_sep);
+ int di = fn.lastIndexOf(QDir::separator());
if(di != -1) {
debug_msg(1, "Changing dir to: %s", fn.left(di).toLatin1().constData());
if(!qmake_setpwd(fn.left(di)))
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 18f0541..6f0f46b 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -88,7 +88,7 @@ int Option::warn_level = WarnLogic;
int Option::debug_level = 0;
QFile Option::output;
QString Option::output_dir;
-bool Option::recursive = false;
+Option::QMAKE_RECURSIVE Option::recursive = Option::QMAKE_RECURSIVE_DEFAULT;
QStringList Option::before_user_vars;
QStringList Option::after_user_vars;
QStringList Option::user_configs;
@@ -96,13 +96,9 @@ QStringList Option::after_user_configs;
QString Option::user_template;
QString Option::user_template_prefix;
QStringList Option::shellPath;
-#if defined(Q_OS_WIN32)
-Option::TARG_MODE Option::target_mode = Option::TARG_WIN_MODE;
-#elif defined(Q_OS_MAC)
-Option::TARG_MODE Option::target_mode = Option::TARG_MACX_MODE;
-#else
-Option::TARG_MODE Option::target_mode = Option::TARG_UNIX_MODE;
-#endif
+Option::HOST_MODE Option::host_mode = Option::HOST_UNKNOWN_MODE;
+Option::TARG_MODE Option::target_mode = Option::TARG_UNKNOWN_MODE;
+bool Option::target_mode_overridden = false;
//QMAKE_*_PROPERTY stuff
QStringList Option::prop::properties;
@@ -126,7 +122,7 @@ QString Option::mkfile::qmakespec_commandline;
static Option::QMAKE_MODE default_mode(QString progname)
{
- int s = progname.lastIndexOf(Option::dir_sep);
+ int s = progname.lastIndexOf(QDir::separator());
if(s != -1)
progname = progname.right(progname.length() - (s + 1));
if(progname == "qmakegen")
@@ -184,9 +180,6 @@ bool usage(const char *a0)
" * processed as if it was in [files]. These assignments will be parsed *\n"
" * before [files]. *\n"
" -o file Write output to file\n"
- " -unix Run in unix mode\n"
- " -win32 Run in win32 mode\n"
- " -macx Run in Mac OS X mode\n"
" -d Increase debug level\n"
" -t templ Overrides TEMPLATE as templ\n"
" -tp prefix Overrides TEMPLATE so that prefix is prefixed into the value\n"
@@ -223,7 +216,7 @@ Option::parseCommandLine(int argc, char **argv, int skip)
if(x == 1) {
bool specified = true;
if(opt == "project") {
- Option::recursive = true;
+ Option::recursive = Option::QMAKE_RECURSIVE_YES;
Option::qmake_mode = Option::QMAKE_GENERATE_PROJECT;
} else if(opt == "prl") {
Option::mkfile::do_deps = false;
@@ -251,11 +244,20 @@ Option::parseCommandLine(int argc, char **argv, int skip)
} else if(opt == "tp" || opt == "template_prefix") {
Option::user_template_prefix = argv[++x];
} else if(opt == "macx") {
+ fprintf(stderr, "-macx is deprecated.\n");
+ Option::host_mode = HOST_MACX_MODE;
Option::target_mode = TARG_MACX_MODE;
+ Option::target_mode_overridden = true;
} else if(opt == "unix") {
+ fprintf(stderr, "-unix is deprecated.\n");
+ Option::host_mode = HOST_UNIX_MODE;
Option::target_mode = TARG_UNIX_MODE;
+ Option::target_mode_overridden = true;
} else if(opt == "win32") {
+ fprintf(stderr, "-win32 is deprecated.\n");
+ Option::host_mode = HOST_WIN_MODE;
Option::target_mode = TARG_WIN_MODE;
+ Option::target_mode_overridden = true;
} else if(opt == "d") {
Option::debug_level++;
} else if(opt == "version" || opt == "v" || opt == "-version") {
@@ -279,9 +281,9 @@ Option::parseCommandLine(int argc, char **argv, int skip)
} else if(opt == "Wnone") {
Option::warn_level = WarnNone;
} else if(opt == "r" || opt == "recursive") {
- Option::recursive = true;
- } else if(opt == "norecursive") {
- Option::recursive = false;
+ Option::recursive = Option::QMAKE_RECURSIVE_YES;
+ } else if(opt == "nr" || opt == "norecursive") {
+ Option::recursive = Option::QMAKE_RECURSIVE_NO;
} else if(opt == "config") {
Option::user_configs += argv[++x];
} else {
@@ -405,6 +407,7 @@ Option::init(int argc, char **argv)
#ifdef Q_OS_WIN
Option::dirlist_sep = ";";
Option::shellPath = detectShellPath();
+ Option::res_ext = ".res";
#else
Option::dirlist_sep = ":";
#endif
@@ -525,18 +528,23 @@ Option::init(int argc, char **argv)
}
//defaults for globals
- if(Option::target_mode == Option::TARG_WIN_MODE) {
- Option::dir_sep = "\\";
- Option::obj_ext = ".obj";
- Option::res_ext = ".res";
- } else {
- Option::dir_sep = "/";
- Option::obj_ext = ".o";
- }
- Option::qmake_abslocation = Option::fixPathToTargetOS(Option::qmake_abslocation);
+ if (Option::host_mode != Option::HOST_UNKNOWN_MODE)
+ applyHostMode();
return QMAKE_CMDLINE_SUCCESS;
}
+void Option::applyHostMode()
+{
+ if (Option::host_mode == Option::HOST_WIN_MODE) {
+ Option::dir_sep = "\\";
+ Option::obj_ext = ".obj";
+ } else {
+ Option::dir_sep = "/";
+ Option::obj_ext = ".o";
+ }
+ Option::qmake_abslocation = Option::fixPathToTargetOS(Option::qmake_abslocation);
+}
+
bool Option::postProcessProject(QMakeProject *project)
{
Option::cpp_ext = project->variables()["QMAKE_EXT_CPP"];
diff --git a/qmake/option.h b/qmake/option.h
index a2ca676..9bfdaed 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -106,6 +106,7 @@ struct Option
//both of these must be called..
static int init(int argc=0, char **argv=0); //parse cmdline
+ static void applyHostMode();
static bool postProcessProject(QMakeProject *);
enum StringFixFlags {
@@ -148,10 +149,15 @@ struct Option
static QString output_dir;
static int debug_level;
static int warn_level;
- static bool recursive;
+ enum QMAKE_RECURSIVE { QMAKE_RECURSIVE_DEFAULT, QMAKE_RECURSIVE_YES, QMAKE_RECURSIVE_NO };
+ static QMAKE_RECURSIVE recursive;
static QStringList before_user_vars, after_user_vars, user_configs, after_user_configs;
- enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE };
+ 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,
+ TARG_SYMBIAN_MODE };
static TARG_MODE target_mode;
+ static bool target_mode_overridden;
static QString user_template, user_template_prefix;
static QStringList shellPath;
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 4193163..951ca33 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -43,6 +43,7 @@
#include "property.h"
#include "option.h"
#include "cachekeys.h"
+#include "generators/metamakefile.h"
#include <qdatetime.h>
#include <qfile.h>
@@ -121,7 +122,7 @@ enum TestFunc { T_REQUIRES=1, T_GREATERTHAN, T_LESSTHAN, T_EQUALS,
T_EXISTS, T_EXPORT, T_CLEAR, T_UNSET, T_EVAL, T_CONFIG, T_SYSTEM,
T_RETURN, T_BREAK, T_NEXT, T_DEFINED, T_CONTAINS, T_INFILE,
T_COUNT, T_ISEMPTY, T_INCLUDE, T_LOAD, T_DEBUG, T_ERROR,
- T_MESSAGE, T_WARNING, T_IF };
+ T_MESSAGE, T_WARNING, T_IF, T_OPTION };
QMap<QString, TestFunc> qmake_testFunctions()
{
static QMap<QString, TestFunc> *qmake_test_functions = 0;
@@ -155,6 +156,7 @@ QMap<QString, TestFunc> qmake_testFunctions()
qmake_test_functions->insert("error", T_ERROR);
qmake_test_functions->insert("message", T_MESSAGE);
qmake_test_functions->insert("warning", T_WARNING);
+ qmake_test_functions->insert("option", T_OPTION);
}
return *qmake_test_functions;
}
@@ -507,69 +509,6 @@ static void qmake_error_msg(const QString &msg)
msg.toLatin1().constData());
}
-enum isForSymbian_enum {
- isForSymbian_NOT_SET = -1,
- isForSymbian_FALSE = 0,
- isForSymbian_ABLD = 1,
- isForSymbian_SBSV2 = 2,
-};
-
-static isForSymbian_enum isForSymbian_value = isForSymbian_NOT_SET;
-
-// Checking for symbian build is primarily determined from the qmake spec,
-// but if that is not specified, detect if symbian is the default spec
-// by checking the MAKEFILE_GENERATOR variable value.
-static void init_symbian(const QMap<QString, QStringList>& vars)
-{
- if (isForSymbian_value != isForSymbian_NOT_SET)
- return;
-
- QString spec = QFileInfo(Option::mkfile::qmakespec).fileName();
- if (spec.startsWith("symbian-abld", Qt::CaseInsensitive)) {
- isForSymbian_value = isForSymbian_ABLD;
- } else if (spec.startsWith("symbian-sbsv2", Qt::CaseInsensitive)) {
- isForSymbian_value = isForSymbian_SBSV2;
- } else {
- QStringList generatorList = vars["MAKEFILE_GENERATOR"];
-
- if (!generatorList.isEmpty()) {
- QString generator = generatorList.first();
- if (generator.startsWith("SYMBIAN_ABLD"))
- isForSymbian_value = isForSymbian_ABLD;
- else if (generator.startsWith("SYMBIAN_SBSV2"))
- isForSymbian_value = isForSymbian_SBSV2;
- else
- isForSymbian_value = isForSymbian_FALSE;
- } else {
- isForSymbian_value = isForSymbian_FALSE;
- }
- }
-
- // Force recursive on Symbian, as non-recursive is not really a viable option there
- if (isForSymbian_value != isForSymbian_FALSE)
- Option::recursive = true;
-}
-
-bool isForSymbian()
-{
- // If isForSymbian_value has not been initialized explicitly yet,
- // call initializer with dummy map to check qmake spec.
- if (isForSymbian_value == isForSymbian_NOT_SET)
- init_symbian(QMap<QString, QStringList>());
-
- return (isForSymbian_value != isForSymbian_FALSE);
-}
-
-bool isForSymbianSbsv2()
-{
- // If isForSymbian_value has not been initialized explicitly yet,
- // call initializer with dummy map to check qmake spec.
- if (isForSymbian_value == isForSymbian_NOT_SET)
- init_symbian(QMap<QString, QStringList>());
-
- return (isForSymbian_value == isForSymbian_SBSV2);
-}
-
/*
1) environment variable QMAKEFEATURES (as separated by colons)
2) property variable QMAKEFEATURES (as separated by colons)
@@ -595,22 +534,16 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0)
concat << base_concat + QDir::separator() + "macx";
concat << base_concat + QDir::separator() + "unix";
break;
+ default: // Can't happen, just make the compiler shut up
case Option::TARG_UNIX_MODE:
- {
- if (isForSymbian())
- concat << base_concat + QDir::separator() + "symbian";
- else
- concat << base_concat + QDir::separator() + "unix";
- break;
- }
+ concat << base_concat + QDir::separator() + "unix";
+ break;
case Option::TARG_WIN_MODE:
- {
- if (isForSymbian())
- concat << base_concat + QDir::separator() + "symbian";
- else
- concat << base_concat + QDir::separator() + "win32";
- break;
- }
+ concat << base_concat + QDir::separator() + "win32";
+ break;
+ case Option::TARG_SYMBIAN_MODE:
+ concat << base_concat + QDir::separator() + "symbian";
+ break;
}
concat << base_concat;
}
@@ -623,7 +556,7 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0)
feature_roots += splitPathList(prop->value("QMAKEFEATURES"));
if(!Option::mkfile::cachefile.isEmpty()) {
QString path;
- int last_slash = Option::mkfile::cachefile.lastIndexOf(Option::dir_sep);
+ int last_slash = Option::mkfile::cachefile.lastIndexOf(QDir::separator());
if(last_slash != -1)
path = Option::fixPathToLocalOS(Option::mkfile::cachefile.left(last_slash));
for(QStringList::Iterator concat_it = concat.begin();
@@ -766,6 +699,7 @@ QMakeProject::reset()
scope_blocks.push(ScopeBlock());
iterator = 0;
function = 0;
+ recursive = false;
}
bool
@@ -1356,16 +1290,7 @@ bool
QMakeProject::read(uchar cmd)
{
if(cfile.isEmpty()) {
- //find out where qmake (myself) lives
- if (!base_vars.contains("QMAKE_QMAKE")) {
- if (!Option::qmake_abslocation.isNull())
- base_vars["QMAKE_QMAKE"] = QStringList(Option::qmake_abslocation);
- else
- base_vars["QMAKE_QMAKE"] = QStringList("qmake");
- }
-
// hack to get the Option stuff in there
- base_vars["QMAKE_EXT_OBJ"] = QStringList(Option::obj_ext);
base_vars["QMAKE_EXT_CPP"] = Option::cpp_ext;
base_vars["QMAKE_EXT_C"] = Option::c_ext;
base_vars["QMAKE_EXT_H"] = Option::h_ext;
@@ -1456,8 +1381,7 @@ QMakeProject::read(uchar cmd)
fprintf(stderr, "Failure to read QMAKESPEC conf file %s.\n", spec.toLatin1().constData());
return false;
}
-
- init_symbian(base_vars);
+ validateModes();
if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty()) {
debug_msg(1, "QMAKECACHE file: reading %s", Option::mkfile::cachefile.toLatin1().constData());
@@ -1581,6 +1505,46 @@ QMakeProject::read(uchar cmd)
return true;
}
+void QMakeProject::validateModes()
+{
+ if (Option::host_mode == Option::HOST_UNKNOWN_MODE
+ || Option::target_mode == Option::TARG_UNKNOWN_MODE) {
+ Option::HOST_MODE host_mode;
+ Option::TARG_MODE target_mode;
+ const QStringList &gen = base_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::modesForGenerator(gen.first(),
+ &host_mode, &target_mode)) {
+ if (Option::host_mode == Option::HOST_UNKNOWN_MODE) {
+ Option::host_mode = host_mode;
+ Option::applyHostMode();
+ }
+
+ if (Option::target_mode == Option::TARG_UNKNOWN_MODE) {
+ const QStringList &tgt = base_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 == "symbian")
+ Option::target_mode = Option::TARG_SYMBIAN_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;
+ }
+ }
+ }
+ }
+}
+
bool
QMakeProject::isActiveConfig(const QString &x, bool regex, QMap<QString, QStringList> *place)
{
@@ -1593,26 +1557,26 @@ QMakeProject::isActiveConfig(const QString &x, bool regex, QMap<QString, QString
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
+ || Option::target_mode == Option::TARG_SYMBIAN_MODE;
+ } else if (x == "macx" || x == "mac") {
+ validateModes();
+ return Option::target_mode == Option::TARG_MACX_MODE;
+ } else if (x == "symbian") {
+ validateModes();
+ return Option::target_mode == Option::TARG_SYMBIAN_MODE;
+ } else if (x == "win32") {
+ validateModes();
+ return Option::target_mode == Option::TARG_WIN_MODE;
+ }
+
+ //mkspecs
static QString spec;
if(spec.isEmpty())
spec = QFileInfo(Option::mkfile::qmakespec).fileName();
-
- // Symbian is an exception to how scopes are resolved. Since we do not
- // have a separate target mode for Symbian, but we expect the scope to resolve
- // on other platforms we base it entirely on the mkspec. This means that
- // using a mkspec starting with 'symbian*' will resolve both the 'symbian'
- // and the 'unix' (because of Open C) scopes to true.
- if(isForSymbian() && (x == "symbian" || x == "unix"))
- return true;
-
- //mkspecs
- if((Option::target_mode == Option::TARG_MACX_MODE ||
- Option::target_mode == Option::TARG_UNIX_MODE) && x == "unix")
- return !isForSymbian();
- else if(Option::target_mode == Option::TARG_MACX_MODE && (x == "macx" || x == "mac"))
- return !isForSymbian();
- else if(Option::target_mode == Option::TARG_WIN_MODE && x == "win32")
- return !isForSymbian();
QRegExp re(x, Qt::CaseSensitive, QRegExp::Wildcard);
if((regex && re.exactMatch(spec)) || (!regex && spec == x))
return true;
@@ -1704,7 +1668,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QMap<QString, QStringL
if(file.indexOf(Option::dir_sep) == -1 || !QFile::exists(file)) {
static QStringList *feature_roots = 0;
if(!feature_roots) {
- init_symbian(base_vars);
+ validateModes();
feature_roots = new QStringList(qmake_feature_paths(prop));
qmakeAddCacheClear(qmakeDeleteCacheClear_QStringList, (void**)&feature_roots);
}
@@ -2768,6 +2732,21 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QMap<QSt
exit(2);
#endif
return true; }
+ case T_OPTION:
+ if (args.count() != 1) {
+ fprintf(stderr, "%s:%d: option() requires one argument.\n",
+ parser.file.toLatin1().constData(), parser.line_no);
+ return false;
+ }
+ if (args.first() == "recursive") {
+ recursive = true;
+ } else {
+ fprintf(stderr, "%s:%d: unrecognized option() argument '%s'.\n",
+ parser.file.toLatin1().constData(), parser.line_no,
+ args.first().toLatin1().constData());
+ return false;
+ }
+ return true;
default:
fprintf(stderr, "%s:%d: Unknown test function: %s\n", parser.file.toLatin1().constData(), parser.line_no,
func.toLatin1().constData());
@@ -3150,6 +3129,19 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList
} else if (var == QLatin1String("QMAKE_DIR_SEP")) {
if (place[var].isEmpty())
return values("DIR_SEPARATOR", place);
+ } else if (var == QLatin1String("QMAKE_EXT_OBJ")) {
+ if (place[var].isEmpty()) {
+ var = ".BUILTIN." + var;
+ place[var] = QStringList(Option::obj_ext);
+ }
+ } else if (var == QLatin1String("QMAKE_QMAKE")) {
+ if (place[var].isEmpty()) {
+ var = ".BUILTIN." + var;
+ if (!Option::qmake_abslocation.isNull())
+ place[var] = QStringList(Option::qmake_abslocation);
+ else
+ place[var] = QStringList("qmake");
+ }
} else if (var == QLatin1String("EPOCROOT")) {
if (place[var].isEmpty())
place[var] = QStringList(epocRoot());
diff --git a/qmake/project.h b/qmake/project.h
index 1f53bf2..bfebed0 100644
--- a/qmake/project.h
+++ b/qmake/project.h
@@ -78,6 +78,7 @@ class QMakeProject
FunctionBlock *function;
QMap<QString, FunctionBlock*> testFunctions, replaceFunctions;
+ bool recursive;
bool own_prop;
QString pfile, cfile;
QMakeProperty *prop;
@@ -105,6 +106,7 @@ class QMakeProject
QStringList doVariableReplaceExpand(const QString &str, QMap<QString, QStringList> &place, bool *ok=0);
void init(QMakeProperty *, const QMap<QString, QStringList> *);
QStringList &values(const QString &v, QMap<QString, QStringList> &place);
+ void validateModes();
public:
QMakeProject() { init(0, 0); }
@@ -154,6 +156,8 @@ public:
QString first(const QString &v);
QMap<QString, QStringList> &variables();
+ bool isRecursive() const { return recursive; }
+
protected:
friend class MakefileGenerator;
bool read(const QString &file, QMap<QString, QStringList> &place);
@@ -192,10 +196,6 @@ inline QString QMakeProject::first(const QString &v)
inline QMap<QString, QStringList> &QMakeProject::variables()
{ return vars; }
-// Helper functions needed for Symbian
-bool isForSymbian();
-bool isForSymbianSbsv2();
-
QT_END_NAMESPACE
#endif // PROJECT_H