--- /dev/null
+#include "builder.h"
+#include "customizedtool.h"
+#include "target.h"
+
+using namespace std;
+using namespace Msp;
+
+CustomizedTool::CustomizedTool(Builder &b, const std::string &t, const Architecture &a):
+ CustomizedTool(b.get_toolchain().get_tool(t), a)
+{ }
+
+CustomizedTool::CustomizedTool(Tool &t, const Architecture &a):
+ Tool(t.get_builder(), &a, t.get_tag()),
+ parent(t)
+{
+ input_suffixes = parent.get_input_suffixes();
+ aux_suffixes = parent.get_auxiliary_suffixes();
+ processing_unit = parent.get_processing_unit();
+
+ set_run([this](const Target &t){ return parent.run(t); });
+}
+
+Target *CustomizedTool::create_source(const Component &c, const FS::Path &p) const
+{
+ return parent.create_source(c, p);
+}
+
+Target *CustomizedTool::create_source(const FS::Path &p) const
+{
+ return parent.create_source(p);
+}
+
+Target *CustomizedTool::create_target(const vector<Target *> &s, const string &a)
+{
+ Target *target = parent.create_target(s, a);
+ target->set_tool(*this);
+ return target;
+}
+
+Target *CustomizedTool::create_install(Target &t) const
+{
+ return parent.create_install(t);
+}
+
+string CustomizedTool::create_build_signature(const BuildInfo &bi) const
+{
+ string sig = Tool::create_build_signature(bi);
+ string parent_sig = parent.create_build_signature(bi);
+ string::size_type comma = parent_sig.find(',');
+ if(comma==string::npos)
+ return sig;
+ else
+ return sig+parent_sig.substr(comma);
+}
+
+void CustomizedTool::do_prepare(ToolData &tool) const
+{
+ parent.prepare(&static_cast<Tool &>(tool));
+}
--- /dev/null
+#ifndef CUSTOMIZEDTOOL_H_
+#define CUSTOMIZEDTOOL_H_
+
+#include "tool.h"
+
+class CustomizedTool: public Tool
+{
+protected:
+ Tool &parent;
+
+ CustomizedTool(Builder &, const std::string &, const Architecture &);
+ CustomizedTool(Tool &, const Architecture &);
+
+public:
+ const Tool *get_base_tool() const override { return &parent; }
+ Target *create_source(const Component &, const Msp::FS::Path &) const override;
+ Target *create_source(const Msp::FS::Path &) const override;
+ Target *create_target(const std::vector<Target *> &, const std::string & = std::string()) override;
+ Target *create_install(Target &) const override;
+ std::string create_build_signature(const BuildInfo &) const override;
+protected:
+ void do_prepare(ToolData &) const override;
+};
+
+#endif