From 7996c2bfc2d7e998e2f9f1236d457ec7bea8ad8a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 1 Dec 2015 13:39:09 +0200 Subject: Implement support for definition target type aliases For example: define cli=file Currently, the semantics is that of a real alias with only name differences that are used for display. See tests/define/buildfile for more use cases. --- build/target.cxx | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'build/target.cxx') diff --git a/build/target.cxx b/build/target.cxx index 22c9ad4..649e570 100644 --- a/build/target.cxx +++ b/build/target.cxx @@ -286,7 +286,7 @@ namespace build if (r) { - unique_ptr pt (tt.factory (move (dir), move (name), ext)); + unique_ptr pt (tt.factory (tt, move (dir), move (name), ext)); i = map_.emplace ( make_pair (target_key {&tt, &pt->dir, &pt->name, &pt->ext}, move (pt))).first; @@ -446,7 +446,8 @@ namespace build nullptr, nullptr, &search_target, - false + false, + nullptr }; const target_type mtime_target::static_type @@ -457,7 +458,8 @@ namespace build nullptr, nullptr, &search_target, - false + false, + nullptr }; const target_type path_target::static_type @@ -468,12 +470,13 @@ namespace build nullptr, nullptr, &search_target, - false + false, + nullptr }; template static target* - file_factory (dir_path d, string n, const string* e) + file_factory (const target_type&, dir_path d, string n, const string* e) { // The file target type doesn't imply any extension. So if one // wasn't specified, set it to empty rather than unspecified. @@ -493,7 +496,8 @@ namespace build &file_factory, &target_extension_fix, &search_file, - false + false, + nullptr }; const target_type alias::static_type @@ -504,7 +508,8 @@ namespace build &target_factory, nullptr, // Should never need. &search_alias, - false + false, + nullptr }; const target_type dir::static_type @@ -515,7 +520,8 @@ namespace build &target_factory, nullptr, // Should never need. &search_alias, - false + false, + nullptr }; const target_type fsdir::static_type @@ -526,7 +532,8 @@ namespace build &target_factory, nullptr, // Should never need. &search_target, - false + false, + nullptr }; static const std::string& @@ -546,7 +553,8 @@ namespace build &file_factory, &buildfile_target_extension, &search_file, - false + false, + nullptr }; constexpr const char doc_ext[] = ""; @@ -558,11 +566,12 @@ namespace build &file_factory, &target_extension_fix, &search_file, - false + false, + nullptr }; static target* - man_factory (dir_path d, string n, const string* e) + man_factory (const target_type&, dir_path d, string n, const string* e) { if (e == nullptr) fail << "man target '" << n << "' must include extension (man section)"; @@ -578,7 +587,8 @@ namespace build &man_factory, nullptr, // Should be specified explicitly. &search_file, - false + false, + nullptr }; constexpr const char man1_ext[] = "1"; @@ -590,6 +600,7 @@ namespace build &file_factory, &target_extension_fix, &search_file, - false + false, + nullptr }; } -- cgit v1.1