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/bin/target | 14 +++++++------- build/bin/target.cxx | 41 ++++++++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 24 deletions(-) (limited to 'build/bin') diff --git a/build/bin/target b/build/bin/target index 729f119..cbabcaf 100644 --- a/build/bin/target +++ b/build/bin/target @@ -19,8 +19,8 @@ namespace build using file::file; public: - virtual const target_type& type () const {return static_type;} static const target_type static_type; + virtual const target_type& dynamic_type () const {return static_type;} }; class objso: public file @@ -29,8 +29,8 @@ namespace build using file::file; public: - virtual const target_type& type () const {return static_type;} static const target_type static_type; + virtual const target_type& dynamic_type () const {return static_type;} }; class obj: public target @@ -42,8 +42,8 @@ namespace build objso* so {nullptr}; public: - virtual const target_type& type () const {return static_type;} static const target_type static_type; + virtual const target_type& dynamic_type () const {return static_type;} }; class exe: public file @@ -52,8 +52,8 @@ namespace build using file::file; public: - virtual const target_type& type () const {return static_type;} static const target_type static_type; + virtual const target_type& dynamic_type () const {return static_type;} }; // The lib{} target group. @@ -64,8 +64,8 @@ namespace build using file::file; public: - virtual const target_type& type () const {return static_type;} static const target_type static_type; + virtual const target_type& dynamic_type () const {return static_type;} }; class libso: public file @@ -74,8 +74,8 @@ namespace build using file::file; public: - virtual const target_type& type () const {return static_type;} static const target_type static_type; + virtual const target_type& dynamic_type () const {return static_type;} }; class lib: public target @@ -90,8 +90,8 @@ namespace build reset (action_type); public: - virtual const target_type& type () const {return static_type;} static const target_type static_type; + virtual const target_type& dynamic_type () const {return static_type;} }; } } diff --git a/build/bin/target.cxx b/build/bin/target.cxx index 5a1bb92..c2c5e05 100644 --- a/build/bin/target.cxx +++ b/build/bin/target.cxx @@ -11,10 +11,10 @@ namespace build namespace bin { static target* - obja_factory (dir_path d, std::string n, const std::string* e) + obja_factory (const target_type&, dir_path d, string n, const string* e) { obj* o (targets.find (d, n)); - obja* a (new obja (std::move (d), std::move (n), e)); + obja* a (new obja (move (d), move (n), e)); if ((a->group = o)) o->a = a; @@ -30,14 +30,15 @@ namespace build &obja_factory, nullptr, &search_target, // Note: not _file(); don't look for an existing file. - false + false, + nullptr }; static target* - objso_factory (dir_path d, std::string n, const std::string* e) + objso_factory (const target_type&, dir_path d, string n, const string* e) { obj* o (targets.find (d, n)); - objso* so (new objso (std::move (d), std::move (n), e)); + objso* so (new objso (move (d), move (n), e)); if ((so->group = o)) o->so = so; @@ -53,11 +54,12 @@ namespace build &objso_factory, nullptr, &search_target, // Note: not _file(); don't look for an existing file. - false + false, + nullptr }; static target* - obj_factory (dir_path d, string n, const string* e) + obj_factory (const target_type&, dir_path d, string n, const string* e) { obja* a (targets.find (d, n)); objso* so (targets.find (d, n)); @@ -80,7 +82,8 @@ namespace build &obj_factory, nullptr, &search_target, - false + false, + nullptr }; const target_type exe::static_type @@ -91,14 +94,15 @@ namespace build &target_factory, nullptr, &search_file, - false + false, + nullptr }; static target* - liba_factory (dir_path d, std::string n, const std::string* e) + liba_factory (const target_type&, dir_path d, string n, const string* e) { lib* l (targets.find (d, n)); - liba* a (new liba (std::move (d), std::move (n), e)); + liba* a (new liba (move (d), move (n), e)); if ((a->group = l)) l->a = a; @@ -127,14 +131,15 @@ namespace build &liba_factory, &target_extension_fix, &search_file, - false + false, + nullptr }; static target* - libso_factory (dir_path d, std::string n, const std::string* e) + libso_factory (const target_type&, dir_path d, string n, const string* e) { lib* l (targets.find (d, n)); - libso* so (new libso (std::move (d), std::move (n), e)); + libso* so (new libso (move (d), move (n), e)); if ((so->group = l)) l->so = so; @@ -151,7 +156,8 @@ namespace build &libso_factory, &target_extension_fix, &search_file, - false + false, + nullptr }; // lib @@ -164,7 +170,7 @@ namespace build } static target* - lib_factory (dir_path d, string n, const string* e) + lib_factory (const target_type&, dir_path d, string n, const string* e) { liba* a (targets.find (d, n)); libso* so (targets.find (d, n)); @@ -187,7 +193,8 @@ namespace build &lib_factory, nullptr, &search_target, - false + false, + nullptr }; } } -- cgit v1.1