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