diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-01-27 13:59:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-01-27 13:59:51 +0200 |
commit | a5949f9e974171144dba84771a9f305f9e1dcc3f (patch) | |
tree | 1e70c60d0c9daf4065e1163426c65b512d70c0c6 /build2/target | |
parent | bb171dd3fa145b15a6defd122b15be6822806e2b (diff) |
Rework default extension derivation, again
Diffstat (limited to 'build2/target')
-rw-r--r-- | build2/target | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/build2/target b/build2/target index e6ebc42..b35efdf 100644 --- a/build2/target +++ b/build2/target @@ -879,18 +879,19 @@ namespace build2 void path (path_type p) {assert (path_.empty ()); path_ = std::move (p);} - // Derive a path from target's dir, name, and, if specified, ext. - // If ext is not specified, then use default_ext and also update - // the target's extension (this becomes important if later we need - // to reliably determine whether this file has an extension; think - // hxx{foo.bar.} and hxx.ext is empty). + // Derive a path from target's dir, name, and, if set, ext. If ext is not + // set, try to derive it using the target type extension function and + // fallback to default_ext, if specified. In both cases also update the + // target's extension (this becomes important if later we need to reliably + // determine whether this file has an extension; think hxx{foo.bar.} and + // hxx{*}:extension is empty). // - // If name_prefix is not NULL, add it before the name part and after - // the directory. Similarly, if name_suffix is not NULL, add it after - // the name part and before the extension. + // If name_prefix is not NULL, add it before the name part and after the + // directory. Similarly, if name_suffix is not NULL, add it after the name + // part and before the extension. // - // Finally, if the path was already assigned to this target, then - // this function verifies that the two are the same. + // Finally, if the path was already assigned to this target, then this + // function verifies that the two are the same. // void derive_path (const char* default_ext = nullptr, @@ -1058,24 +1059,29 @@ namespace build2 // Return fixed target extension. // template <const char* ext> - const std::string& + const std::string* target_extension_fix (const target_key&, scope&); - // Get the extension from the variable or use the default if none set. - // Issue diagnostics and fail if the default is NULL. + // Get the extension from the variable or use the default if none set. If + // the default is NULL, then return NULL. // template <const char* var, const char* def> - const std::string& + const std::string* target_extension_var (const target_key&, scope&); + // Always return NULL extension. + // + const std::string* + target_extension_null (const target_key&, scope&); + // Issue diagnostics and fail if called. // - const std::string& + const std::string* target_extension_fail (const target_key&, scope&); // Assert if called. // - const std::string& + const std::string* target_extension_assert (const target_key&, scope&); // Target print functions. |