#ifndef OBJECTFILE_H_
#define OBJECTFILE_H_
-#include "target.h"
+#include "filetarget.h"
class Component;
class SourceFile;
-class ObjectFile: public Target
+/**
+Object files are compiled from source files.
+*/
+class ObjectFile: public FileTarget
{
-public:
- ObjectFile(Builder &, const Component &, SourceFile &);
- const char *get_type() const { return "ObjectFile"; }
- const Component &get_component() const { return comp; }
- void find_depends();
- Action *build();
private:
const Component ∁
- TargetList new_deps;
+ SourceFile &source;
- void find_depends(Target *);
- void add_depend(Target *);
+public:
+ ObjectFile(Builder &, const Component &, SourceFile &);
+private:
+ static Msp::FS::Path generate_target_path(const Component &, const std::string &);
- static std::string generate_target_name(const Component &, const std::string &);
+public:
+ virtual const char *get_type() const { return "ObjectFile"; }
+ const Component &get_component() const { return comp; }
+ SourceFile &get_source() const { return source; }
+
+ /** Processes as many new dependences as possible. Some may be created on
+ the fly and can't be processed until their own dependencies are ready. In
+ such cases this function needs to be called again. */
+ virtual void find_depends();
+
+private:
+ /** Recursively looks for header targets and adds them as dependencies. */
+ void find_depends(FileTarget *);
};
#endif