aboutsummaryrefslogtreecommitdiff
path: root/build/algorithm
blob: fa74769b0e206963dfe72ee0484dba844a01d9a6 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// file      : build/algorithm -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
// license   : MIT; see accompanying LICENSE file

#ifndef BUILD_ALGORITHM
#define BUILD_ALGORITHM

#include <build/target>
#include <build/operation>
#include <build/timestamp>

namespace build
{
  class prerequisite;

  // The default prerequsite search implementation. It first calls the
  // target-type-specific search function. If that doesn't yeld anything,
  // it creates a new target.
  //
  target&
  search (prerequisite&);

  // Match a rule to the action/target with ambiguity detection.
  //
  void
  match (action, target&);

  // The default prerequisite search and match implementation. It calls
  // search() and then match() for each prerequisite in a loop.
  //
  void
  search_and_match (action, target&);

  // As above but ignores (does not match) prerequsites that are not
  // in the same or a subdirectory of dir.
  //
  void
  search_and_match (action, target&, const path& dir);

  // Execute the action on target, assuming a rule has been matched
  // and the recipe for this action has been set.
  //
  target_state
  execute (action, target&);

  // The default prerequisite execute implementation. It calls execute()
  // on each non-ignored (non-NULL target) prerequisite in a loop.
  // Returns target_state::changed if any of them were changed and
  // target_state::unchanged otherwise. It treats targets with postponed
  // execution the same as ignored. Note that this function can be
  // used as a recipe.
  //
  target_state
  execute_prerequisites (action, target&);

  // A version of the above that also determines whether the action
  // needs to be executed on the target based on the passed timestamp.
  //
  bool
  execute_prerequisites (action, target&, const timestamp&);

  // Another version of the above that does two extra things for the
  // caller: it determines whether the action needs to be executed on
  // the target based on the passed timestamp and, if so, finds a
  // prerequisite of the specified type (e.g., a source file).
  //
  template <typename T>
  T*
  execute_prerequisites (action, target&, const timestamp&);

  // Standard perform(clean) action implementation for the file target
  // or derived.
  //
  target_state
  perform_clean_file (action, target&);
}

#include <build/algorithm.ixx>
#include <build/algorithm.txx>

#endif // BUILD_ALGORITHM