From 2b0b06cbf4288746075a74c12ef233efc929a095 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 May 2015 15:23:54 +0200 Subject: Avoid relying on static initialization order --- build/target | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'build/target') 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 - 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 + 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 -- cgit v1.1