+
+void Tool::prepare()
+{
+ if(prepared)
+ return;
+
+ prepared = true;
+
+ if(!command.empty())
+ executable = builder.get_vfs().find_binary(command);
+ prepare(*this);
+ if(!command.empty() && !executable)
+ {
+ builder.get_logger().log("problems", "Can't find executable %s for %s", command, tag);
+ problems.push_back(format("Can't find executable %s", command));
+ }
+}
+
+void Tool::prepare(Tool &tool) const
+{
+ if(&tool!=this && tool.get_base_tool()!=this)
+ throw invalid_argument("Tool::prepare");
+
+ do_prepare(tool);
+}
+
+string Tool::create_build_signature(const BuildInfo &) const
+{
+ if(executable)
+ return format("%s=%s", tag, FS::basename(executable->get_path()));
+ else
+ return string();
+}
+
+
+void operator>>(const LexicalConverter &conv, Tool::ProcessingUnit &unit)
+{
+ const string &str = conv.get();
+ if(str=="FILE")
+ unit = Tool::ONE_FILE;
+ else if(str=="DIRECTORY")
+ unit = Tool::DIRECTORY;
+ else if(str=="COMPONENT")
+ unit = Tool::COMPONENT;
+ else
+ throw lexical_error(format("conversion of '%s' to ProcessingUnit", str));
+}