diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2019-03-20 14:49:27 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2019-03-25 07:26:57 +0000 |
commit | bee23d8d384632e6d17e14696cfade95db312214 (patch) | |
tree | 54f59bdee2facb4e680679679228e645e1337b70 | |
parent | f12129e655a223da23a477df4a23961d724db0ce (diff) |
Do not yield an error if there are no targets in the Makefile
NMake allows Makefiles without targets and exits with code 0.
Change-Id: If6ab21f7bd4ee640b7d1b7499fe9a3e34abef4b0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/jomlib/targetexecutor.cpp | 7 | ||||
-rw-r--r-- | tests/makefiles/blackbox/noTargets/test.mk | 1 | ||||
-rw-r--r-- | tests/tests.cpp | 8 | ||||
-rw-r--r-- | tests/tests.h | 1 |
4 files changed, 14 insertions, 3 deletions
diff --git a/src/jomlib/targetexecutor.cpp b/src/jomlib/targetexecutor.cpp index 9345939..a6eb9d9 100644 --- a/src/jomlib/targetexecutor.cpp +++ b/src/jomlib/targetexecutor.cpp @@ -86,9 +86,10 @@ void TargetExecutor::apply(Makefile* mkfile, const QStringList& targets) DescriptionBlock* descblock; if (targets.isEmpty()) { - if (mkfile->targets().isEmpty()) - throw Exception(QLatin1String("no targets in makefile")); - + if (mkfile->targets().isEmpty()) { + finishBuild(0); + return; + } descblock = mkfile->firstTarget(); } else { const QString targetName = targets.first(); diff --git a/tests/makefiles/blackbox/noTargets/test.mk b/tests/makefiles/blackbox/noTargets/test.mk new file mode 100644 index 0000000..176b4f5 --- /dev/null +++ b/tests/makefiles/blackbox/noTargets/test.mk @@ -0,0 +1 @@ +!message Hello there! diff --git a/tests/tests.cpp b/tests/tests.cpp index 03541dc..d939cb0 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -1218,6 +1218,14 @@ void Tests::nonexistentDependent() QVERIFY(output.contains("yo ho ho ho")); } +void Tests::noTargets() +{ + QVERIFY(runJom(QStringList() << "/nologo" << "/f" << "test.mk", "blackbox/noTargets")); + QCOMPARE(m_jomProcess->exitCode(), 0); + QByteArray output = m_jomProcess->readAllStandardOutput().trimmed(); + QCOMPARE(output, QByteArray("Hello there!")); +} + void Tests::outOfDateCheck() { QVERIFY(runJom(QStringList() << "/nologo" << "/j1" << "/f" << "test.mk" << "clean" << "all", diff --git a/tests/tests.h b/tests/tests.h index fe33f20..b98758c 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -81,6 +81,7 @@ private slots: void builtin_cd(); void suffixes(); void nonexistentDependent(); + void noTargets(); void outOfDateCheck(); private: |