aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-02-23 16:09:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-02-23 16:09:27 +0200
commit0bd954eabb236bc9530220ffbc076967d35e33f4 (patch)
tree320072dadaa23ffc378e0e1a5ec99ae406e48f55 /build
parentfefe0657f29b8db782f7a722dd46b074b991cf08 (diff)
Don't create new target for alias/action/dir prerequisite
Diffstat (limited to 'build')
-rw-r--r--build/b.cxx4
-rw-r--r--build/target.cxx17
2 files changed, 18 insertions, 3 deletions
diff --git a/build/b.cxx b/build/b.cxx
index a71a866..1edce6b 100644
--- a/build/b.cxx
+++ b/build/b.cxx
@@ -182,10 +182,10 @@ main (int argc, char* argv[])
rules[typeid (obj)].emplace ("cxx.gnu.compile", cxx_compile);
dir_rule dir_r;
- rules[typeid (dir)].emplace ("", dir_r);
+ rules[typeid (dir)].emplace ("dir", dir_r);
path_rule path_r;
- rules[typeid (path_target)].emplace ("", path_r);
+ rules[typeid (path_target)].emplace ("path", path_r);
// Build.
//
diff --git a/build/target.cxx b/build/target.cxx
index 197770c..50a7cc6 100644
--- a/build/target.cxx
+++ b/build/target.cxx
@@ -150,6 +150,21 @@ namespace build
return nullptr;
}
+ // dir target
+ //
+ static target*
+ search_alias (prerequisite& p)
+ {
+ // For an alias/action we don't want to silently create a target
+ // since it will do nothing and it most likely not what the author
+ // intended.
+ //
+ if (target* t = search_existing_target (p))
+ return t;
+
+ fail << "no explicit target for prerequisite " << p;
+ }
+
// type info
//
@@ -195,6 +210,6 @@ namespace build
"dir",
&target::static_type,
&target_factory<dir>,
- target::static_type.search
+ &search_alias
};
}