aboutsummaryrefslogtreecommitdiff
path: root/build/rule.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build/rule.cxx')
-rw-r--r--build/rule.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/build/rule.cxx b/build/rule.cxx
index fe4c4b2..b1730e1 100644
--- a/build/rule.cxx
+++ b/build/rule.cxx
@@ -26,6 +26,11 @@ namespace build
path_target& pt (dynamic_cast<path_target&> (t));
+ // @@ TMP: derive file name by appending target name as an extension.
+ //
+ if (pt.path ().empty ())
+ pt.path (t.directory / path (pt.name + '.' + pt.type ().name));
+
return pt.mtime () != timestamp_nonexistent ? &update : nullptr;
}
@@ -37,16 +42,18 @@ namespace build
path_target& pt (dynamic_cast<path_target&> (t));
timestamp mt (pt.mtime ());
- for (const target& p: t.prerequisites ())
+ for (const prerequisite& p: t.prerequisites)
{
+ const target& pt (*p.target); // Should be resolved at this stage.
+
// If this is an mtime-based target, then simply compare timestamps.
//
- if (auto mtp = dynamic_cast<const mtime_target*> (&p))
+ if (auto mtp = dynamic_cast<const mtime_target*> (&pt))
{
if (mt < mtp->mtime ())
{
cerr << "error: no rule to update target " << t << endl
- << "info: prerequisite " << p << " is ahead of " << t <<
+ << "info: prerequisite " << pt << " is ahead of " << t <<
" by " << (mtp->mtime () - mt) << endl;
return target_state::failed;
@@ -56,10 +63,10 @@ namespace build
{
// Otherwise we assume the prerequisite is newer if it was updated.
//
- if (p.state () == target_state::updated)
+ if (pt.state () == target_state::updated)
{
cerr << "error: no rule to update target " << t << endl
- << "info: prerequisite " << p << " is ahead of " << t <<
+ << "info: prerequisite " << pt << " is ahead of " << t <<
" because it was updated" << endl;
return target_state::failed;