aboutsummaryrefslogtreecommitdiff
path: root/build2/prerequisite.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/prerequisite.cxx')
-rw-r--r--build2/prerequisite.cxx22
1 files changed, 16 insertions, 6 deletions
diff --git a/build2/prerequisite.cxx b/build2/prerequisite.cxx
index 2192abe..fb432eb 100644
--- a/build2/prerequisite.cxx
+++ b/build2/prerequisite.cxx
@@ -22,16 +22,26 @@ namespace build2
{
if (pk.proj != nullptr)
os << *pk.proj << '%';
-
- // Don't print scope if we are project-qualified or the
- // prerequisite's directory is absolute. In both these
- // cases the scope is not used to resolve it to target.
+ //
+ // Don't print scope if we are project-qualified or the prerequisite's
+ // directory is absolute. In both these cases the scope is not used to
+ // resolve it to target.
//
else if (!pk.tk.dir->absolute ())
{
- string s (diag_relative (pk.scope->out_path (), false));
+ // Avoid printing './' in './:...', similar to what we do for the
+ // directory in target_key.
+ //
+ const dir_path& s (pk.scope->out_path ());
+
+ if (stream_verb (os) < 2)
+ {
+ const string& r (diag_relative (s, false));
- if (!s.empty ())
+ if (!r.empty ())
+ os << r << ':';
+ }
+ else
os << s << ':';
}