aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/parser.cxx7
-rw-r--r--build2/target.cxx4
-rw-r--r--build2/target.hxx5
3 files changed, 12 insertions, 4 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx
index 25742d0..e10d940 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -3214,14 +3214,19 @@ namespace build2
}
}
+ bool de (false); // Default extension.
if ((n.pair & 0x01) != 0)
+ {
+ de = static_cast<bool> (e);
tt->pattern (*tt, *scope_, v, e, true);
+ de = de && !e;
+ }
if (dir)
n.dir = dir_path (move (v));
else
{
- target::combine_name (v, e);
+ target::combine_name (v, e, de);
n.value = move (v);
}
diff --git a/build2/target.cxx b/build2/target.cxx
index ebc21db..b3f0fdc 100644
--- a/build2/target.cxx
+++ b/build2/target.cxx
@@ -240,7 +240,7 @@ namespace build2
}
void target::
- combine_name (string& v, const optional<string>& e)
+ combine_name (string& v, const optional<string>& e, bool de)
{
if (v.back () == '.')
{
@@ -258,7 +258,7 @@ namespace build2
v += '.';
v += *e; // Empty or not.
}
- else
+ else if (de)
{
if (path::traits::find_extension (v) != string::npos)
v += "...";
diff --git a/build2/target.hxx b/build2/target.hxx
index 127940a..8014d42 100644
--- a/build2/target.hxx
+++ b/build2/target.hxx
@@ -656,8 +656,11 @@ namespace build2
// Combine the target name and extension into the name leaf.
//
+ // If the target type has the default extension, then "escape" the
+ // existing extension if any.
+ //
static void
- combine_name (string&, const optional<string>&);
+ combine_name (string&, const optional<string>&, bool default_extension);
public:
virtual