]> git.tdb.fi Git - builder.git/blob - source/target.h
371445bc5007ebc4e7c3d4af6c525c7c79bd2231
[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         const Msp::Time::TimeStamp &get_virtual_mtime() const { return vmtime; }
21         virtual const char *get_type() const=0;
22         const std::list<Target *> &get_depends() const { return depends; }
23         void   add_depend(Target *);
24         virtual void find_depends()=0;
25         virtual void prepare();
26         virtual Action *build()=0;
27         virtual ~Target() { }
28 protected:
29         Builder     &builder;
30         const Package *package;
31         std::string name;
32         bool        building;
33         bool        rebuild;
34         std::string rebuild_reason;
35         Msp::Time::TimeStamp mtime;
36         Msp::Time::TimeStamp vmtime;
37         std::list<Target *> depends;
38         std::list<Target *> rdepends;
39         bool        prepared;
40         bool        buildable;
41
42         Target(Builder &, const Package *, const std::string &);
43         void mark_rebuild(const std::string &);
44         virtual void check_rebuild();
45         Action *build(Action *);
46         virtual void build_done();
47 };
48
49 #endif