aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-09-24 13:10:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-09-24 13:10:25 +0200
commitb6c61ea9afd2d738711770e44748e48be009154d (patch)
tree9f4e2ab650e8359e3fe0a9c5eed45dc2f2f4f160 /libbuild2/target.hxx
parentc94f066bbd47520cf52937fc4ad08a699abda28a (diff)
Give hints for common causes of "no rule to update ..." error
Diffstat (limited to 'libbuild2/target.hxx')
-rw-r--r--libbuild2/target.hxx43
1 files changed, 32 insertions, 11 deletions
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index 17a99d3..ec97950 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -99,6 +99,31 @@ namespace build2
// Target.
//
+
+ // A target can be entered for several reasons that are useful to
+ // distinguish for diagnostics, when considering as the default
+ // target, etc.
+ //
+ // Note that the order of the enumerators is arranged so that their
+ // integral values indicate whether one "overrides" the other.
+ //
+ // @@ We have cases (like pkg-config extraction) where it should probably be
+ // prereq_file rather than implied (also audit targets.insert<> calls).
+ //
+ enum class target_decl: uint8_t
+ {
+ prereq_new, // Created from prerequisite (create_new_target()).
+ prereq_file, // Created from prerequisite/file (search_existing_file ()).
+ implied, // Target-spec variable assignment, implicitly-entered, etc.
+ real // Real dependency declaration.
+ };
+
+ inline bool
+ operator> (target_decl l, target_decl r)
+ {
+ return static_cast<uint8_t> (l) > static_cast<uint8_t> (r);
+ }
+
class LIBBUILD2_SYMEXPORT target
{
public:
@@ -131,14 +156,10 @@ namespace build2
const dir_path&
out_dir () const {return out.empty () ? dir : out;}
- // A target that is not (yet) entered as part of a real dependency
- // declaration (for example, that is entered as part of a target-specific
- // variable assignment, dependency extraction, etc) is called implied.
- //
- // The implied flag should only be cleared during the load phase via the
- // MT-safe target_set::insert().
+ // Note that the declaration should only be upgraded during the load phase
+ // via the MT-safe target_set::insert().
//
- bool implied;
+ target_decl decl;
// Target group to which this target belongs, if any. Note that we assume
// that the group and all its members are in the same scope (for example,
@@ -1349,7 +1370,7 @@ namespace build2
dir_path out,
string name,
optional<string> ext,
- bool implied,
+ target_decl,
tracer&);
pair<target&, bool>
@@ -1358,7 +1379,7 @@ namespace build2
dir_path out,
string name,
optional<string> ext,
- bool implied,
+ target_decl decl,
tracer& t)
{
auto p (insert_locked (tt,
@@ -1366,7 +1387,7 @@ namespace build2
move (out),
move (name),
move (ext),
- implied,
+ decl,
t));
return pair<target&, bool> (p.first, p.second.owns_lock ());
@@ -1388,7 +1409,7 @@ namespace build2
move (out),
move (name),
move (ext),
- true,
+ target_decl::implied,
t).first.template as<T> ();
}