summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-05-03 16:25:39 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-05-03 16:25:39 (GMT)
commitac0a7503d58946b38d4d18bb077dd9530ccbb6f9 (patch)
tree3e16b713e0269147f9d362e7c1384768e98b2c1e /qmake
parentbf0926fff333398660fd51ae6b08699783100057 (diff)
parent399782c7911c11bba80dd37276f8de0b171c52f8 (diff)
downloadQt-ac0a7503d58946b38d4d18bb077dd9530ccbb6f9.zip
Qt-ac0a7503d58946b38d4d18bb077dd9530ccbb6f9.tar.gz
Qt-ac0a7503d58946b38d4d18bb077dd9530ccbb6f9.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/makefile.cpp49
-rw-r--r--qmake/generators/unix/unixmake2.cpp3
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp5
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp48
-rw-r--r--qmake/generators/win32/msvc_vcproj.h1
-rw-r--r--qmake/project.cpp34
-rw-r--r--qmake/project.h1
7 files changed, 84 insertions, 57 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 9e2be31..4f3b113 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -364,7 +364,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v
dir = regex.left(regex.lastIndexOf(Option::dir_sep) + 1);
real_dir = dir;
if(!(flags & VPATH_NoFixify))
- real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir);
+ real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir) + '/';
regex.remove(0, dir.length());
}
if(real_dir.isEmpty() || exists(real_dir)) {
@@ -383,16 +383,15 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v
for(int i = (int)files.count()-1; i >= 0; i--) {
if(files[i] == "." || files[i] == "..")
continue;
- a = dir + files[i];
+ a = real_dir + files[i];
if(!(flags & VPATH_NoFixify))
a = fileFixify(a);
l.insert(val_it, a);
}
}
} else {
- debug_msg(1, "%s:%d Cannot match %s%c%s, as %s does not exist.",
+ debug_msg(1, "%s:%d Cannot match %s%s, as %s does not exist.",
__FILE__, __LINE__, real_dir.toLatin1().constData(),
- QDir::separator().toLatin1(),
regex.toLatin1().constData(), real_dir.toLatin1().constData());
if(flags & VPATH_RemoveMissingFiles)
remove_file = true;
@@ -484,19 +483,22 @@ MakefileGenerator::init()
subs.at(i).toLatin1().constData());
continue;
}
- inn = tinn.first();
- outn = toutn.first();
+ inn = fileFixify(tinn.first(), qmake_getpwd());
+ outn = fileFixify(toutn.first(), qmake_getpwd(), Option::output_dir);
} else {
- inn = subs.at(i);
+ inn = fileFixify(subs.at(i), qmake_getpwd());
+ if (!QFile::exists(inn)) {
+ // random insanity for backwards compat: .in file specified with absolute out dir
+ inn = fileFixify(subs.at(i));
+ }
if(!inn.endsWith(".in")) {
warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'",
inn.toLatin1().constData());
continue;
}
- outn = inn.left(inn.length()-3);
+ outn = fileFixify(inn.left(inn.length()-3), qmake_getpwd(), Option::output_dir);
}
- QFile in(fileFixify(inn));
- QFile out(fileFixify(outn, qmake_getpwd(), Option::output_dir));
+ QFile in(inn);
if(in.open(QFile::ReadOnly)) {
QString contents;
QStack<int> state;
@@ -545,9 +547,10 @@ MakefileGenerator::init()
else
state.pop();
} else if(state.isEmpty() || state.top() == IN_CONDITION) {
- contents += project->expand(line).join(QString(Option::field_sep));
+ contents += project->expand(line, in.fileName(), count);
}
}
+ QFile out(outn);
if(out.exists() && out.open(QFile::ReadOnly)) {
QString old = QString::fromUtf8(out.readAll());
if(contents == old) {
@@ -782,10 +785,8 @@ MakefileGenerator::init()
}
{ //get the output_dir into the pwd
- if(fileFixify(Option::output_dir) != fileFixify(qmake_getpwd()))
- project->values("INCLUDEPATH").append(fileFixify(Option::output_dir,
- Option::output_dir,
- Option::output_dir));
+ if(Option::output_dir != qmake_getpwd())
+ project->values("INCLUDEPATH").append(".");
}
//fix up the target deps
@@ -1748,7 +1749,7 @@ MakefileGenerator::writeExtraTargets(QTextStream &t)
deps += " " + escapeDependencyPath(dep);
}
if(project->values((*it) + ".CONFIG").indexOf("fix_target") != -1)
- targ = fileFixify(targ);
+ targ = fileFixify(targ, Option::output_dir, Option::output_dir);
if(project->isEmpty("QMAKE_NOFORCE") &&
project->values((*it) + ".CONFIG").indexOf("phony") != -1)
deps += QString(" ") + "FORCE";
@@ -2464,7 +2465,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
//qmake it
if(!subtarget->profile.isEmpty()) {
QString out = subtarget->makefile;
- QString in = fileFixify(in_directory + subtarget->profile, out_directory, QString(), FileFixifyAbsolute);
+ QString in = fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute);
if(out.startsWith(in_directory))
out = out.mid(in_directory.length());
t << mkfile << ": " << "\n\t";
@@ -2816,9 +2817,6 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q
QString ret = unescapeFilePath(file);
//do the fixin'
- QString pwd = qmake_getpwd();
- if (!pwd.endsWith('/'))
- pwd += '/';
QString orig_file = ret;
if(ret.startsWith(QLatin1Char('~'))) {
if(ret.startsWith(QLatin1String("~/")))
@@ -2827,12 +2825,16 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q
warn_msg(WarnLogic, "Unable to expand ~ in %s", ret.toLatin1().constData());
}
if(fix == FileFixifyAbsolute || (fix == FileFixifyDefault && project->isActiveConfig("no_fixpath"))) {
- if(fix == FileFixifyAbsolute && QDir::isRelativePath(ret)) //already absolute
+ if(fix == FileFixifyAbsolute && QDir::isRelativePath(ret)) { //already absolute
+ QString pwd = qmake_getpwd();
+ if (!pwd.endsWith(QLatin1Char('/')))
+ pwd += QLatin1Char('/');
ret.prepend(pwd);
+ }
ret = Option::fixPathToTargetOS(ret, false, canon);
} else { //fix it..
QString out_dir = QDir(Option::output_dir).absoluteFilePath(out_d);
- QString in_dir = QDir(pwd).absoluteFilePath(in_d);
+ QString in_dir = QDir(qmake_getpwd()).absoluteFilePath(in_d);
{
QFileInfo in_fi(fileInfo(in_dir));
if(in_fi.exists())
@@ -2886,6 +2888,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q
//prepend
for(int o = 0; o < i; o++)
dot_prefix += ".." + Option::dir_sep;
+ break;
}
}
ret.prepend(dot_prefix);
@@ -2898,7 +2901,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q
ret = ".";
debug_msg(3, "Fixed[%d,%d] %s :: to :: %s [%s::%s] [%s::%s]", fix, canon, orig_file.toLatin1().constData(),
ret.toLatin1().constData(), in_d.toLatin1().constData(), out_d.toLatin1().constData(),
- pwd.toLatin1().constData(), Option::output_dir.toLatin1().constData());
+ qmake_getpwd().toLatin1().constData(), Option::output_dir.toLatin1().constData());
return ret;
}
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 212f8bd..9f14492 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -795,7 +795,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
ddir = project->first("QMAKE_DISTDIR");
QString ddir_c = escapeFilePath(fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") :
- project->first("OBJECTS_DIR")) + ddir));
+ project->first("OBJECTS_DIR")) + ddir,
+ Option::output_dir, Option::output_dir));
t << "dist: " << "\n\t"
<< mkdir_p_asstring(ddir_c) << "\n\t"
<< "$(COPY_FILE) --parents $(SOURCES) $(DIST) " << ddir_c << Option::dir_sep << " && ";
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 815a476..88a5043 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -2219,6 +2219,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
Option::fixPathToLocalOS(inFile, true, false),
out);
if(Project->canExecute(dep_cmd)) {
+ dep_cmd.prepend(QLatin1String("cd ")
+ + Project->escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false))
+ + QLatin1String(" && "));
if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) {
QString indeps;
while(!feof(proc)) {
@@ -2233,7 +2236,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
for (int i = 0; i < extradeps.count(); ++i) {
QString dd = extradeps.at(i).simplified();
if (!dd.isEmpty())
- deps += Project->fileFixify(dd);
+ deps += Project->fileFixify(dd, QString(), Option::output_dir);
}
}
}
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 80f5bde..56f3bfd 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -360,6 +360,25 @@ QUuid VcprojGenerator::increaseUUID(const QUuid &id)
return result;
}
+QStringList VcprojGenerator::collectSubDirs(QMakeProject *proj)
+{
+ QStringList subdirs;
+ QStringList tmp_proj_subdirs = proj->variables()["SUBDIRS"];
+ for(int x = 0; x < tmp_proj_subdirs.size(); ++x) {
+ QString tmpdir = tmp_proj_subdirs.at(x);
+ if(!proj->isEmpty(tmpdir + ".file")) {
+ if(!proj->isEmpty(tmpdir + ".subdir"))
+ warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s",
+ tmpdir.toLatin1().constData());
+ tmpdir = proj->first(tmpdir + ".file");
+ } else if(!proj->isEmpty(tmpdir + ".subdir")) {
+ tmpdir = proj->first(tmpdir + ".subdir");
+ }
+ subdirs += tmpdir;
+ }
+ return subdirs;
+}
+
void VcprojGenerator::writeSubDirs(QTextStream &t)
{
// Check if all requirements are fulfilled
@@ -394,7 +413,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
QHash<QString, VcsolutionDepend*> solution_depends;
QList<VcsolutionDepend*> solution_cleanup;
- QStringList subdirs = project->values("SUBDIRS");
QString oldpwd = qmake_getpwd();
// Make sure that all temp projects are configured
@@ -403,16 +421,9 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
QStringList old_after_vars = Option::after_user_vars;
Option::after_user_vars.append("CONFIG+=release");
+ QStringList subdirs = collectSubDirs(project);
for(int i = 0; i < subdirs.size(); ++i) {
QString tmp = subdirs.at(i);
- if(!project->isEmpty(tmp + ".file")) {
- if(!project->isEmpty(tmp + ".subdir"))
- warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s",
- tmp.toLatin1().constData());
- tmp = project->first(tmp + ".file");
- } else if(!project->isEmpty(tmp + ".subdir")) {
- tmp = project->first(tmp + ".subdir");
- }
QFileInfo fi(fileInfo(Option::fixPathToLocalOS(tmp, true)));
if(fi.exists()) {
if(fi.isDir()) {
@@ -436,19 +447,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
continue;
}
if(tmp_proj.first("TEMPLATE") == "vcsubdirs") {
- QStringList tmp_proj_subdirs = tmp_proj.variables()["SUBDIRS"];
- for(int x = 0; x < tmp_proj_subdirs.size(); ++x) {
- QString tmpdir = tmp_proj_subdirs.at(x);
- if(!tmp_proj.isEmpty(tmpdir + ".file")) {
- if(!tmp_proj.isEmpty(tmpdir + ".subdir"))
- warn_msg(WarnLogic, "Cannot assign both file and subdir for subdir %s",
- tmpdir.toLatin1().constData());
- tmpdir = tmp_proj.first(tmpdir + ".file");
- } else if(!tmp_proj.isEmpty(tmpdir + ".subdir")) {
- tmpdir = tmp_proj.first(tmpdir + ".subdir");
- }
+ foreach(const QString &tmpdir, collectSubDirs(&tmp_proj))
subdirs += fileFixify(tmpdir);
- }
} else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") {
// Initialize a 'fake' project to get the correct variables
// and to be able to extract all the dependencies
@@ -1319,6 +1319,9 @@ void VcprojGenerator::initResourceFiles()
dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false);
if(canExecute(dep_cmd)) {
+ dep_cmd.prepend(QLatin1String("cd ")
+ + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false))
+ + QLatin1String(" && "));
if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) {
QString indeps;
while(!feof(proc)) {
@@ -1329,7 +1332,8 @@ void VcprojGenerator::initResourceFiles()
}
QT_PCLOSE(proc);
if(!indeps.isEmpty())
- deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '));
+ deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '),
+ QString(), Option::output_dir);
}
}
}
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index fdcd73f..afe8f9f 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -131,6 +131,7 @@ protected:
QList<VcprojGenerator*> mergedProjects;
private:
+ QStringList collectSubDirs(QMakeProject *proj);
QUuid increaseUUID(const QUuid &id);
friend class VCFilter;
};
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 815f210..d4fa786 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -1342,10 +1342,10 @@ QMakeProject::read(uchar cmd)
}
if(QDir::isRelativePath(qmakespec)) {
- if (QFile::exists(qmakespec+"/qmake.conf")) {
- Option::mkfile::qmakespec = QFileInfo(Option::mkfile::qmakespec).absoluteFilePath();
- } else if (QFile::exists(Option::output_dir+"/"+qmakespec+"/qmake.conf")) {
+ if (QFile::exists(Option::output_dir+"/"+qmakespec+"/qmake.conf")) {
qmakespec = Option::mkfile::qmakespec = QFileInfo(Option::output_dir+"/"+qmakespec).absoluteFilePath();
+ } else if (QFile::exists(qmakespec+"/qmake.conf")) {
+ Option::mkfile::qmakespec = QFileInfo(Option::mkfile::qmakespec).absoluteFilePath();
} else {
bool found_mkspec = false;
for(QStringList::ConstIterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) {
@@ -2770,6 +2770,20 @@ QMakeProject::expand(const QString &str)
return QStringList();
}
+QString
+QMakeProject::expand(const QString &str, const QString &file, int line)
+{
+ bool ok;
+ parser_info pi = parser;
+ parser.file = file;
+ parser.line_no = line;
+ parser.from_file = false;
+ QMap<QString, QStringList> tmp = vars;
+ const QStringList ret = doVariableReplaceExpand(str, tmp, &ok);
+ parser = pi;
+ return ok ? ret.join(QString(Option::field_sep)) : QString();
+}
+
QStringList
QMakeProject::expand(const QString &func, const QList<QStringList> &args)
{
@@ -3025,17 +3039,17 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList
if(!Option::user_template.isEmpty()) {
var = ".BUILTIN.USER." + var;
place[var] = QStringList(Option::user_template);
- } else if(!place[var].isEmpty()) {
- QString orig_template = place["TEMPLATE"].first(), real_template;
+ } else {
+ QString orig_template, real_template;
+ if(!place[var].isEmpty())
+ orig_template = place[var].first();
+ real_template = orig_template.isEmpty() ? "app" : orig_template;
if(!Option::user_template_prefix.isEmpty() && !orig_template.startsWith(Option::user_template_prefix))
- real_template = Option::user_template_prefix + orig_template;
- if(!real_template.isEmpty()) {
+ real_template.prepend(Option::user_template_prefix);
+ if(real_template != orig_template) {
var = ".BUILTIN." + var;
place[var] = QStringList(real_template);
}
- } else {
- var = ".BUILTIN." + var;
- place[var] = QStringList("app");
}
} else if(var.startsWith(QLatin1String("QMAKE_HOST."))) {
QString ret, type = var.mid(11);
diff --git a/qmake/project.h b/qmake/project.h
index 09aa45e..0e6131d 100644
--- a/qmake/project.h
+++ b/qmake/project.h
@@ -144,6 +144,7 @@ public:
QMap<QString, QStringList> &place);
QStringList expand(const QString &v);
+ QString expand(const QString &v, const QString &file, int line);
QStringList expand(const QString &func, const QList<QStringList> &args);
bool test(const QString &v);
bool test(const QString &func, const QList<QStringList> &args);