2011-04-27 10:05:43 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
|
|
|
** This file is part of the qmake application of the Qt Toolkit.
|
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
2012-09-19 12:28:29 +00:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-28 08:44:43 +00:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
2016-01-15 12:36:27 +00:00
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-09-19 12:28:29 +00:00
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "mingw_make.h"
|
|
|
|
#include "option.h"
|
2012-09-06 10:21:38 +00:00
|
|
|
|
|
|
|
#include <proitems.h>
|
|
|
|
|
2020-04-03 15:11:36 +00:00
|
|
|
#include <qregularexpression.h>
|
2011-04-27 10:05:43 +00:00
|
|
|
#include <qdir.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
|
|
|
QString MingwMakefileGenerator::escapeDependencyPath(const QString &path) const
|
|
|
|
{
|
|
|
|
QString ret = path;
|
2015-02-06 14:30:02 +00:00
|
|
|
ret.replace('\\', "/"); // ### this shouldn't be here
|
2018-06-08 19:18:11 +00:00
|
|
|
return MakefileGenerator::escapeDependencyPath(ret);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2015-02-06 14:30:02 +00:00
|
|
|
ProString MingwMakefileGenerator::fixLibFlag(const ProString &lib)
|
|
|
|
{
|
2015-09-23 12:57:05 +00:00
|
|
|
if (lib.startsWith("-l")) // Fallback for unresolved -l libs.
|
|
|
|
return QLatin1String("-l") + escapeFilePath(lib.mid(2));
|
|
|
|
if (lib.startsWith("-L")) // Lib search path. Needed only by -l above.
|
|
|
|
return QLatin1String("-L")
|
|
|
|
+ escapeFilePath(Option::fixPathToTargetOS(lib.mid(2).toQString(), false));
|
|
|
|
if (lib.startsWith("lib")) // Fallback for unresolved MSVC-style libs.
|
|
|
|
return QLatin1String("-l") + escapeFilePath(lib.mid(3).toQString());
|
|
|
|
return escapeFilePath(Option::fixPathToTargetOS(lib.toQString(), false));
|
2015-02-06 14:30:02 +00:00
|
|
|
}
|
|
|
|
|
2015-09-23 12:57:05 +00:00
|
|
|
MakefileGenerator::LibFlagType
|
|
|
|
MingwMakefileGenerator::parseLibFlag(const ProString &flag, ProString *arg)
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2015-09-23 12:57:05 +00:00
|
|
|
// Skip MSVC handling from Win32MakefileGenerator
|
|
|
|
return MakefileGenerator::parseLibFlag(flag, arg);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2018-06-28 15:57:53 +00:00
|
|
|
|
2020-05-30 21:29:21 +00:00
|
|
|
bool MingwMakefileGenerator::processPrlFileBase(QString &origFile, QStringView origName,
|
|
|
|
QStringView fixedBase, int slashOff)
|
2018-06-28 15:57:53 +00:00
|
|
|
{
|
2020-05-30 21:29:21 +00:00
|
|
|
if (origName.startsWith(u"lib")) {
|
2018-06-28 15:57:53 +00:00
|
|
|
QString newFixedBase = fixedBase.left(slashOff) + fixedBase.mid(slashOff + 3);
|
|
|
|
if (Win32MakefileGenerator::processPrlFileBase(origFile, origName,
|
2020-05-30 21:29:21 +00:00
|
|
|
QStringView(newFixedBase), slashOff)) {
|
2018-06-28 15:57:53 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Win32MakefileGenerator::processPrlFileBase(origFile, origName, fixedBase, slashOff);
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
|
|
|
|
{
|
|
|
|
writeHeader(t);
|
2013-08-26 17:51:57 +00:00
|
|
|
if (writeDummyMakefile(t))
|
2011-04-27 10:05:43 +00:00
|
|
|
return true;
|
|
|
|
|
|
|
|
if(project->first("TEMPLATE") == "app" ||
|
2011-05-03 13:30:28 +00:00
|
|
|
project->first("TEMPLATE") == "lib" ||
|
|
|
|
project->first("TEMPLATE") == "aux") {
|
2011-04-27 10:05:43 +00:00
|
|
|
if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
|
|
|
|
writePkgConfigFile();
|
|
|
|
writeMingwParts(t);
|
|
|
|
return MakefileGenerator::writeMakefile(t);
|
|
|
|
}
|
|
|
|
else if(project->first("TEMPLATE") == "subdirs") {
|
|
|
|
writeSubDirs(t);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-14 12:01:39 +00:00
|
|
|
QString MingwMakefileGenerator::installRoot() const
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
We include a magic prefix on the path to bypass mingw-make's "helpful"
|
|
|
|
intervention in the environment, recognising variables that look like
|
|
|
|
paths and adding the msys system root as prefix, which we don't want.
|
|
|
|
Once this hack has smuggled INSTALL_ROOT into make's variable space, we
|
|
|
|
can trivially strip the magic prefix back off to get the path we meant.
|
|
|
|
*/
|
|
|
|
return QStringLiteral("$(INSTALL_ROOT:@msyshack@%=%)");
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
void MingwMakefileGenerator::writeMingwParts(QTextStream &t)
|
|
|
|
{
|
|
|
|
writeStandardParts(t);
|
|
|
|
|
|
|
|
if (!preCompHeaderOut.isEmpty()) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString header = project->first("PRECOMPILED_HEADER").toQString();
|
2014-01-13 14:48:44 +00:00
|
|
|
QString cHeader = preCompHeaderOut + Option::dir_sep + "c";
|
|
|
|
t << escapeDependencyPath(cHeader) << ": " << escapeDependencyPath(header) << " "
|
2018-06-08 14:00:44 +00:00
|
|
|
<< finalizeDependencyPaths(findDependencies(header)).join(" \\\n\t\t")
|
2014-01-13 14:48:44 +00:00
|
|
|
<< "\n\t" << mkdir_p_asstring(preCompHeaderOut)
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\n\t$(CC) -x c-header -c $(CFLAGS) $(INCPATH) -o " << escapeFilePath(cHeader)
|
2019-04-30 10:51:36 +00:00
|
|
|
<< ' ' << escapeFilePath(header) << Qt::endl << Qt::endl;
|
2014-01-13 14:48:44 +00:00
|
|
|
QString cppHeader = preCompHeaderOut + Option::dir_sep + "c++";
|
|
|
|
t << escapeDependencyPath(cppHeader) << ": " << escapeDependencyPath(header) << " "
|
2018-06-08 14:00:44 +00:00
|
|
|
<< finalizeDependencyPaths(findDependencies(header)).join(" \\\n\t\t")
|
2014-01-13 14:48:44 +00:00
|
|
|
<< "\n\t" << mkdir_p_asstring(preCompHeaderOut)
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\n\t$(CXX) -x c++-header -c $(CXXFLAGS) $(INCPATH) -o " << escapeFilePath(cppHeader)
|
2019-04-30 10:51:36 +00:00
|
|
|
<< ' ' << escapeFilePath(header) << Qt::endl << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MingwMakefileGenerator::init()
|
|
|
|
{
|
|
|
|
/* this should probably not be here, but I'm using it to wrap the .t files */
|
|
|
|
if(project->first("TEMPLATE") == "app")
|
|
|
|
project->values("QMAKE_APP_FLAG").append("1");
|
|
|
|
else if(project->first("TEMPLATE") == "lib")
|
|
|
|
project->values("QMAKE_LIB_FLAG").append("1");
|
|
|
|
else if(project->first("TEMPLATE") == "subdirs") {
|
|
|
|
MakefileGenerator::init();
|
|
|
|
if(project->values("MAKEFILE").isEmpty())
|
|
|
|
project->values("MAKEFILE").append("Makefile");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
processVars();
|
|
|
|
|
2018-10-08 16:24:14 +00:00
|
|
|
project->values("LIBS") += project->values("RES_FILE");
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2011-11-04 12:51:20 +00:00
|
|
|
if (project->isActiveConfig("dll")) {
|
2011-04-27 10:05:43 +00:00
|
|
|
QString destDir = "";
|
|
|
|
if(!project->first("DESTDIR").isEmpty())
|
|
|
|
destDir = Option::fixPathToTargetOS(project->first("DESTDIR") + Option::dir_sep, false, false);
|
2015-09-29 10:44:30 +00:00
|
|
|
project->values("MINGW_IMPORT_LIB").prepend(destDir + project->first("LIB_TARGET"));
|
2015-02-06 14:30:02 +00:00
|
|
|
project->values("QMAKE_LFLAGS").append(QString("-Wl,--out-implib,") + fileVar("MINGW_IMPORT_LIB"));
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2011-11-04 12:51:20 +00:00
|
|
|
if (!project->values("DEF_FILE").isEmpty()) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString defFileName = fileFixify(project->first("DEF_FILE").toQString());
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("QMAKE_LFLAGS").append(QString("-Wl,") + escapeFilePath(defFileName));
|
|
|
|
}
|
|
|
|
|
2012-07-16 11:02:57 +00:00
|
|
|
if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib")
|
|
|
|
project->values("QMAKE_LFLAGS").append("-static");
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
MakefileGenerator::init();
|
|
|
|
|
|
|
|
// precomp
|
|
|
|
if (!project->first("PRECOMPILED_HEADER").isEmpty()
|
|
|
|
&& project->isActiveConfig("precompile_header")) {
|
|
|
|
QString preCompHeader = var("PRECOMPILED_DIR")
|
2012-09-06 10:21:38 +00:00
|
|
|
+ QFileInfo(project->first("PRECOMPILED_HEADER").toQString()).fileName();
|
2014-01-13 14:48:44 +00:00
|
|
|
preCompHeaderOut = preCompHeader + ".gch";
|
|
|
|
project->values("QMAKE_CLEAN").append(preCompHeaderOut + Option::dir_sep + "c");
|
|
|
|
project->values("QMAKE_CLEAN").append(preCompHeaderOut + Option::dir_sep + "c++");
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2015-02-06 14:30:02 +00:00
|
|
|
preCompHeader = escapeFilePath(preCompHeader);
|
2014-01-13 14:48:44 +00:00
|
|
|
project->values("QMAKE_RUN_CC").clear();
|
|
|
|
project->values("QMAKE_RUN_CC").append("$(CC) -c -include " + preCompHeader +
|
2013-03-18 11:21:38 +00:00
|
|
|
" $(CFLAGS) $(INCPATH) " + var("QMAKE_CC_O_FLAG") + "$obj $src");
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("QMAKE_RUN_CC_IMP").clear();
|
2014-01-13 14:48:44 +00:00
|
|
|
project->values("QMAKE_RUN_CC_IMP").append("$(CC) -c -include " + preCompHeader +
|
2013-03-18 11:21:38 +00:00
|
|
|
" $(CFLAGS) $(INCPATH) " + var("QMAKE_CC_O_FLAG") + "$@ $<");
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("QMAKE_RUN_CXX").clear();
|
2014-01-13 14:48:44 +00:00
|
|
|
project->values("QMAKE_RUN_CXX").append("$(CXX) -c -include " + preCompHeader +
|
2013-03-18 11:21:38 +00:00
|
|
|
" $(CXXFLAGS) $(INCPATH) " + var("QMAKE_CC_O_FLAG") + "$obj $src");
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("QMAKE_RUN_CXX_IMP").clear();
|
2014-01-13 14:48:44 +00:00
|
|
|
project->values("QMAKE_RUN_CXX_IMP").append("$(CXX) -c -include " + preCompHeader +
|
2013-03-18 11:21:38 +00:00
|
|
|
" $(CXXFLAGS) $(INCPATH) " + var("QMAKE_CC_O_FLAG") + "$@ $<");
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(project->isActiveConfig("dll")) {
|
2019-06-24 15:18:20 +00:00
|
|
|
project->values("QMAKE_DISTCLEAN").append(project->first("MINGW_IMPORT_LIB"));
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MingwMakefileGenerator::writeIncPart(QTextStream &t)
|
|
|
|
{
|
|
|
|
t << "INCPATH = ";
|
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &incs = project->values("INCLUDEPATH");
|
|
|
|
for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) {
|
|
|
|
QString inc = (*incit).toQString();
|
2020-04-03 15:11:36 +00:00
|
|
|
inc.replace(QRegularExpression("\\\\$"), "");
|
2013-12-09 18:56:31 +00:00
|
|
|
|
2020-06-03 10:06:01 +00:00
|
|
|
t << "-I" << escapeFilePath(inc) << ' ';
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MingwMakefileGenerator::writeLibsPart(QTextStream &t)
|
|
|
|
{
|
|
|
|
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
|
2019-04-30 10:51:36 +00:00
|
|
|
t << "LIB = " << var("QMAKE_LIB") << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
2019-04-30 10:51:36 +00:00
|
|
|
t << "LINKER = " << var("QMAKE_LINK") << Qt::endl;
|
|
|
|
t << "LFLAGS = " << var("QMAKE_LFLAGS") << Qt::endl;
|
2012-07-16 12:29:48 +00:00
|
|
|
t << "LIBS = "
|
2018-10-08 16:24:14 +00:00
|
|
|
<< fixLibFlags("LIBS").join(' ') << ' '
|
|
|
|
<< fixLibFlags("LIBS_PRIVATE").join(' ') << ' '
|
2015-02-06 14:30:02 +00:00
|
|
|
<< fixLibFlags("QMAKE_LIBS").join(' ') << ' '
|
2019-04-30 10:51:36 +00:00
|
|
|
<< fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
|
|
|
|
{
|
2017-08-07 10:17:06 +00:00
|
|
|
const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX");
|
|
|
|
if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) {
|
2011-04-27 10:05:43 +00:00
|
|
|
objectsLinkLine = "$(OBJECTS)";
|
|
|
|
} else if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
|
2019-07-22 18:24:19 +00:00
|
|
|
QString ar_response_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
|
2014-01-13 14:48:44 +00:00
|
|
|
if (!var("BUILD_NAME").isEmpty()) {
|
2019-07-22 18:24:19 +00:00
|
|
|
ar_response_file += "." + var("BUILD_NAME");
|
2014-01-13 14:48:44 +00:00
|
|
|
}
|
2017-06-22 07:49:34 +00:00
|
|
|
if (!var("MAKEFILE").isEmpty())
|
2019-07-22 18:24:19 +00:00
|
|
|
ar_response_file += "." + var("MAKEFILE");
|
2011-04-27 10:05:43 +00:00
|
|
|
// QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix.
|
2019-07-22 18:24:19 +00:00
|
|
|
QString ar_cmd = var("QMAKE_LIB");
|
2015-06-01 13:02:25 +00:00
|
|
|
if (ar_cmd.isEmpty())
|
2019-07-22 18:24:19 +00:00
|
|
|
ar_cmd = "ar -rc";
|
|
|
|
createResponseFile(ar_response_file, project->values("OBJECTS"));
|
|
|
|
objectsLinkLine = ar_cmd + ' ' + var("DEST_TARGET") + " @" + escapeFilePath(ar_response_file);
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
2018-10-09 10:51:46 +00:00
|
|
|
QString ld_response_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
|
|
|
|
if (!var("BUILD_NAME").isEmpty())
|
|
|
|
ld_response_file += "." + var("BUILD_NAME");
|
2017-06-22 07:49:34 +00:00
|
|
|
if (!var("MAKEFILE").isEmpty())
|
2018-10-09 10:51:46 +00:00
|
|
|
ld_response_file += "." + var("MAKEFILE");
|
2019-07-22 18:24:19 +00:00
|
|
|
createResponseFile(ld_response_file, project->values("OBJECTS"));
|
2018-10-09 10:51:46 +00:00
|
|
|
objectsLinkLine = "@" + escapeFilePath(ld_response_file);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
Win32MakefileGenerator::writeObjectsPart(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
|
|
|
|
{
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "first: all\n";
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName()))
|
2018-07-10 19:04:48 +00:00
|
|
|
<< ' ' << depVar("ALL_DEPS") << ' ' << depVar("DEST_TARGET") << "\n\n";
|
|
|
|
t << depVar("DEST_TARGET") << ": "
|
|
|
|
<< depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS");
|
2016-11-18 18:05:54 +00:00
|
|
|
if (project->first("TEMPLATE") == "aux") {
|
|
|
|
t << "\n\n";
|
|
|
|
return;
|
|
|
|
}
|
2016-12-02 18:53:47 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_PRE_LINK"))
|
|
|
|
t << "\n\t" <<var("QMAKE_PRE_LINK");
|
|
|
|
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
|
2017-10-15 07:37:22 +00:00
|
|
|
t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" << var("QMAKE_SHELL_NULL_DEVICE");
|
2018-01-02 20:49:08 +00:00
|
|
|
const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX");
|
|
|
|
if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ;
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
|
|
|
t << "\n\t" << objectsLinkLine << " " ;
|
|
|
|
}
|
2016-11-18 18:05:54 +00:00
|
|
|
} else {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\n\t$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " << objectsLinkLine << " $(LIBS)";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(!project->isEmpty("QMAKE_POST_LINK"))
|
|
|
|
t << "\n\t" <<var("QMAKE_POST_LINK");
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MingwMakefileGenerator::writeRcFilePart(QTextStream &t)
|
|
|
|
{
|
2012-09-06 10:21:38 +00:00
|
|
|
const QString rc_file = fileFixify(project->first("RC_FILE").toQString());
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-12-06 15:29:30 +00:00
|
|
|
ProStringList rcIncPaths = project->values("RC_INCLUDEPATH");
|
|
|
|
rcIncPaths.prepend(fileInfo(rc_file).path());
|
|
|
|
QString incPathStr;
|
|
|
|
for (int i = 0; i < rcIncPaths.count(); ++i) {
|
|
|
|
const ProString &path = rcIncPaths.at(i);
|
|
|
|
if (path.isEmpty())
|
|
|
|
continue;
|
|
|
|
incPathStr += QStringLiteral(" --include-dir=");
|
|
|
|
if (path != "." && QDir::isRelativePath(path.toQString()))
|
|
|
|
incPathStr += "./";
|
|
|
|
incPathStr += escapeFilePath(path);
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
if (!rc_file.isEmpty()) {
|
2015-05-27 20:31:21 +00:00
|
|
|
|
|
|
|
ProString defines = varGlue("RC_DEFINES", " -D", " -D", "");
|
|
|
|
if (defines.isEmpty())
|
|
|
|
defines = ProString(" $(DEFINES)");
|
|
|
|
|
2019-08-02 11:18:46 +00:00
|
|
|
addSourceFile(rc_file, QMakeSourceFileInfo::SEEK_DEPS);
|
|
|
|
const QStringList rcDeps = QStringList(rc_file) << dependencies(rc_file);
|
|
|
|
|
|
|
|
t << escapeDependencyPath(var("RES_FILE")) << ": "
|
|
|
|
<< escapeDependencyPaths(rcDeps).join(' ') << "\n\t"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< var("QMAKE_RC") << " -i " << escapeFilePath(rc_file) << " -o " << fileVar("RES_FILE")
|
2015-05-27 20:31:21 +00:00
|
|
|
<< incPathStr << defines << "\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList &MingwMakefileGenerator::findDependencies(const QString &file)
|
|
|
|
{
|
|
|
|
QStringList &aList = MakefileGenerator::findDependencies(file);
|
2014-11-13 14:37:55 +00:00
|
|
|
if (preCompHeaderOut.isEmpty())
|
2011-04-27 10:05:43 +00:00
|
|
|
return aList;
|
|
|
|
for (QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) {
|
|
|
|
if (file.endsWith(*it)) {
|
|
|
|
QString cHeader = preCompHeaderOut + Option::dir_sep + "c";
|
|
|
|
if (!aList.contains(cHeader))
|
|
|
|
aList += cHeader;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
|
|
|
|
if (file.endsWith(*it)) {
|
|
|
|
QString cppHeader = preCompHeaderOut + Option::dir_sep + "c++";
|
|
|
|
if (!aList.contains(cppHeader))
|
|
|
|
aList += cppHeader;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aList;
|
|
|
|
}
|
|
|
|
|
|
|
|
QT_END_NAMESPACE
|