]> git.tdb.fi Git - builder.git/blobdiff - source/analyzer.h
Add command line options (not all of them work yet)
[builder.git] / source / analyzer.h
diff --git a/source/analyzer.h b/source/analyzer.h
new file mode 100644 (file)
index 0000000..6c7b9dc
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef ANALYZER_H_
+#define ANALYZER_H_
+
+#include <list>
+#include <string>
+#include <vector>
+
+class Builder;
+class Target;
+
+class Analyzer
+{
+public:
+       enum Mode
+       {
+               DEPS,
+               ALLDEPS,
+               REBUILD,
+               RDEPS
+       };
+
+       Analyzer(Builder &);
+       void set_mode(Mode m)          { mode=m; }
+       void set_max_depth(unsigned m) { max_depth=m; }
+       void set_full_paths(bool f)    { full_paths=f; }
+       void analyze();
+private:
+       typedef std::vector<std::string> TableRow;
+       typedef std::list<TableRow> Table;
+
+       Builder  &builder;
+       Mode     mode;
+       Table    table;
+       unsigned max_depth;
+       bool     full_paths;
+
+       void build_depend_table(Target &, unsigned);
+       void print_table() const;
+
+       static bool target_order(Target *, Target *);
+};
+
+#endif