diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-05-22 15:23:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-05-22 15:23:54 +0200 |
commit | 2b0b06cbf4288746075a74c12ef233efc929a095 (patch) | |
tree | 6fec848d888a56f718c2eaa13fba0b8a93a00d40 /build/target | |
parent | e7688fc3efaa79b3236b9a3775ef1a0ffaeed1b1 (diff) |
Avoid relying on static initialization order
Diffstat (limited to 'build/target')
-rw-r--r-- | build/target | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/build/target b/build/target index d7bdd04..1770d9c 100644 --- a/build/target +++ b/build/target @@ -466,13 +466,6 @@ namespace build extern target_type_map target_types; - template <typename T> - target* - target_factory (dir_path d, std::string n, const std::string* e) - { - return new T (std::move (d), std::move (n), e); - } - // Modification time-based target. // class mtime_target: public target @@ -582,6 +575,28 @@ namespace build virtual const target_type& type () const {return static_type;} static const target_type static_type; }; + + // Common implementation of the target factory and search functions. + // + template <typename T> + target* + target_factory (dir_path d, std::string n, const std::string* e) + { + return new T (std::move (d), std::move (n), e); + } + + // The default behavior, that is, look for an existing target in the + // prerequisite's directory scope. + // + target* + search_target (const prerequisite_key&); + + // First lookfor an existing target as above. If not found, then look + // for an existing file in the target-type-specific list of paths. + // + target* + search_file (const prerequisite_key&); + } #include <build/target.ixx> |