aboutsummaryrefslogtreecommitdiff
path: root/build/dump.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-26 09:53:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-26 09:53:41 +0200
commit54e24990203f5e123396a44297ea4656ed3b6101 (patch)
treed6581a15fa0fea6a5de7c7c7e5147f3d7c865cc9 /build/dump.cxx
parent478c521c09f1962e9d82a3fc4297e5cafb8c0758 (diff)
Rework resolved prerequisite targets storage
Diffstat (limited to 'build/dump.cxx')
-rw-r--r--build/dump.cxx48
1 files changed, 35 insertions, 13 deletions
diff --git a/build/dump.cxx b/build/dump.cxx
index 9299a86..3f8eb15 100644
--- a/build/dump.cxx
+++ b/build/dump.cxx
@@ -19,25 +19,47 @@ using namespace std;
namespace build
{
static void
- dump_target (ostream& os, const target& t)
+ dump_target (ostream& os, action a, const target& t)
{
- //@@ Need to print group info somehow.
+ os << t;
- os << t << ':';
+ if (t.group != nullptr)
+ os << "->" << *t.group;
- for (const prerequisite_target& pe: t.prerequisites)
+ os << ':';
+
+ // If the target has been matched to a rule, print resolved
+ // prerequisite targets.
+ //
+ if (t.recipe (a))
{
- os << ' ';
+ for (const target* pt: t.prerequisite_targets)
+ {
+ if (pt == nullptr) // Skipped.
+ continue;
- if (pe.target != nullptr)
- os << *pe.target;
- else
- os << *pe.prereq;
+ os << ' ' << *pt;
+ }
+ }
+ else
+ {
+ for (const prerequisite& p: t.prerequisites)
+ {
+ os << ' ';
+
+ // Print it as target if one has been cached.
+ //
+ if (p.target != nullptr)
+ os << *p.target;
+ else
+ os << p;
+ }
}
}
static void
dump_scope (ostream& os,
+ action a,
scope& p,
scope_map::iterator& i,
string& ind,
@@ -94,7 +116,7 @@ namespace build
os << endl;
scope& s (i->second);
- dump_scope (os, s, ++i, ind, rts);
+ dump_scope (os, a, s, ++i, ind, rts);
sb = true;
}
@@ -141,7 +163,7 @@ namespace build
os << endl
<< ind;
- dump_target (os, t);
+ dump_target (os, a, t);
}
ind.resize (ind.size () - 2);
@@ -152,7 +174,7 @@ namespace build
}
void
- dump ()
+ dump (action a)
{
auto i (scopes.begin ());
scope& g (i->second); // Global scope.
@@ -162,7 +184,7 @@ namespace build
set<const target*> rts;
ostream& os (*diag_stream);
- dump_scope (os, g, ++i, ind, rts);
+ dump_scope (os, a, g, ++i, ind, rts);
os << endl;
}
}