summaryrefslogtreecommitdiff
path: root/Source/cmMakefileLibraryTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-03-06 14:35:28 -0500
committerBrad King <brad.king@kitware.com>2015-03-06 19:58:30 -0500
commit66a9c90c4bb5bf93bd570a423f99486b24b9337d (patch)
tree80981870edca309ea660a41ccc4c2c3f758dea4c /Source/cmMakefileLibraryTargetGenerator.cxx
parenteb3bced50fe7da40015a1d32dae96f0abf401ff6 (diff)
downloadcmake-66a9c90c4bb5bf93bd570a423f99486b24b9337d.tar.gz
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/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx5
1 files changed, 2 insertions, 3 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index cdda36c52c..e55f6512e5 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -765,9 +765,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
}
// Write the build rule.
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
- outputs, depends, commands, false);
-
+ this->WriteMakeRule(*this->BuildFileStream, 0, outputs,
+ depends, commands, false);
// Write the main driver rule to build everything in this target.
this->WriteTargetDriverRule(targetFullPath, relink);