aboutsummaryrefslogtreecommitdiff
path: root/build2/install/rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-09-04 16:10:21 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-09-04 16:14:08 +0200
commit3fd36c27e9455dae10ed4f569ca4362219bbcbcb (patch)
tree8dd42450651d18fbe463001f19ed04f2ed66d180 /build2/install/rule.cxx
parent5007870b52aa549971824959a55ad3bb886f09e0 (diff)
Initial work on binless (binary-less aka header-only) library support
Diffstat (limited to 'build2/install/rule.cxx')
-rw-r--r--build2/install/rule.cxx35
1 files changed, 27 insertions, 8 deletions
diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx
index 67f0e86..020551c 100644
--- a/build2/install/rule.cxx
+++ b/build2/install/rule.cxx
@@ -847,7 +847,11 @@ namespace build2
perform_install (action a, const target& xt) const
{
const file& t (xt.as<file> ());
- assert (!t.path ().empty ()); // Should have been assigned by update.
+ const path& tp (t.path ());
+
+ // Path should have been assigned by update unless it is unreal.
+ //
+ assert (!tp.empty () || t.mtime () == timestamp_unreal);
const scope& rs (t.root_scope ());
@@ -916,15 +920,22 @@ namespace build2
for (const target* m (t.member); m != nullptr; m = m->member)
{
if (const path* p = lookup_install<path> (*m, "install"))
- install_target (m->as<file> (), *p, false);
+ {
+ install_target (m->as<file> (), *p, tp.empty () /* verbose */);
+ r |= target_state::changed;
+ }
}
// Finally install the target itself (since we got here we know the
// install variable is there).
//
- install_target (t, cast<path> (t["install"]), true);
+ if (!tp.empty ())
+ {
+ install_target (t, cast<path> (t["install"]), true /* verbose */);
+ r |= target_state::changed;
+ }
- return (r |= target_state::changed);
+ return r;
}
// uninstall -d <dir>
@@ -1103,7 +1114,11 @@ namespace build2
perform_uninstall (action a, const target& xt) const
{
const file& t (xt.as<file> ());
- assert (!t.path ().empty ()); // Should have been assigned by update.
+ const path& tp (t.path ());
+
+ // Path should have been assigned by update unless it is unreal.
+ //
+ assert (!tp.empty () || t.mtime () == timestamp_unreal);
const scope& rs (t.root_scope ());
@@ -1154,7 +1169,10 @@ namespace build2
// Reverse order of installation: first the target itself (since we got
// here we know the install variable is there).
//
- target_state r (uninstall_target (t, cast<path> (t["install"]), true));
+ target_state r (target_state::unchanged);
+
+ if (!tp.empty ())
+ r |= uninstall_target (t, cast<path> (t["install"]), true);
// Then installable ad hoc group members, if any. To be anally precise
// we would have to do it in reverse, but that's not easy (it's a
@@ -1163,8 +1181,9 @@ namespace build2
for (const target* m (t.member); m != nullptr; m = m->member)
{
if (const path* p = lookup_install<path> (*m, "install"))
- r |= uninstall_target (
- m->as<file> (), *p, r != target_state::changed);
+ r |= uninstall_target (m->as<file> (),
+ *p,
+ tp.empty () || r != target_state::changed);
}
// Finally handle installable prerequisites.