From d236d61ee9821abc4e8d3e3928ac2dfa9cb57d98 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 2 Jul 2015 07:08:57 +0200 Subject: Make few existing file searching optimizations --- build/bin/target.cxx | 4 ++-- build/cli/target.cxx | 19 ++++++++++++++++++- tests/cli/simple/buildfile | 7 +++++-- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/build/bin/target.cxx b/build/bin/target.cxx index 1190bfc..9dbcd83 100644 --- a/build/bin/target.cxx +++ b/build/bin/target.cxx @@ -29,7 +29,7 @@ namespace build &file::static_type, &obja_factory, nullptr, - &search_file, + &search_target, // Note: not _file(); don't look for an existing file. false }; @@ -52,7 +52,7 @@ namespace build &file::static_type, &objso_factory, nullptr, - &search_file, + &search_target, // Note: not _file(); don't look for an existing file. false }; diff --git a/build/cli/target.cxx b/build/cli/target.cxx index 95198e1..b77252d 100644 --- a/build/cli/target.cxx +++ b/build/cli/target.cxx @@ -46,12 +46,29 @@ namespace build return file_mtime (h->path ()); } + static target* + cli_cxx_factory (dir_path d, string n, const string* e) + { + tracer trace ("cli::cli_cxx::factory"); + + // Pre-enter (potential) members as targets. The main purpose + // of doing this is to avoid searching for existing files in + // src_base if the buildfile mentions one of them explicitly + // as a prerequisite. + // + targets.insert (d, n, trace); + targets.insert (d, n, trace); + targets.insert (d, n, trace); + + return new cli_cxx (move (d), move (n), e); + } + const target_type cli_cxx::static_type { typeid (cli_cxx), "cli.cxx", &mtime_target::static_type, - &target_factory, + &cli_cxx_factory, nullptr, &search_target, true // See through default semantics. diff --git a/tests/cli/simple/buildfile b/tests/cli/simple/buildfile index 5a940ce..a7e6e80 100644 --- a/tests/cli/simple/buildfile +++ b/tests/cli/simple/buildfile @@ -4,5 +4,8 @@ ixx.ext = ipp cxx.poptions = -I$out_root -exe{driver}: cxx{driver} cxx{test} -cxx{test} hxx{test}: cli{test} +#exe{driver}: cxx{driver} cxx{test} +#cxx{test} hxx{test}: cli{test} + +exe{driver}: cxx{driver} cli.cxx{test} +cli.cxx{test}: cli{test} -- cgit v1.1