X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftool.h;h=7371103213b91f56483f630da8cada940d3fda66;hb=f75a99316e896cf1e424a489ce360a67844d86b0;hp=c302f3cffb432949706d4967a3ec18344e273738;hpb=e09cea0ffcef4ab5ea35c47c5b34237c44d0741f;p=builder.git diff --git a/source/tool.h b/source/tool.h index c302f3c..7371103 100644 --- a/source/tool.h +++ b/source/tool.h @@ -7,9 +7,14 @@ class Builder; class Component; +class FileTarget; class Target; class Task; +/** +Base class for tools. Tools are used to turn targets into other targets. +Examples include compilers and linkers. +*/ class Tool { public: @@ -19,6 +24,7 @@ public: protected: Builder &builder; std::string tag; + FileTarget *executable; SuffixList input_suffixes; SuffixList aux_suffixes; SearchPath system_path; @@ -28,6 +34,8 @@ public: virtual ~Tool() { } const std::string &get_tag() const { return tag; } + // XXX The executable target should be retrieved when first needed + FileTarget *get_executable() const { return executable; } const SuffixList &get_input_suffixes() const { return input_suffixes; } const SuffixList &get_auxiliary_suffixes() const { return aux_suffixes; } bool accepts_suffix(const std::string &, bool = false) const; @@ -40,4 +48,17 @@ public: virtual Task *run(const Target &) const = 0; }; +/** +Intermediate base class for tool facets. For example, a linker may need to +use different commands depending on whether C++ source files are present or +not, but their presence can't be directly determined from the object files. +*/ +class SubTool: public Tool +{ +protected: + Tool &parent; + + SubTool(Tool &); +}; + #endif