From 0bd954eabb236bc9530220ffbc076967d35e33f4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 23 Feb 2015 16:09:27 +0200 Subject: Don't create new target for alias/action/dir prerequisite --- build/b.cxx | 4 ++-- build/target.cxx | 17 ++++++++++++++++- 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, - target::static_type.search + &search_alias }; } -- cgit v1.1