diff options
Diffstat (limited to 'qmake/generators/makefile.cpp')
-rw-r--r-- | qmake/generators/makefile.cpp | 77 |
1 files changed, 58 insertions, 19 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 5c61a3c65c..7ff921549d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -173,6 +173,9 @@ MakefileGenerator::initOutPaths() if (noIO() || (project->first("TEMPLATE") == "subdirs")) continue; + if (inhibitMakeDirOutPath(dkey)) + continue; + QString path = project->first(dkey).toQString(); //not to be changed any further path = fileFixify(path, FileFixifyBackwards); debug_msg(3, "Fixed output_dir %s (%s) into %s", dirs[x], @@ -216,6 +219,18 @@ MakefileGenerator::initOutPaths() } } +/* + * For the given directory path, return true if MakefileGenerator::initOutPaths() should inhibit the + * creation of the directory. Overload this in subclasses. + */ +bool +MakefileGenerator::inhibitMakeDirOutPath(const ProKey &path) const +{ + Q_UNUSED(path); + return false; +} + + QMakeProject *MakefileGenerator::projectFile() const { @@ -945,6 +960,15 @@ MakefileGenerator::filterIncludedFiles(const char *var) inputs.end()); } +void MakefileGenerator::processSources() +{ + if (project->isActiveConfig("compile_included_sources")) + return; + + filterIncludedFiles("SOURCES"); + filterIncludedFiles("GENERATED_SOURCES"); +} + static QString qv(const ProString &val) { @@ -1286,7 +1310,14 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild) else cmd = QLatin1String("$(QINSTALL)"); cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file); - inst << cmd; + + QString sedArgs = createSedArgs(ProKey("QMAKE_INSTALL_REPLACE"), fi.fileName()); + if (!sedArgs.isEmpty()) + inst << "$(SED) " + sedArgs + ' ' + escapeFilePath(wild) + " > " + + escapeFilePath(dst_file); + else + inst << cmd; + if (!noStrip && !project->isActiveConfig("debug_info") && !project->isActiveConfig("nostrip") && !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) inst << QString("-") + var("QMAKE_STRIP") + " " + @@ -3412,35 +3443,43 @@ static QString windowsifyPath(const QString &str) return QString(str).replace('/', QLatin1String("\\\\\\\\")); } -QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QString &src, const QString &dst) +QString MakefileGenerator::createSedArgs(const ProKey &replace_rule, const QString &file_name) const { - QString ret; - if (project->isEmpty(replace_rule) - || project->isActiveConfig("no_sed_meta_install")) { - ret += "$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst); - } else { - QString sedargs; + QString sedargs; + if (!project->isEmpty(replace_rule) && !project->isActiveConfig("no_sed_meta_install")) { const ProStringList &replace_rules = project->values(replace_rule); for (int r = 0; r < replace_rules.size(); ++r) { const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")), - replace = project->first(ProKey(replace_rules.at(r) + ".replace")); - if (!match.isEmpty() /*&& match != replace*/) { + replace = project->first(ProKey(replace_rules.at(r) + ".replace")), + filename = project->first(ProKey(replace_rules.at(r) + ".filename")); + if (!match.isEmpty() /*&& match != replace*/ + && (filename.isEmpty() || filename == file_name)) { sedargs += " -e " + shellQuote("s," + match + "," + replace + ",g"); - if (isWindowsShell() && project->first(ProKey(replace_rules.at(r) + ".CONFIG")).contains("path")) - sedargs += " -e " + shellQuote("s," + windowsifyPath(match.toQString()) - + "," + windowsifyPath(replace.toQString()) + ",gi"); + if (isWindowsShell() + && project->first(ProKey(replace_rules.at(r) + ".CONFIG")).contains("path")) + sedargs += " -e " + + shellQuote("s," + windowsifyPath(match.toQString()) + "," + + windowsifyPath(replace.toQString()) + ",gi"); } } - if (sedargs.isEmpty()) { - ret += "$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst); - } else { - ret += "$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst); - } + } + return sedargs; +} + +QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QString &src, + const QString &dst) const +{ + QString ret; + QString sedargs = createSedArgs(replace_rule); + if (sedargs.isEmpty()) { + ret = "$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst); + } else { + ret = "$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst); } return ret; } -QString MakefileGenerator::shellQuote(const QString &str) +QString MakefileGenerator::shellQuote(const QString &str) const { return isWindowsShell() ? IoUtils::shellQuoteWin(str) : IoUtils::shellQuoteUnix(str); } |