move initialization of numerous variables to spec_pre.prf
this is cleaner by design and allows removing some hacks. Change-Id: I3270195b5d62caa476ffde7c1e1ef43cec99c565 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
parent
1b1aa3b4f8
commit
b40b91cb39
39
mkspecs/features/spec_pre.prf
Normal file
39
mkspecs/features/spec_pre.prf
Normal file
@ -0,0 +1,39 @@
|
||||
QMAKE_DIR_SEP = $$DIR_SEPARATOR
|
||||
QMAKE_DIRLIST_SEP = $$DIRLIST_SEPARATOR
|
||||
|
||||
QMAKE_EXT_C = .c
|
||||
QMAKE_EXT_CPP = .cpp .cc .cxx
|
||||
QMAKE_EXT_CPP_MOC = .moc
|
||||
QMAKE_EXT_H = .h .hpp .hh .hxx
|
||||
QMAKE_EXT_H_MOC = .cpp
|
||||
QMAKE_EXT_JS = .js
|
||||
QMAKE_EXT_LEX = .l
|
||||
QMAKE_EXT_LIBTOOL = .la
|
||||
QMAKE_EXT_PKGCONFIG = .pc
|
||||
QMAKE_EXT_PRL = .prl
|
||||
QMAKE_EXT_UI = .ui
|
||||
QMAKE_EXT_YACC = .y
|
||||
|
||||
QMAKE_CPP_MOD_MOC =
|
||||
QMAKE_H_MOD_MOC = moc_
|
||||
QMAKE_MOD_LEX = _lex
|
||||
QMAKE_MOD_YACC = _yacc
|
||||
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
QMAKE_EXT_OBJ = .obj
|
||||
QMAKE_EXT_RES = .res
|
||||
QMAKE_SH =
|
||||
PATH = $$split($$(PATH), ;)
|
||||
for(dir, PATH) {
|
||||
exists($$dir/sh.exe) {
|
||||
QMAKE_SH = $$dir/sh.exe
|
||||
break()
|
||||
}
|
||||
}
|
||||
unset(PATH)
|
||||
} else {
|
||||
QMAKE_EXT_CPP += .C
|
||||
QMAKE_EXT_H += .H
|
||||
QMAKE_EXT_OBJ = .o
|
||||
QMAKE_SH = sh
|
||||
}
|
@ -376,22 +376,6 @@ Option::parseCommandLine(int argc, char **argv, int skip)
|
||||
return Option::QMAKE_CMDLINE_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
static QStringList detectShellPath()
|
||||
{
|
||||
QStringList paths;
|
||||
QString path = qgetenv("PATH");
|
||||
QStringList pathlist = path.toLower().split(";");
|
||||
for (int i = 0; i < pathlist.count(); i++) {
|
||||
QString maybeSh = pathlist.at(i) + "/sh.exe";
|
||||
if (QFile::exists(maybeSh)) {
|
||||
paths.append(maybeSh);
|
||||
}
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
Option::init(int argc, char **argv)
|
||||
{
|
||||
@ -403,34 +387,12 @@ Option::init(int argc, char **argv)
|
||||
Option::host_mode = Option::HOST_WIN_MODE;
|
||||
#endif
|
||||
Option::application_argv0 = 0;
|
||||
Option::h_moc_mod = "moc_";
|
||||
Option::lex_mod = "_lex";
|
||||
Option::yacc_mod = "_yacc";
|
||||
Option::prl_ext = ".prl";
|
||||
Option::libtool_ext = ".la";
|
||||
Option::pkgcfg_ext = ".pc";
|
||||
Option::prf_ext = ".prf";
|
||||
Option::ui_ext = ".ui";
|
||||
Option::h_ext << ".h" << ".hpp" << ".hh" << ".hxx";
|
||||
Option::c_ext << ".c";
|
||||
#ifndef Q_OS_WIN
|
||||
Option::h_ext << ".H";
|
||||
#endif
|
||||
Option::cpp_moc_ext = ".moc";
|
||||
Option::cpp_ext << ".cpp" << ".cc" << ".cxx";
|
||||
#ifndef Q_OS_WIN
|
||||
Option::cpp_ext << ".C";
|
||||
#endif
|
||||
Option::lex_ext = ".l";
|
||||
Option::yacc_ext = ".y";
|
||||
Option::pro_ext = ".pro";
|
||||
#ifdef Q_OS_WIN
|
||||
Option::dirlist_sep = ";";
|
||||
Option::shellPath = detectShellPath();
|
||||
Option::res_ext = ".res";
|
||||
#else
|
||||
Option::dirlist_sep = ":";
|
||||
Option::shellPath = QStringList("sh");
|
||||
#endif
|
||||
Option::field_sep = ' ';
|
||||
|
||||
@ -555,10 +517,8 @@ Option::init(int argc, char **argv)
|
||||
//defaults for globals
|
||||
if (Option::host_mode == Option::HOST_WIN_MODE) {
|
||||
Option::dir_sep = "\\";
|
||||
Option::obj_ext = ".obj";
|
||||
} else {
|
||||
Option::dir_sep = "/";
|
||||
Option::obj_ext = ".o";
|
||||
}
|
||||
|
||||
return QMAKE_CMDLINE_SUCCESS;
|
||||
@ -590,41 +550,22 @@ void Option::prepareProject(const QString &pfile)
|
||||
bool Option::postProcessProject(QMakeProject *project)
|
||||
{
|
||||
Option::cpp_ext = project->variables()["QMAKE_EXT_CPP"];
|
||||
if(cpp_ext.isEmpty())
|
||||
cpp_ext << ".cpp"; //something must be there
|
||||
Option::h_ext = project->variables()["QMAKE_EXT_H"];
|
||||
if(h_ext.isEmpty())
|
||||
h_ext << ".h";
|
||||
Option::c_ext = project->variables()["QMAKE_EXT_C"];
|
||||
if(c_ext.isEmpty())
|
||||
c_ext << ".c"; //something must be there
|
||||
|
||||
if(!project->isEmpty("QMAKE_EXT_RES"))
|
||||
Option::res_ext = project->first("QMAKE_EXT_RES");
|
||||
if(!project->isEmpty("QMAKE_EXT_PKGCONFIG"))
|
||||
Option::pkgcfg_ext = project->first("QMAKE_EXT_PKGCONFIG");
|
||||
if(!project->isEmpty("QMAKE_EXT_LIBTOOL"))
|
||||
Option::libtool_ext = project->first("QMAKE_EXT_LIBTOOL");
|
||||
if(!project->isEmpty("QMAKE_EXT_PRL"))
|
||||
Option::prl_ext = project->first("QMAKE_EXT_PRL");
|
||||
if(!project->isEmpty("QMAKE_EXT_UI"))
|
||||
Option::ui_ext = project->first("QMAKE_EXT_UI");
|
||||
if(!project->isEmpty("QMAKE_EXT_CPP_MOC"))
|
||||
Option::cpp_moc_ext = project->first("QMAKE_EXT_CPP_MOC");
|
||||
if(!project->isEmpty("QMAKE_EXT_LEX"))
|
||||
Option::lex_ext = project->first("QMAKE_EXT_LEX");
|
||||
if(!project->isEmpty("QMAKE_EXT_YACC"))
|
||||
Option::yacc_ext = project->first("QMAKE_EXT_YACC");
|
||||
if(!project->isEmpty("QMAKE_EXT_OBJ"))
|
||||
Option::obj_ext = project->first("QMAKE_EXT_OBJ");
|
||||
if(!project->isEmpty("QMAKE_H_MOD_MOC"))
|
||||
Option::h_moc_mod = project->first("QMAKE_H_MOD_MOC");
|
||||
if(!project->isEmpty("QMAKE_MOD_LEX"))
|
||||
Option::lex_mod = project->first("QMAKE_MOD_LEX");
|
||||
if(!project->isEmpty("QMAKE_MOD_YACC"))
|
||||
Option::yacc_mod = project->first("QMAKE_MOD_YACC");
|
||||
if(!project->isEmpty("QMAKE_DIR_SEP"))
|
||||
Option::dir_sep = project->first("QMAKE_DIR_SEP");
|
||||
Option::res_ext = project->first("QMAKE_EXT_RES");
|
||||
Option::pkgcfg_ext = project->first("QMAKE_EXT_PKGCONFIG");
|
||||
Option::libtool_ext = project->first("QMAKE_EXT_LIBTOOL");
|
||||
Option::prl_ext = project->first("QMAKE_EXT_PRL");
|
||||
Option::ui_ext = project->first("QMAKE_EXT_UI");
|
||||
Option::cpp_moc_ext = project->first("QMAKE_EXT_CPP_MOC");
|
||||
Option::lex_ext = project->first("QMAKE_EXT_LEX");
|
||||
Option::yacc_ext = project->first("QMAKE_EXT_YACC");
|
||||
Option::obj_ext = project->first("QMAKE_EXT_OBJ");
|
||||
Option::h_moc_mod = project->first("QMAKE_H_MOD_MOC");
|
||||
Option::lex_mod = project->first("QMAKE_MOD_LEX");
|
||||
Option::yacc_mod = project->first("QMAKE_MOD_YACC");
|
||||
Option::dir_sep = project->first("QMAKE_DIR_SEP");
|
||||
Option::shellPath = project->variables()["QMAKE_SH"];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1316,10 +1316,6 @@ QMakeProject::read(uchar cmd)
|
||||
again:
|
||||
if ((cmd & ReadSetup) && base_vars.isEmpty()) {
|
||||
// hack to get the Option stuff in there
|
||||
vars["QMAKE_EXT_CPP"] = Option::cpp_ext;
|
||||
vars["QMAKE_EXT_C"] = Option::c_ext;
|
||||
vars["QMAKE_EXT_H"] = Option::h_ext;
|
||||
vars["QMAKE_SH"] = Option::shellPath;
|
||||
if(!Option::user_template_prefix.isEmpty())
|
||||
vars["TEMPLATE_PREFIX"] = QStringList(Option::user_template_prefix);
|
||||
|
||||
@ -3771,14 +3767,6 @@ QStringList &QMakeProject::values(const QString &_var, QHash<QString, QStringLis
|
||||
#endif
|
||||
var = ".BUILTIN.HOST." + type;
|
||||
place[var] = QStringList(ret);
|
||||
} 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())
|
||||
place[var] = QStringList(
|
||||
|
Loading…
Reference in New Issue
Block a user