aboutsummaryrefslogtreecommitdiff
path: root/build/prerequisite.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-01-08 13:27:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-01-08 13:27:15 +0200
commitab4421747146aa7995f0cfb1a639c9121c82c915 (patch)
treedeb08893c02ed0238f73becbbe80ede5568b946e /build/prerequisite.cxx
parentd3e624ef7c0fb274e62b81c4c7bd59640770520a (diff)
Implement tracing support
Also use to-relative path translation in diagnostics.
Diffstat (limited to 'build/prerequisite.cxx')
-rw-r--r--build/prerequisite.cxx33
1 files changed, 31 insertions, 2 deletions
diff --git a/build/prerequisite.cxx b/build/prerequisite.cxx
index 8153a6c..c43827d 100644
--- a/build/prerequisite.cxx
+++ b/build/prerequisite.cxx
@@ -6,7 +6,9 @@
#include <ostream>
+#include <build/scope>
#include <build/target> // target_type
+#include <build/context>
using namespace std;
@@ -15,9 +17,36 @@ namespace build
ostream&
operator<< (ostream& os, const prerequisite& p)
{
- // @@ TODO: need to come up with a relative (to current) path.
+ if (p.target != nullptr)
+ os << *p.target;
+ else
+ {
+ os << p.type.name << '{';
- return os << p.type.name << '{' << p.name << '}';
+ // Print scope unless the directory is absolute.
+ //
+ if (!p.directory.absolute ())
+ {
+ string s (diagnostic_string (p.scope.path ()));
+
+ if (!s.empty ())
+ os << s << path::traits::directory_separator << ": ";
+ }
+
+ // Print directory.
+ //
+ if (!p.directory.empty ())
+ {
+ string s (diagnostic_string (p.directory));
+
+ if (!s.empty ())
+ os << s << path::traits::directory_separator;
+ }
+
+ os << p.name << '}';
+ }
+
+ return os;
}
bool