Make the Makefile a dependency of default targets for nmake

If the user changes the .pro file, the Makefile is supposed to be
re-generated by calling qmake again. NMake however lacks a "Makefile
remake feature" like GNU make has.

The generated Makefiles for nmake however have already a proper
Makefile target that can be used to re-generate the Makefile. What was
missing is the dependency from an entry-target in the meta-Makefile.

Now changes in the .pro file trigger a re-generation of
Makefile.Debug/Makefile.Release when calling nmake without target
arguments or with "debug" or "release".

Fixes: QTBUG-29193
Change-Id: I9f2dd5deba4a043ab6c9502bb0b0ba83dc843612
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Joerg Bornemann 2019-02-01 10:54:30 +01:00 committed by Oliver Wolff
parent 3bf895c8d5
commit 29d5a287ab
4 changed files with 10 additions and 0 deletions

View File

@ -2585,6 +2585,9 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
{ //actually compile
t << subtarget->target << ":";
auto extraDeps = extraSubTargetDependencies();
if (!extraDeps.isEmpty())
t << " " << valList(extraDeps);
if(!subtarget->depends.isEmpty())
t << " " << valList(subtarget->depends);
t << " FORCE";

View File

@ -119,6 +119,7 @@ protected:
virtual void writeSubMakeCall(QTextStream &t, const QString &outDirectory_cdin,
const QString &makeFileIn);
virtual void writeSubTargets(QTextStream &t, QList<SubTarget*> subtargets, int flags);
virtual ProStringList extraSubTargetDependencies() { return {}; }
//extra compiler interface
bool verifyExtraCompiler(const ProString &c, const QString &f);

View File

@ -76,6 +76,11 @@ void NmakeMakefileGenerator::writeSubMakeCall(QTextStream &t, const QString &cal
Win32MakefileGenerator::writeSubMakeCall(t, callPrefix, makeArguments);
}
ProStringList NmakeMakefileGenerator::extraSubTargetDependencies()
{
return { "$(MAKEFILE)" };
}
QString NmakeMakefileGenerator::defaultInstall(const QString &t)
{
QString ret = Win32MakefileGenerator::defaultInstall(t);

View File

@ -48,6 +48,7 @@ class NmakeMakefileGenerator : public Win32MakefileGenerator
protected:
void writeSubMakeCall(QTextStream &t, const QString &callPrefix,
const QString &makeArguments) override;
ProStringList extraSubTargetDependencies() override;
QString defaultInstall(const QString &t) override;
QStringList &findDependencies(const QString &file) override;
QString var(const ProKey &value) const override;