aboutsummaryrefslogtreecommitdiff
path: root/build2/target-type.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-12-07 12:06:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-12-07 12:06:59 +0200
commita89f1e4f4efd291beedea03c65c8185b7d0df20e (patch)
treed06b2cb81720ae0c6cc877c2c67201838a10b63a /build2/target-type.hxx
parentc2da5df68610a0070575212bfee67c730ab39128 (diff)
Distinguish between "fixed" and "default" target extensions
This fixes wrong merging of, say, file{README} and file{README.MySQL} (in libmysqlclient).
Diffstat (limited to 'build2/target-type.hxx')
-rw-r--r--build2/target-type.hxx28
1 files changed, 13 insertions, 15 deletions
diff --git a/build2/target-type.hxx b/build2/target-type.hxx
index 0b8ee54..16513d4 100644
--- a/build2/target-type.hxx
+++ b/build2/target-type.hxx
@@ -23,13 +23,16 @@ namespace build2
// any target type. As a result, we can use address comparison to determine
// if two target types are the same.
//
- // If the extension derivation function is NULL, then it means this target
+ // If the extension derivation functions are NULL, then it means this target
// type does not use extensions. Note that this is relied upon when deciding
// whether to print the extension; if the target does use extensions but the
- // defaults could not (and its ok), could not (and its not ok), or should not
+ // defaults couldn't (and its ok), couldn't (and its not ok), or shouldn't
// (logically) be obtained, then use target_extension_{null,fail,assert}(),
- // respectively. If the extension function returns NULL, then that means the
- // default extension for this target could not be derived.
+ // respectively. The fixed extension function should return the fixed
+ // extension (which can point to the key's ext member if the explicit
+ // extension specificaton is allowed). If the default extension function
+ // returns NULL, then it means the default extension for this target could
+ // not be derived.
//
// The extension is used in two places: search_existing_file() (called for a
// prerequisite with the last argument true) and in target::derive_path()
@@ -45,17 +48,12 @@ namespace build2
const char* name;
const target_type* base;
- // Return target and extension.
- //
- pair<target*, optional<string>> (*factory) (const target_type&,
- dir_path,
- dir_path,
- string,
- optional<string>);
-
- optional<string> (*extension) (const target_key&,
- const scope&,
- bool search);
+ target* (*factory) (const target_type&, dir_path, dir_path, string);
+
+ const char* (*fixed_extension) (const target_key&);
+ optional<string> (*default_extension) (const target_key&,
+ const scope&,
+ bool search);
bool (*pattern) (const target_type&, const scope&, string&, bool reverse);