aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-24 11:35:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-24 11:35:25 +0200
commit88678551f1e9871def5a8eaae017fd8c464203b8 (patch)
treea2dac3c4d5b82202876452a555768d41ab05cc15
parent60c2438c4aec9b4bf1c64878534e83152ab7a88e (diff)
Make exe{} target default to no extension rather than fail
This just keep breaking (this time for exe{}: in{} match during distribution). So we assume rules will assign the target platform extension if necessary and if not, then we default to no extension (e.g., a shell script).
-rw-r--r--build2/in/rule.cxx5
-rw-r--r--build2/target.cxx18
2 files changed, 10 insertions, 13 deletions
diff --git a/build2/in/rule.cxx b/build2/in/rule.cxx
index 41f2f71..5ec95f3 100644
--- a/build2/in/rule.cxx
+++ b/build2/in/rule.cxx
@@ -55,10 +55,7 @@ namespace build2
// Derive the file name.
//
- // If this is an executable with an unspecified extension, then default
- // to no extension (i.e., a shell script).
- //
- t.derive_path (t.is_a<exe> () ? "" : nullptr);
+ t.derive_path ();
// Inject dependency on the output directory.
//
diff --git a/build2/target.cxx b/build2/target.cxx
index f2e3462..9c11156 100644
--- a/build2/target.cxx
+++ b/build2/target.cxx
@@ -845,19 +845,19 @@ namespace build2
static optional<string>
exe_target_extension (const target_key&, const scope&, bool search)
{
- // If we are searching for an executable that is not a target, then
- // use the build machine executable extension. Otherwise, if this is
- // a target, then we expect the rule to use target machine extension.
+ // If we are searching for an executable that is not a target, then use
+ // the build machine executable extension. Otherwise, if this is a target,
+ // then we expect the rule to supply the target machine extension. But if
+ // it doesn't, then assume no extension (e.g., a script).
//
- return search
- ? optional<string> (
+ return string (search
+ ?
#ifdef _WIN32
- "exe"
+ "exe"
#else
- ""
+ ""
#endif
- )
- : nullopt;
+ : "");
}
#ifdef _WIN32