]> git.tdb.fi Git - builder.git/blob - source/target.h
Add command line options (not all of them work yet)
[builder.git] / source / target.h
1 #ifndef TARGET_H_
2 #define TARGET_H_
3
4 #include <list>
5 #include <string>
6 #include <msp/time/timestamp.h>
7
8 class Action;
9 class Builder;
10 class Package;
11
12 class Target
13 {
14 public:
15         const std::string &get_name() const            { return name; }
16         Target            *get_buildable_target();
17         bool              get_rebuild() const          { return rebuild; }
18         const std::string &get_rebuild_reason() const  { return rebuild_reason; }
19         const Msp::Time::TimeStamp &get_mtime() const  { return mtime; }
20         virtual const char *get_type() const=0;
21         const std::list<Target *> &get_depends() const { return depends; }
22         const Package     *get_package() const         { return package; }
23         void              add_depend(Target *);
24         virtual void      find_depends()=0;
25         virtual void      prepare();
26         virtual Action    *build()=0;
27         void              reset_count()                { counted=false; }
28         unsigned          count_rebuild();
29         void              touch();
30         virtual ~Target() { }
31 protected:
32         Builder     &builder;
33         const Package *package;
34         std::string name;
35         bool        building;
36         bool        rebuild;
37         std::string rebuild_reason;
38         Msp::Time::TimeStamp mtime;
39         std::list<Target *> depends;
40         std::list<Target *> rdepends;
41         bool        prepared;
42         bool        buildable;
43         bool        counted;
44
45         Target(Builder &, const Package *, const std::string &);
46         void mark_rebuild(const std::string &);
47         virtual void check_rebuild();
48         Action *build(Action *);
49         virtual void build_done();
50 };
51
52 #endif