diff options
author | Brad King <brad.king@kitware.com> | 2015-03-06 19:35:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-03-07 00:58:30 (GMT) |
commit | 66a9c90c4bb5bf93bd570a423f99486b24b9337d (patch) | |
tree | 80981870edca309ea660a41ccc4c2c3f758dea4c /Source/cmLocalUnixMakefileGenerator3.h | |
parent | eb3bced50fe7da40015a1d32dae96f0abf401ff6 (diff) | |
download | CMake-66a9c90c4bb5bf93bd570a423f99486b24b9337d.zip CMake-66a9c90c4bb5bf93bd570a423f99486b24b9337d.tar.gz CMake-66a9c90c4bb5bf93bd570a423f99486b24b9337d.tar.bz2 |
Makefile: Fix multiple custom command outputs regression (#15116)
In commit v3.2.0-rc1~272^2~2 (Makefile: Fix rebuild with multiple custom
command outputs, 2014-12-05) we changed the generated makefile pattern
for multiple outputs from
out1: depends...
commands...
out2: out1
to
out1 out2: depends...
commands...
This was based on the incorrect assumption that make tools would treat
this as a combined output rule and run the command(s) exactly once for
them. It turns out that instead this new pattern is equivalent to
out1: depends...
commands...
out2: depends...
commands...
so the commands may be run more than once.
Some documents suggest using a "dedicated witness" stamp file:
stamp: depends...
rm -f stamp
touch stamp.tmp
commands...
mv stamp.tmp stamp
out1 out2: stamp
However, if the commands fail the error message will refer to the stamp
instead of any of the real outputs, which may be confusing to readers.
Also, this approach seems to have the same behavior of the original
approach that motiviated the above commit: multiple invocations are
needed to bring consumers of the outputs up to date.
Instead we can return to the original approach but add an explicit
touch to each extra output rule:
out1: depends...
commands...
out2: out1
touch -c out2
This causes make tools to recognize that all outputs have changed and
therefore to execute any commands that consume them.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.h')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.h | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 7c8e27f..4f2e4a0 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -61,13 +61,6 @@ public: const std::vector<std::string>& commands, bool symbolic, bool in_help = false); - void WriteMakeRule(std::ostream& os, - const char* comment, - const std::vector<std::string>& outputs, - const std::vector<std::string>& depends, - const std::vector<std::string>& commands, - bool symbolic, - bool in_help = false); // write the main variables used by the makefiles void WriteMakeVariables(std::ostream& makefileStream); @@ -161,9 +154,6 @@ public: void SetBorlandMakeCurlyHack(bool b) { this->BorlandMakeCurlyHack = b; } - void SetNoMultiOutputMultiDepRules(bool b) - { this->NoMultiOutputMultiDepRules = b; } - // used in writing out Cmake files such as WriteDirectoryInformation static void WriteCMakeArgument(std::ostream& os, const char* s); @@ -348,7 +338,6 @@ private: bool PassMakeflags; bool MakeCommandEscapeTargetTwice; bool BorlandMakeCurlyHack; - bool NoMultiOutputMultiDepRules; //========================================================================== std::string HomeRelativeOutputPath; |