aboutsummaryrefslogtreecommitdiff
path: root/build/algorithm.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-01-14 11:39:21 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-01-14 11:39:21 +0200
commitce8a94e6a76097ef7eeb34df4257991a20599712 (patch)
tree5e83b9d083f486a6efe889102f7c2a815e6a06c6 /build/algorithm.cxx
parentab4421747146aa7995f0cfb1a639c9121c82c915 (diff)
Track file extension in target, prerequisite
Diffstat (limited to 'build/algorithm.cxx')
-rw-r--r--build/algorithm.cxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/build/algorithm.cxx b/build/algorithm.cxx
index 419bfaf..1d7f215 100644
--- a/build/algorithm.cxx
+++ b/build/algorithm.cxx
@@ -45,13 +45,34 @@ namespace build
//
auto r (
targets.emplace (
- unique_ptr<target> (p.type.factory (p.name, move (d)))));
+ unique_ptr<target> (p.type.factory (move (d), p.name, p.ext))));
+
+ target& t (**r.first);
trace (4, [&]{
- tr << (r.second ? "new" : "existing") << " target " << **r.first
+ tr << (r.second ? "new" : "existing") << " target " << t
<< " for prerequsite " << p;});
- return (p.target = r.first->get ());
+ // Update extension if the existing target has it unspecified.
+ //
+ if (t.ext != p.ext)
+ {
+ trace (4, [&]{
+ tracer::record r (tr);
+ r << "assuming target " << t << " is the same as the one with ";
+ if (p.ext == nullptr)
+ r << "unspecified extension";
+ else if (p.ext->empty ())
+ r << "no extension";
+ else
+ r << "extension " << *p.ext;
+ });
+
+ if (p.ext != nullptr)
+ t.ext = p.ext;
+ }
+
+ return (p.target = &t);
}
bool