]> git.tdb.fi Git - builder.git/blob - source/target.h
Process ObjectFile dependencies correctly even when it's processed before some header...
[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         bool              get_depends_ready() const       { return deps_ready; }
24         void              add_depend(Target *);
25         virtual void      find_depends()               { deps_ready=true; }
26         virtual void      prepare();
27         virtual Action    *build()=0;
28         void              reset_count()                { counted=false; }
29         unsigned          count_rebuild();
30         void              touch();
31         virtual ~Target() { }
32 protected:
33         Builder     &builder;
34         const Package *package;
35         std::string name;
36         bool        building;
37         bool        rebuild;
38         std::string rebuild_reason;
39         Msp::Time::TimeStamp mtime;
40         std::list<Target *> depends;
41         std::list<Target *> rdepends;
42         bool        deps_ready;
43         bool        prepared;
44         bool        buildable;
45         bool        counted;
46
47         Target(Builder &, const Package *, const std::string &);
48         void mark_rebuild(const std::string &);
49         virtual void check_rebuild();
50         Action *build(Action *);
51         virtual void build_done();
52 };
53
54 #endif