From acdcc228c252e2a0a90a8586c5b5c6984332635b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 26 Jul 2018 09:30:11 +0200 Subject: Pass extension supplied by rule to target type default extension function Also revert the precedence back to target type over rule. But now the target type is able to customize this logic (see exe{} for a use case). --- build2/target-type.hxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'build2/target-type.hxx') diff --git a/build2/target-type.hxx b/build2/target-type.hxx index ebe60db..408a520 100644 --- a/build2/target-type.hxx +++ b/build2/target-type.hxx @@ -34,12 +34,14 @@ namespace build2 // returns NULL, then it means the default extension for this target could // not be derived. // - // The default extension is used in two (key; there are others) places: + // The default extension is used in two key (there are others) places: // search_existing_file() (called for a prerequisite with the last argument // true) and in target::derive_extension() (called for a target with the // last argument false); see their respective implementations for details. - // Note that the default extension supplied to derive_extension() (e.g., by - // a rule) takes precedence over the one returned by default_extension. + // The third argument is the default extension that is supplied (e.g., by a + // rule) to derive_extension(), if any. The implementation can decide which + // takes precedence, etc (see the exe{} target type for some interesting + // logic). // // If the pattern function is not NULL, then it is used to amend a pattern // or match (reverse is false) and then, if the amendment call returned @@ -55,6 +57,7 @@ namespace build2 const char* (*fixed_extension) (const target_key&); optional (*default_extension) (const target_key&, const scope&, + const char*, bool search); bool (*pattern) (const target_type&, const scope&, string&, bool reverse); -- cgit v1.1