From a89f1e4f4efd291beedea03c65c8185b7d0df20e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 7 Dec 2017 12:06:59 +0200 Subject: Distinguish between "fixed" and "default" target extensions This fixes wrong merging of, say, file{README} and file{README.MySQL} (in libmysqlclient). --- build2/cc/target.cxx | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'build2/cc/target.cxx') diff --git a/build2/cc/target.cxx b/build2/cc/target.cxx index 6f8d541..38236a0 100644 --- a/build2/cc/target.cxx +++ b/build2/cc/target.cxx @@ -2,6 +2,8 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + #include using namespace std; @@ -18,33 +20,36 @@ namespace build2 nullptr, nullptr, nullptr, + nullptr, &target_search, false }; - extern const char ext_var[] = "extension"; // VC14 rejects constexpr. - extern const char h_ext_def[] = "h"; + const target_type h::static_type { "h", &file::static_type, &target_factory, - &target_extension_var, - &target_pattern_var, + nullptr, /* fixed_extension */ + &target_extension_var, + &target_pattern_var, nullptr, &file_search, false }; extern const char c_ext_def[] = "c"; + const target_type c::static_type { "c", &cc::static_type, &target_factory, - &target_extension_var, - &target_pattern_var, + nullptr, /* fixed_extension */ + &target_extension_var, + &target_pattern_var, nullptr, &file_search, false @@ -58,6 +63,7 @@ namespace build2 nullptr, nullptr, nullptr, + nullptr, &target_search, false }; @@ -68,8 +74,9 @@ namespace build2 { "pca", &pc::static_type, - &file_factory, + &target_factory, &target_extension_fix, + nullptr, /* default_extension */ &target_pattern_fix, &target_print_0_ext_verb, // Fixed extension, no use printing. &file_search, @@ -82,8 +89,9 @@ namespace build2 { "pcs", &pc::static_type, - &file_factory, + &target_factory, &target_extension_fix, + nullptr, /* default_extension */ &target_pattern_fix, &target_print_0_ext_verb, // Fixed extension, no use printing. &file_search, -- cgit v1.1