3 This file is part of builder
4 Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
14 #include <msp/time/timestamp.h>
21 typedef std::list<Target *> TargetList;
24 Targets make up the build graph. This class is a base for all target types and
25 handles many common tasks. Most targets are associated with a file.
30 const std::string &get_name() const { return name; }
31 Target *get_buildable_target();
32 bool get_buildable() const { return buildable; }
33 bool get_rebuild() const { return rebuild; }
34 const std::string &get_rebuild_reason() const { return rebuild_reason; }
35 const Msp::Time::TimeStamp &get_mtime() const { return mtime; }
36 virtual const char *get_type() const=0;
37 const TargetList &get_depends() const { return depends; }
38 const Package *get_package() const { return package; }
39 bool get_depends_ready() const { return deps_ready; }
40 void add_depend(Target *);
41 virtual void prepare();
44 Finds dependencies for the target. When all dependencies have been found,
45 the function should set deps_ready to true.
47 virtual void find_depends() { deps_ready=true; }
50 Creates and returns an Action suitable for building this target.
52 virtual Action *build()=0;
54 void reset_count() { counted=false; }
55 virtual unsigned count_rebuild();
60 const Package *package;
62 Msp::Time::TimeStamp mtime;
67 std::string rebuild_reason;
76 Target(Builder &, const Package *, const std::string &);
77 void mark_rebuild(const std::string &);
78 virtual void check_rebuild();
79 Action *build(Action *);
80 virtual void build_done();
83 typedef std::map<std::string, Target *> TargetMap;