From 457afb3749f4f1d7db86c89cbf251e18fbd0dfbf Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 28 Feb 2013 12:40:16 +0100 Subject: fix parallelized "jom install" unlike unix' mkdir -p, windows' md complains if the directory already exists. the workaround is a quite complex command, so the so far used concept for assembling the command line from pieces was replaced with a single template. for symmetry, adapt the makefile existence check to the new concept as well. QMAKE_CHK_EXISTS and QMAKE_MKDIR_CMD were added, with hard-coded fallbacks (ugly). QMAKE_CHK_FILE_EXISTS and QMAKE_CHK_EXISTS_GLUE (introduced in 5.0.0) are simply deleted again. QMAKE_CHK_DIR_EXISTS and QMAKE_MKDIR remain for legacy reasons, as qmake emits them into the Makefiles, and custom commands may rely on their presence. Task-number: QTBUG-28132 Change-Id: I3d049cb5d26947e5c3d102d0c2da33afb2a95140 Reviewed-by: Joerg Bornemann Reviewed-by: Janne Anttila Reviewed-by: Kai Koehne --- qmake/generators/makefile.cpp | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'qmake/generators/makefile.cpp') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 55c819657a..3ea67fe6a5 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 ||"; + } + } ProStringList &quc = v["QMAKE_EXTRA_COMPILERS"]; @@ -2398,8 +2392,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); -- cgit v1.2.3