]> git.tdb.fi Git - builder.git/blob - source/analyzer.h
Add comments
[builder.git] / source / analyzer.h
1 #ifndef ANALYZER_H_
2 #define ANALYZER_H_
3
4 #include <list>
5 #include <string>
6 #include <vector>
7
8 class Builder;
9 class Target;
10
11 /**
12 Performs various kinds of dependency analysis on the build tree.
13 */
14 class Analyzer
15 {
16 public:
17         enum Mode
18         {
19                 DEPS,     /// Skip over "trivial" targets such as Install and Compile
20                 ALLDEPS,  /// Print out absolutely every target
21                 REBUILD,  /// Print targets that are going to be rebuilt
22                 RDEPS     /// Print targets that depend on the given targets (NYI)
23         };
24
25         Analyzer(Builder &);
26         void set_mode(Mode m)          { mode=m; }
27         void set_max_depth(unsigned m) { max_depth=m; }
28         void set_full_paths(bool f)    { full_paths=f; }
29         void analyze();
30 private:
31         typedef std::vector<std::string> TableRow;
32         typedef std::list<TableRow> Table;
33
34         Builder  &builder;
35         Mode     mode;
36         Table    table;
37         unsigned max_depth;
38         bool     full_paths;
39
40         void build_depend_table(Target &, unsigned);
41         void print_table() const;
42
43         static bool target_order(Target *, Target *);
44 };
45
46 #endif