]> git.tdb.fi Git - builder.git/blob - source/objectfile.h
Rewrite ObjectFile dependency finding so it doesn't depend on includes
[builder.git] / source / objectfile.h
1 #ifndef OBJECTFILE_H_
2 #define OBJECTFILE_H_
3
4 #include "filetarget.h"
5
6 class Component;
7 class SourceFile;
8
9 /**
10 Object files are compiled from source files.
11 */
12 class ObjectFile: public FileTarget
13 {
14 private:
15         const Component ∁
16         SourceFile &source;
17         Dependencies new_deps;
18         
19 public:
20         ObjectFile(Builder &, const Component &, SourceFile &);
21         virtual const char *get_type() const { return "ObjectFile"; }
22         const Component &get_component() const { return comp; }
23         SourceFile &get_source() const { return source; }
24
25         /** Processes as many new dependences as possible.  Some may be created on
26         the fly and can't be processed until their own dependencies are ready.  In
27         such cases this function needs to be called again. */
28         virtual void find_depends();
29
30 private:
31         /** Recursively looks for header targets and adds them as dependencies. */
32         void find_depends(FileTarget *);
33
34         /** Adds a target to the dependency list as well as the new dependencies
35         list. */
36         void add_depend(Target *);
37
38         static Msp::FS::Path generate_target_path(const Component &, const std::string &);
39 };
40
41 #endif