summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp7
-rw-r--r--qmake/generators/makefile.cpp36
-rw-r--r--qmake/generators/makefile.h2
-rw-r--r--qmake/generators/metamakefile.cpp10
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp7
-rw-r--r--qmake/library/qmakeevaluator.cpp6
-rw-r--r--qmake/main.cpp11
7 files changed, 34 insertions, 45 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 6b23cbe42e..a09e10c55e 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -137,6 +137,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
QList<ProjectBuilderSubDirs*> pb_subdirs;
pb_subdirs.append(new ProjectBuilderSubDirs(project, QString(), false));
QString oldpwd = qmake_getpwd();
+ QString oldoutpwd = Option::output_dir;
QMap<QString, ProStringList> groups;
for(int pb_subdir = 0; pb_subdir < pb_subdirs.size(); ++pb_subdir) {
ProjectBuilderSubDirs *pb = pb_subdirs[pb_subdir];
@@ -173,6 +174,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
if(!qmake_setpwd(dir))
fprintf(stderr, "Cannot find directory: %s\n", dir.toLatin1().constData());
}
+ Option::output_dir = Option::globals->shadowedPath(QDir::cleanPath(fi.absoluteFilePath()));
if(tmp_proj.read(fn)) {
if(tmp_proj.first("TEMPLATE") == "subdirs") {
QMakeProject *pp = new QMakeProject(&tmp_proj);
@@ -190,13 +192,13 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
bool in_root = true;
QString name = qmake_getpwd();
if(project->isActiveConfig("flat")) {
- QString flat_file = fileFixify(name, oldpwd, Option::output_dir, FileFixifyRelative);
+ QString flat_file = fileFixify(name, oldpwd, oldoutpwd, FileFixifyRelative);
if(flat_file.indexOf(Option::dir_sep) != -1) {
QStringList dirs = flat_file.split(Option::dir_sep);
name = dirs.back();
}
} else {
- QString flat_file = fileFixify(name, oldpwd, Option::output_dir, FileFixifyRelative);
+ QString flat_file = fileFixify(name, oldpwd, oldoutpwd, FileFixifyRelative);
if(QDir::isRelativePath(flat_file) && flat_file.indexOf(Option::dir_sep) != -1) {
QString last_grp("QMAKE_SUBDIR_PBX_HEIR_GROUP");
QStringList dirs = flat_file.split(Option::dir_sep);
@@ -278,6 +280,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
}
nextfile:
qmake_setpwd(oldpwd);
+ Option::output_dir = oldoutpwd;
}
}
}
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 3cac073d72..5a5f259358 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -92,18 +92,8 @@ bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const
QString MakefileGenerator::mkdir_p_asstring(const QString &dir, bool escape) const
{
- QString ret = "@" + chkdir + " ";
- if(escape)
- ret += escapeFilePath(dir);
- else
- ret += dir;
- ret += " " + chkglue + "$(MKDIR) ";
- if(escape)
- ret += escapeFilePath(dir);
- else
- ret += dir;
- ret += " ";
- return ret;
+ QString edir = escape ? escapeFilePath(dir) : dir;
+ return "@" + makedir.arg(edir);
}
bool MakefileGenerator::mkdir(const QString &in_path) const
@@ -440,13 +430,17 @@ MakefileGenerator::init()
if (v["TARGET"].isEmpty())
warn_msg(WarnLogic, "TARGET is empty");
- chkdir = v["QMAKE_CHK_DIR_EXISTS"].join(' ');
- chkfile = v["QMAKE_CHK_FILE_EXISTS"].join(' ');
- if (chkfile.isEmpty()) // Backwards compat with Qt4 specs
- chkfile = isWindowsShell() ? "if not exist" : "test -f";
- chkglue = v["QMAKE_CHK_EXISTS_GLUE"].join(' ');
- if (chkglue.isEmpty()) // Backwards compat with Qt4 specs
- chkglue = isWindowsShell() ? "" : "|| ";
+ makedir = v["QMAKE_MKDIR_CMD"].join(' ');
+ chkexists = v["QMAKE_CHK_EXISTS"].join(' ');
+ if (makedir.isEmpty()) { // Backwards compat with Qt < 5.0.2 specs
+ if (isWindowsShell()) {
+ makedir = "if not exist %1 mkdir %1 & if not exist %1 exit 1";
+ chkexists = "if not exist %1";
+ } else {
+ makedir = "test -d %1 || mkdir -p %1";
+ chkexists = "test -e %1 ||";
+ }
+ }
if (v["QMAKE_LINK_O_FLAG"].isEmpty())
v["QMAKE_LINK_O_FLAG"].append("-o ");
@@ -2401,8 +2395,8 @@ MakefileGenerator::writeSubTargetCall(QTextStream &t,
if (!in.isEmpty()) {
if (!in_directory.isEmpty())
t << "\n\t" << mkdir_p_asstring(out_directory);
- pfx = "( " + chkfile + " " + out + " " + chkglue
- + "$(QMAKE) " + in + buildArgs() + " -o " + out
+ pfx = "( " + chkexists.arg(out) +
+ + " $(QMAKE) " + in + buildArgs() + " -o " + out
+ " ) && ";
}
writeSubMakeCall(t, out_directory_cdin + pfx, makefilein);
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index e1447c61c3..47acc8098f 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -81,7 +81,7 @@ class MakefileGenerator : protected QMakeSourceFileInfo
QString spec;
bool init_opath_already, init_already, no_io;
QHash<QString, bool> init_compiler_already;
- QString chkdir, chkfile, chkglue;
+ QString makedir, chkexists;
QString build_args(const QString &outdir=QString());
//internal caches
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index e3fa39c7e4..a037a966f6 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -385,18 +385,16 @@ SubdirsMetaMakefileGenerator::write()
const QString &output_name = Option::output.fileName();
for(int i = 0; ret && i < subs.count(); i++) {
const Subdir *sub = subs.at(i);
- qmake_setpwd(subs.at(i)->input_dir);
- Option::output_dir = QFileInfo(subs.at(i)->output_dir).absoluteFilePath();
- if(Option::output_dir.at(Option::output_dir.length()-1) != QLatin1Char('/'))
- Option::output_dir += QLatin1Char('/');
- Option::output.setFileName(subs.at(i)->output_file);
+ qmake_setpwd(sub->input_dir);
+ Option::output_dir = QFileInfo(sub->output_dir).absoluteFilePath();
+ Option::output.setFileName(sub->output_file);
if(i != subs.count()-1) {
for (int ind = 0; ind < sub->indent; ++ind)
printf(" ");
printf("Writing %s\n", QDir::cleanPath(Option::output_dir+"/"+
Option::output.fileName()).toLatin1().constData());
}
- if (!(ret = subs.at(i)->makefile->write()))
+ if (!(ret = sub->makefile->write()))
break;
//restore because I'm paranoid
qmake_setpwd(pwd);
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index fce2147ed5..793c2ad1ad 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -434,18 +434,21 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
projLookup.insert(profileKey, fi.absoluteFilePath());
}
QString oldpwd = qmake_getpwd();
+ QString oldoutpwd = Option::output_dir;
QMakeProject tmp_proj;
QString dir = fi.absolutePath(), fn = fi.fileName();
if (!dir.isEmpty()) {
if (!qmake_setpwd(dir))
fprintf(stderr, "Cannot find directory: %s", dir.toLatin1().constData());
}
+ Option::output_dir = Option::globals->shadowedPath(QDir::cleanPath(fi.absoluteFilePath()));
if (tmp_proj.read(fn)) {
// Check if all requirements are fulfilled
if (!tmp_proj.isEmpty("QMAKE_FAILED_REQUIREMENTS")) {
fprintf(stderr, "Project file(%s) not added to Solution because all requirements not met:\n\t%s\n",
fn.toLatin1().constData(), tmp_proj.values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData());
qmake_setpwd(oldpwd);
+ Option::output_dir = oldoutpwd;
continue;
}
if (tmp_proj.first("TEMPLATE") == "vcsubdirs") {
@@ -460,13 +463,10 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
// and to be able to extract all the dependencies
Option::QMAKE_MODE old_mode = Option::qmake_mode;
Option::qmake_mode = Option::QMAKE_GENERATE_NOTHING;
- QString old_output_dir = Option::output_dir;
- Option::output_dir = QFileInfo(fileFixify(dir, qmake_getpwd(), Option::output_dir)).canonicalFilePath();
VcprojGenerator tmp_vcproj;
tmp_vcproj.setNoIO(true);
tmp_vcproj.setProjectFile(&tmp_proj);
Option::qmake_mode = old_mode;
- Option::output_dir = old_output_dir;
// We assume project filename is [QMAKE_PROJECT_NAME].vcproj
QString vcproj = unescapeFilePath(tmp_vcproj.project->first("QMAKE_PROJECT_NAME") + project->first("VCPROJ_EXTENSION"));
@@ -578,6 +578,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
}
nextfile:
qmake_setpwd(oldpwd);
+ Option::output_dir = oldoutpwd;
}
}
}
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index 4f4e5854f1..0515fe1c98 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -1062,7 +1062,7 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
forever {
QString superfile = superdir + QLatin1String("/.qmake.super");
if (IoUtils::exists(superfile)) {
- m_superfile = superfile;
+ m_superfile = QDir::cleanPath(superfile);
break;
}
QFileInfo qdfi(superdir);
@@ -1099,8 +1099,8 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
} else {
m_buildRoot = QFileInfo(cachefile).path();
}
- m_conffile = conffile;
- m_cachefile = cachefile;
+ m_conffile = QDir::cleanPath(conffile);
+ m_cachefile = QDir::cleanPath(cachefile);
}
no_cache:
diff --git a/qmake/main.cpp b/qmake/main.cpp
index 2056e36322..55f915b52f 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -97,15 +97,8 @@ int runQMake(int argc, char **argv)
}
QString oldpwd = qmake_getpwd();
-#ifdef Q_OS_WIN
- if(!(oldpwd.length() == 3 && oldpwd[0].isLetter() && oldpwd.endsWith(":/")))
-#endif
- {
- if(!oldpwd.endsWith(QLatin1Char('/')))
- oldpwd += QLatin1Char('/');
- }
- Option::output_dir = oldpwd; //for now this is the output dir
+ Option::output_dir = oldpwd; //for now this is the output dir
if(Option::output.fileName() != "-") {
QFileInfo fi(Option::output);
QString dir;
@@ -124,7 +117,7 @@ int runQMake(int argc, char **argv)
if(!dir.isNull() && dir != ".")
Option::output_dir = dir;
if(QDir::isRelativePath(Option::output_dir))
- Option::output_dir.prepend(oldpwd);
+ Option::output_dir.prepend(oldpwd + QLatin1Char('/'));
Option::output_dir = QDir::cleanPath(Option::output_dir);
}