diff options
Diffstat (limited to 'qmake/generators/makefile.cpp')
-rw-r--r-- | qmake/generators/makefile.cpp | 95 |
1 files changed, 24 insertions, 71 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 0e3e058c7b..7bc673bf7b 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -70,11 +70,6 @@ QT_BEGIN_NAMESPACE -// Well, Windows doesn't have this, so here's the macro -#ifndef S_ISDIR -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif - bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const { int argv0 = -1; @@ -1749,23 +1744,7 @@ MakefileGenerator::verifyExtraCompiler(const ProString &comp, const QString &fil QString tmp_out = project->values(ProKey(comp + ".output")).first().toQString(); if(tmp_out.isEmpty()) return false; - QString tmp_cmd; - const ProKey ckey(comp + ".commands"); - if (!project->isEmpty(ckey)) { - int argv0 = -1; - ProStringList cmdline = project->values(ckey); - for(int i = 0; i < cmdline.count(); ++i) { - if(!cmdline.at(i).contains('=')) { - argv0 = i; - break; - } - } - if(argv0 != -1) { - cmdline[argv0] = Option::fixPathToTargetOS(cmdline.at(argv0).toQString(), false); - tmp_cmd = cmdline.join(' '); - } - } - + const QString tmp_cmd = project->values(ProKey(comp + ".commands")).join(' '); if (config.indexOf("combine") != -1) { QString cmd = replaceExtraCompilerVariables(tmp_cmd, QString(), tmp_out); if(system(cmd.toLatin1().constData())) @@ -1829,42 +1808,10 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { QString tmp_out = fileFixify(project->first(ProKey(*it + ".output")).toQString(), Option::output_dir, Option::output_dir); - QString tmp_cmd; - const ProKey ckey(*it + ".commands"); - if (!project->isEmpty(ckey)) { - QStringList cmdline = project->values(ckey).toQStringList(); - int argv0 = findExecutable(cmdline); - if(argv0 != -1) { - cmdline[argv0] = escapeFilePath(Option::fixPathToTargetOS(cmdline.at(argv0), false)); - tmp_cmd = cmdline.join(' '); - } - } - QString tmp_dep_cmd; + const QString tmp_cmd = project->values(ProKey(*it + ".commands")).join(' '); + const QString tmp_dep_cmd = project->values(ProKey(*it + ".depend_command")).join(' '); QString dep_cd_cmd; - const ProKey dckey(*it + ".depend_command"); - if (!project->isEmpty(dckey)) { - int argv0 = -1; - ProStringList cmdline = project->values(dckey); - for(int i = 0; i < cmdline.count(); ++i) { - if(!cmdline.at(i).contains('=')) { - argv0 = i; - break; - } - } - if(argv0 != -1) { - QString arg = cmdline.at(argv0).toQString(); - const QString c = Option::fixPathToLocalOS(arg, true); - if(exists(c)) { - arg = escapeFilePath(Option::fixPathToLocalOS(arg, false)); - } else { - arg = escapeFilePath(arg); - } - QFileInfo cmdFileInfo(arg); - if (!cmdFileInfo.isAbsolute() || cmdFileInfo.exists()) { - cmdline[argv0] = arg; - tmp_dep_cmd = cmdline.join(' '); - } - } + if (!tmp_dep_cmd.isEmpty()) { dep_cd_cmd = QLatin1String("cd ") + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + QLatin1String(" && "); @@ -2254,6 +2201,25 @@ MakefileGenerator::writeMakefile(QTextStream &t) return true; } +void +MakefileGenerator::writeDefaultVariables(QTextStream &t) +{ + t << "QMAKE = " << var("QMAKE_QMAKE") << endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; + t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; + t << "MKDIR = " << var("QMAKE_MKDIR") << endl; + t << "COPY = " << var("QMAKE_COPY") << endl; + t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; + t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; + t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; + t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; + t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; + t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; + t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; + t << "MOVE = " << var("QMAKE_MOVE") << endl; +} + QString MakefileGenerator::fixifySpecdir(const QString &spec, const QString &outdir) { if (QFileInfo(spec).isAbsolute()) @@ -2464,20 +2430,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT t << "include " << (*qeui_it) << endl; if (!(flags & SubTargetSkipDefaultVariables)) { - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; - t << "MKDIR = " << var("QMAKE_MKDIR") << endl; - t << "COPY = " << var("QMAKE_COPY") << endl; - t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; - t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; - t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; - t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; - t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; - t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; - t << "MOVE = " << var("QMAKE_MOVE") << endl; + writeDefaultVariables(t); t << "SUBTARGETS = "; // subtargets are sub-directory for(int target = 0; target < targets.size(); ++target) t << " \\\n\t\t" << targets.at(target)->target; |