aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-12-03 13:47:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-12-03 16:48:07 +0200
commitb259a318223370881d5244cc38ff8a7be58e2a3e (patch)
treea65909217d5d91e31ebe891c0278546cb58ea36d /libbuild2/target.hxx
parent68a27c5bca208337f5749fe1959ac21c062b77fb (diff)
Reimplement search_existing() functions via target_type::search
This allows us to automatically get the target type-specific behavior with regards to the out_only semantics (added in the previous commit) instead of passing it explicitly from each call site.
Diffstat (limited to 'libbuild2/target.hxx')
-rw-r--r--libbuild2/target.hxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index 5283ab8..e3152ac 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -2619,7 +2619,7 @@ namespace build2
string&, optional<string>&, const location&,
bool);
- // Target print functions.
+ // Target print functions (target_type::print).
//
// Target type uses the extension but it is fixed and there is no use
@@ -2634,17 +2634,24 @@ namespace build2
LIBBUILD2_SYMEXPORT bool
target_print_1_ext_verb (ostream&, const target_key&, bool);
+ // Target search functions (target_type::search).
+ //
+
// The default behavior, that is, look for an existing target in the
// prerequisite's directory scope.
//
+ // Note that this implementation assumes a target can only be found in the
+ // out tree (targets that can be in the src tree would normally use
+ // file_search() below).
+ //
LIBBUILD2_SYMEXPORT const target*
- target_search (const target&, const prerequisite_key&);
+ target_search (context&, const target*, const prerequisite_key&);
- // First look for an existing target as above. If not found, then look
- // for an existing file in the target-type-specific list of paths.
+ // First look for an existing target both in out and src. If not found, then
+ // look for an existing file in src.
//
LIBBUILD2_SYMEXPORT const target*
- file_search (const target&, const prerequisite_key&);
+ file_search (context&, const target*, const prerequisite_key&);
}
#include <libbuild2/target.ixx>