aboutsummaryrefslogtreecommitdiff
path: root/build/rule-map
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-01 14:46:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-01 14:46:45 +0200
commit10fd2aface4486fc7f873dd2b54a1c2073c0b434 (patch)
tree5133810cf33b3e4ba4dfe78f659ee65599c31ffd /build/rule-map
parent7996c2bfc2d7e998e2f9f1236d457ec7bea8ad8a (diff)
Reimplement define as dynamic derivation rather than alias
New syntax: define cli: file The rationale is we need to be able to assign the file extension (using type/pattern-specific variables). And if it is an alias, we will assign it to the original target type. Note that we could still support aliases if we need to. Will need to bring back the id member in target_type that would normally point to itself but for an alias would point to the origin.
Diffstat (limited to 'build/rule-map')
-rw-r--r--build/rule-map5
1 files changed, 2 insertions, 3 deletions
diff --git a/build/rule-map b/build/rule-map
index 0ce49e7..d262ecd 100644
--- a/build/rule-map
+++ b/build/rule-map
@@ -9,7 +9,6 @@
#include <vector>
#include <string>
#include <memory> // unique_ptr
-#include <typeindex>
#include <functional> // reference_wrapper
#include <butl/prefix-map>
@@ -22,7 +21,7 @@ namespace build
class rule;
using target_type_rule_map = std::map<
- std::type_index, // Target type.
+ const target_type*,
butl::prefix_map<std::string, // Rule hint.
std::reference_wrapper<rule>, '.'>>;
@@ -41,7 +40,7 @@ namespace build
if (oid >= map_.size ())
map_.resize ((oid < 3 ? 3 : oid) + 1);
- map_[oid][typeid (T)].emplace (hint, r);
+ map_[oid][&T::static_type].emplace (hint, r);
}
// Return NULL if not found.