aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-06-24 10:29:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-06-24 10:29:09 +0200
commitf1c981a22365411794806ed0744b857ef0804e35 (patch)
treeaf453c932bfa597a04dc7af17d5f5720f863d081 /libbuild2/target.hxx
parent1c12242aa7cd00e35a9be43b664e5486b2adc846 (diff)
Allow ad hoc rules not to list targets that are updated during match
For example, this allows a Qt moc rule not to list generated headers from libQtCore since they are pre-generated by the library.
Diffstat (limited to 'libbuild2/target.hxx')
-rw-r--r--libbuild2/target.hxx33
1 files changed, 27 insertions, 6 deletions
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index 411025c..1a7abfc 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -75,27 +75,48 @@ namespace build2
//
// The include member normally just indicates (in the first bit) whether
// this prerequisite is ad hoc. But it can also carry additional information
- // (for example, from operation-specific override) in other bits.
+ // (for example, from operation-specific override) in other bits (see below
+ // for details).
//
struct prerequisite_target
{
using target_type = build2::target;
prerequisite_target (const target_type* t, bool a = false, uintptr_t d = 0)
- : target (t), include (a ? 1 : 0), data (d) {}
+ : target (t), include (a ? include_adhoc : 0), data (d) {}
prerequisite_target (const target_type* t, include_type a, uintptr_t d = 0)
: prerequisite_target (t, a == include_type::adhoc, d) {}
+ const target_type* target;
+
operator const target_type*& () {return target;}
operator const target_type* () const {return target;}
const target_type* operator-> () const {return target;}
- bool adhoc () const {return (include & 1) != 0;}
+ // The first 8 bits are reserved with the first two having the following
+ // semantics:
+ //
+ // adhoc
+ //
+ // This prerequisite is ad hoc.
+ //
+ // udm
+ //
+ // This prerequisite is updated during match. Note that only static
+ // prerequisites that are updated during match should have this bit set
+ // (see dyndep_rule::*_existing_file() for details).
+ //
+ static const uintptr_t include_adhoc = 0x01;
+ static const uintptr_t include_udm = 0x02;
- const target_type* target;
- uintptr_t include; // First bit is 1 if include=adhoc.
- uintptr_t data;
+ uintptr_t include;
+
+ bool adhoc () const {return (include & include_adhoc) != 0;}
+
+ // Auxiliary data.
+ //
+ uintptr_t data;
};
using prerequisite_targets = vector<prerequisite_target>;