diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-03-27 16:14:10 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-03-27 16:14:10 +0200 |
commit | c699c956d75dfaaded5bb24c5ea16edc73588649 (patch) | |
tree | 168245560a535714c841ded6640b69b22bf7b08d /build/context.cxx | |
parent | 9c02d307d69faa6e3c7056d8e07f16c75c189f92 (diff) |
Rework dependency state dump support
We now have a combined (scopes, variables, and targets) dump.
Diffstat (limited to 'build/context.cxx')
-rw-r--r-- | build/context.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/build/context.cxx b/build/context.cxx index 92f3db9..872a428 100644 --- a/build/context.cxx +++ b/build/context.cxx @@ -106,13 +106,20 @@ namespace build return out_root / s.leaf (src_root); } + const path* relative_base = &work; + path - relative_work (const path& p) + relative (const path& p) { - if (p.sub (work)) - return p.leaf (work); + const path& b (*relative_base); + + if (b.empty ()) + return p; + + if (p.sub (b)) + return p.leaf (b); - // If work is a sub-path of {src,out}_root and this path is also a + // If base is a sub-path of {src,out}_root and this path is also a // sub-path of it, then use '..' to form a relative path. // // Don't think this is a good heuristic. For example, why shouldn't @@ -125,9 +132,9 @@ namespace build return p.relative (work); */ - if (p.root_directory () == work.root_directory ()) + if (p.root_directory () == b.root_directory ()) { - path r (p.relative (work)); + path r (p.relative (b)); if (r.string ().size () < p.string ().size ()) return r; |