// file : build/rule -*- C++ -*- // copyright : Copyright (c) 2014-2015 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #ifndef BUILD_RULE #define BUILD_RULE #include #include #include // reference_wrapper #include #include #include #include #include namespace build { class rule { public: virtual void* match (action, target&, const std::string& hint) const = 0; virtual recipe apply (action, target&, void*) const = 0; }; using target_rule_map = std::unordered_map< std::type_index, butl::prefix_multimap, '.'>>; using operation_rule_map = std::unordered_map; extern operation_rule_map rules; // Fallback rule that on update verifies that the path exists and is // not older than any of its prerequisites. // class path_rule: public rule { public: virtual void* match (action, target&, const std::string& hint) const; virtual recipe apply (action, target&, void*) const; static target_state perform_update (action, target&); }; class dir_rule: public rule { public: virtual void* match (action, target&, const std::string& hint) const; virtual recipe apply (action, target&, void*) const; }; class fsdir_rule: public rule { public: virtual void* match (action, target&, const std::string& hint) const; virtual recipe apply (action, target&, void*) const; static target_state perform_update (action, target&); static target_state perform_clean (action, target&); }; } #endif // BUILD_RULE