diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-01-05 11:55:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-01-05 11:55:15 +0200 |
commit | 9fb791e9fad6c63fc1dac49f4d05ae63b8a3db9b (patch) | |
tree | d60322d4382ca5f97b676c5abe2e39524f35eab4 /build2/cli/target.cxx | |
parent | f159b1dac68c8714f7ba71ca168e3b695891aad9 (diff) | |
download | build2-9fb791e9fad6c63fc1dac49f4d05ae63b8a3db9b.tar.gz build2-9fb791e9fad6c63fc1dac49f4d05ae63b8a3db9b.tar.xz build2-9fb791e9fad6c63fc1dac49f4d05ae63b8a3db9b.zip |
Rename build directory/namespace to build2
Diffstat (limited to 'build2/cli/target.cxx')
-rw-r--r-- | build2/cli/target.cxx | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/build2/cli/target.cxx b/build2/cli/target.cxx new file mode 100644 index 00000000..ef69e888 --- /dev/null +++ b/build2/cli/target.cxx @@ -0,0 +1,77 @@ +// file : build2/cli/target.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include <build2/cli/target> + +#include <butl/filesystem> + +using namespace std; +using namespace butl; + +namespace build2 +{ + namespace cli + { + // cli + // + constexpr const char cli_ext_var[] = "extension"; + constexpr const char cli_ext_def[] = "cli"; + + const target_type cli::static_type + { + "cli", + &file::static_type, + &target_factory<cli>, + &target_extension_var<cli_ext_var, cli_ext_def>, + &search_file, + false + }; + + // cli.cxx + // + group_view cli_cxx:: + group_members (action_type) const + { + return h != nullptr + ? group_view {m, (i != nullptr ? 3U : 2U)} + : group_view {nullptr, 0}; + } + + timestamp cli_cxx:: + load_mtime () const + { + // The rule has been matched which means the members should + // be resolved and paths assigned. + // + return file_mtime (h->path ()); + } + + static target* + cli_cxx_factory (const target_type&, 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 some of them explicitly + // as prerequisites. + // + targets.insert<cxx::hxx> (d, n, trace); + targets.insert<cxx::cxx> (d, n, trace); + targets.insert<cxx::ixx> (d, n, trace); + + return new cli_cxx (move (d), move (n), e); + } + + const target_type cli_cxx::static_type + { + "cli.cxx", + &mtime_target::static_type, + &cli_cxx_factory, + nullptr, + &search_target, + true // "See through" default iteration mode. + }; + } +} |