aboutsummaryrefslogtreecommitdiff
path: root/build/dist/rule.cxx
blob: b5e118540eb51a5893a592a01976a0ad29b97407 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// file      : build/dist/rule.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#include <build/dist/rule>

#include <build/scope>
#include <build/target>
#include <build/algorithm>
#include <build/diagnostics>

using namespace std;

namespace build
{
  namespace dist
  {
    match_result rule::
    match (action, target& t, const std::string&) const
    {
      return t; // We always match.
    }

    recipe rule::
    apply (action a, target& t, const match_result&) const
    {
      const dir_path& out_root (t.root_scope ().out_path ());

      for (prerequisite_member p: group_prerequisite_members (a, t))
      {
        // Skip prerequisites imported from other projects.
        //
        if (p.proj () != nullptr)
          continue;

        target& pt (p.search ());

        // Don't match targets that are outside of our project.
        //
        if (pt.dir.sub (out_root))
          build::match (a, pt);
      }

      return noop_recipe; // We will never be executed.
    }
  }
}